Skip to content

OpenConceptLab/ocl_online#456 | Order a concept's mappings by id (fixes flaky inverse-mappings test) - #954

Merged
paynejd merged 4 commits into
masterfrom
ocl_online-456-inverse-mappings-test
Oct 22, 2026
Merged

paynejd merged 4 commits into
masterfrom
ocl_online-456-inverse-mappings-test

Conversation

@paynejd

@paynejd paynejd commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

test_inverse_mappings_are_unchanged (added in #949) failed intermittently on CI: three of five runs on the same tree on 2026-10-22, including both attempts of master's Build at 0c4bae2, which blocked the deploy. It passed locally every time (alone, in its module, and in the full 2,720-test suite).

Cause. The per-concept mapping querysets in ConceptAbstractSerializer.get_mappings and ConceptVersionDetailSerializer.get_mappings have no ORDER BY, and Mapping has no default ordering. The test makes the same request twice. The first request saves checksums on the mapping rows it serializes, which rewrites them, so on a database with earlier tests' leftovers the second request can return a concept's mappings in a different order. The failing reprs had identical lengths, which fits reordered mappings of the same shape. #949's batched path already orders by id.

Fix. Both get_mappings implementations order a concept's mappings by id, for inverse and direct, collection and non-collection. Which mappings are returned doesn't change. The test now compares plain lists, so a failure names the differing element. (response.data is a ReturnList, so assertEqual never printed a diff before.) It also asserts each concept's mappings are id-ordered.

Verified. Locally, 446 tests pass (core.concepts, core.mappings and the concepts integration module) and pylint rates 10.00. CI ran on this PR. The branch's earlier commits added and then removed a temporary diagnostic, so squash-merge it.

Part of OpenConceptLab/ocl_online#456

🤖 Generated with Claude Code

https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph

paynejd and others added 4 commits October 22, 2026 15:47
…appings list tests fail

test_inverse_mappings_are_unchanged failed on master CI twice at 0c4bae2,
with a diff truncated to its first difference (checksum key order).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph
…hen the inverse-mappings test fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph
…PI responses

The per-concept mapping querysets had no ORDER BY, so two identical
requests could list a concept's mappings in different orders once rows were
rewritten (the first request saves their checksums). That made
test_inverse_mappings_are_unchanged fail intermittently on CI. Both
get_mappings implementations now order by id, as the batched path from
#949 already does. The test compares plain lists, so a failure shows the
differing element, and checks the mapping order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex review, pass 1 (codex-cli 0.163.0, commit 155eaf3)

Scope: net diff origin/master...155eaf30b6067ba552bd0c46805dd381604a7bed (the per-concept mapping ordering fix and the test change). Reasoning effort xhigh, read-only.

Verdict: clean. No findings.

findings.json
{
  "reviewer": "codex-cli 0.163.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "155eaf30",
  "verdict": "clean",
  "prior": [],
  "findings": []
}

@paynejd

paynejd commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Simplification review (fresh Claude subagent, commit 155eaf3)

Verdict: clean, nothing to cut. The change is four order_by('id') calls and a small test tightening; the id-order assertion pins the fix, so it stays. No commits after Codex pass 1.

@paynejd paynejd changed the title OpenConceptLab/ocl_online#456 | Fix test_inverse_mappings_are_unchanged failing on master OpenConceptLab/ocl_online#456 | Order a concept's mappings by id (fixes flaky inverse-mappings test) Oct 22, 2026
@paynejd
paynejd marked this pull request as ready for review October 22, 2026 21:37
@paynejd
paynejd merged commit 3e60602 into master Oct 22, 2026
5 checks passed
@paynejd
paynejd deleted the ocl_online-456-inverse-mappings-test branch October 22, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant