Repository navigation
OpenConceptLab/ocl_online#655 | Isolated source versions - #985
Conversation
snyaggarwal
left a comment
There was a problem hiding this comment.
Findings
- [P1] Failure atomicity: hierarchy and HEAD membership can change before version persistence completes, so a failed version write can leave partially applied data. The parallel import path also reconciles hierarchy after rejecting a version line. Specific locations and remediation are on the linked tracker issue: OpenConceptLab/ocl_online#655.
- [P2] Mode selection: the workflow path and the persisted mode can diverge when the request flag and Source Version line disagree. Details and expected behavior are on OpenConceptLab/ocl_online#655.
- [P3] OOP / duplicated logic: isolated-version orchestration is implemented separately in the inline, parallel JSON-lines, and archive subtask paths. Consolidating validation, hierarchy reconciliation, and sweep coordination into a shared importer service would prevent their current behavior from drifting; see OpenConceptLab/ocl_online#655 for the concrete differences.
I found no additional P4/P5 findings or nits.
|
Addressed in 308432d:
pylint is clean. The isolated-version tests pass with Redis unreachable, and the focused suite has only the |
snyaggarwal
left a comment
There was a problem hiding this comment.
Second review
The prior hierarchy/sweep/version transaction finding and duplicated orchestration finding are addressed. Remaining/new findings:
- [P1] Post-commit ordering can leave a committed version unseeded. The fallible indexing callback is registered before the version-seeding callback; if indexing raises, later callbacks do not run and the import can report failure after the DB commit.
- [P1] A rejected final version still leaves earlier content imports on HEAD. The shared transaction starts after concept/mapping tasks have committed, and the existing-version test only reimports unchanged content.
- [P2] Mode resolution still differs from the linked requirement. The request flag is authoritative instead of the Source Version line/HEAD default, and API version creation still ignores the requested mode.
- [P2] Omitted isolated metadata is inherited. The implementation and test retain fields such as
website, while the linked requirement says missing payload metadata is cleared. - [P2] Archive look-ahead scans every string
versioning_modefield and skips non-string values. This can reject a valid archive because of a Source line or defer an invalid Source Version value until after content imports.
Full reproductions and suggested fixes are on OpenConceptLab/ocl_online#655. No additional P3-P5 findings or nits.
|
Second review addressed in a5a1fd7. Details are on OpenConceptLab/ocl_online#655.
|
snyaggarwal
left a comment
There was a problem hiding this comment.
Third-round review
The earlier rejection/transaction and callback-order findings are addressed in the current head. This pass found one remaining reliability blocker plus four performance/architecture issues in the new large-import paths. Each finding is posted inline with reproduction impact and a concrete remediation.
Summary: 1× P1, 3× P2, 1× P3. No additional P4/P5 findings or nits.
|
Third review addressed in da8dc58.
|
snyaggarwal
left a comment
There was a problem hiding this comment.
Verdict: Request changes
Reviewed current head d9d8091e. The five findings from the prior round are materially addressed, including the hierarchy consolidation, batched changelog/import aggregation, and retryable dropped-code indexing.
Remaining/new findings:
- P1 — failed or missing parallel child results are ignored. The version can still be committed and unseen HEAD content swept after a child task failure.
- P2 — dropped-code repair arguments are not persisted. The stranded-task/manual rerun path requeues the repair without its required arguments.
- P3 — the repair uses one unbounded Celery payload. A large replacement can send hundreds of thousands of IDs in one broker message.
I left detailed inline comments with concrete remediations and regression cases. No additional P4/P5 findings or nits.
Verification: 55 focused tests passed (IsolatedVersionImportTest, IsolatedVersionZipImportTest, BulkImportParallelRunnerTest, and SourceVersionsChangelogOutputViewTest). The P1 failed-child scenario and replayability of the repair task are not covered by those tests.
|
Fourth review addressed in 76f0a23.
|
snyaggarwal
left a comment
There was a problem hiding this comment.
Verdict: Approve
Reviewed current head 76f0a239. The three findings from the previous round are addressed:
- failed, lost, or missing parallel parts now block the isolated-version commit and preserve HEAD;
- dropped-code repair tasks persist their arguments and leave a replayable failed task when enqueueing fails;
- repair work is split into bounded 5,000-ID chunks, with HEAD recounted once.
I found no new P1-P5 findings or nits in this round.
Verification:
- 58 focused isolated-import, archive, parallel-runner, hierarchy, and changelog tests passed;
- targeted pylint passed at 10.00/10;
- GitHub Tests, Pylint, and Snyk checks are green.
|
The names are the proposed ones and may still change after the decisions on OpenConceptLab/ocl_online#671. oclweb3#97 shows the seed as "Seeded From" ( Testing: |
paynejd
left a comment
There was a problem hiding this comment.
Claude review, pass 2, with a Codex check (commit b14c5f0)
Verdict: fix-first. The rename in ab81129f and b14c5f0f does what D1 to D4 recommend, and I found nothing wrong with it on the main paths. The two P1s below come from the first review, at 76f0a239, which we held back until the version model was settled, so this is the first time they're posted. Your design page lists "Review P1s on #985" as approved; these two are still open. Neither commit touches the code they point at, and both still reproduce at b14c5f0f. That page and this PR's description both say version-scoped children/ and parents/ work, but through the API they don't (item 1).
Fix before merge
- [P1]
core/concepts/views.py:626(and the parents view):is_source_version()readsparent_resource, which these views never set, so it's always False./sources/S/<version>/concepts/X/children/is answered from HEAD's links, and H4 isn't delivered. Probe atb14c5f0f:v1tov3each with P, A and B (A and B children of P), thenv4with P and A.children/of P returns A and B on all four versions, thoughv4holds only A. The model method alone returns only A. The PR's API test passes because HEAD gives the same answer in its case. @snyaggarwal: resolve the repo version from the URL before branching, and add a test where a version differs from HEAD. The HEAD fallback was already there before this PR. - [P1]
core/concepts/models.py:1419: after an import drops a child, the parent's HEADchildren/still lists it, and opening it gives a 404. The sweep removes the dropped concept's own links but keeps the links its version rows hold (H3), and the HEAD lookup returns them without an active or membership filter. Same probe: B is 404 on HEAD, yet HEADP/children/returns A and B. Filter HEAD hierarchy lookups to active HEAD members inget_hierarchy_related_queryset. With oclapi2#990 merged,get_viewable_hierarchy_concept_urlswraps that lookup, so it gets the fix too.
Not blocking
- [P2]
core/importers/models.py:1160: mappings nested in a Concept line are created but not recorded as seen, so the sweep drops them while the import reports success. Probe atb14c5f0f: the version and HEAD end with 0 mappings. LOINC doesn't nest mappings. Track their ids, or reject nested mappings whenseed_from_import=true. (Codex rated this P1 in pass 1.) - [P2]
core/importers/models.py:458: the dropped counts are returned and thrown away, so the import result never says how many concepts and mappings left HEAD. Probe atb14c5f0f: a file with concepts but no mapping lines made a version with 0 mappings and no error. This is behaviour 6 on the Decisions tab. - [P2] New in this pass:
seed_from_import=trueon the deprecated/importers/bulk-import/upload/and/importers/bulk-import/file-url/is accepted, then dropped.queue_bulk_importpasses the switch only to inline tasks, andbulk_importdoesn't take it. The file runs as a plain import and returns 202: its Source Version line makes a version from HEAD, and nothing is dropped. Neither endpoint lists the switch in Swagger, butimport_responsevalidates it there. Reject it with a 400 on the non-inline path, as npm imports are; there are three one-click suggestions for this inline, plus a test that expects the 400. This was already the case before the rename. - [P2]
core/importers/models.py:369: outside tests, a queued task copies the version's membership from HEAD, so a change to HEAD before it runs changes the release. Tests seed at once inTEST_MODE. The pattern predates this PR, but the sweep makes it worse. Snapshot membership in the commit transaction, or refuse a new seeding import while the previous version is still processing. - [P2]
core/importers/models.py:456: two seeding imports into one source can run at once, and the first commit's sweep drops what only the second sent. A per-source reservation from preflight to commit would stop it. - [P2]
core/mappings/models.py:425: a seeding import's mapping update keeps relation-derived text, such asto_concept_name, when the release line leaves it out. LOINC lines carry no names, so LOINC isn't affected. - [P3]
core/concepts/models.py:1272: seeding imports still queue the per-concept hierarchy task, and a late one could write old parents over a newer commit. You noted on the ticket that you'd skip them. - [P3]
core/concepts/models.py:1461: the new hierarchy resolver skips a parent URL that names a concept version, which the oldmake_hierarchyaccepted. Not reproduced on the inline runner, and the parallel runner isn't covered by tests. Codex now rates it P2. - [P3] New:
core/common/tasks.py:285: the deprecated/importers/bulk-import-inline/honours the switch, butbulk_import_inlineisn't bound, so its version records{"type": "import", "task": null}. A TODO inqueue_bulk_importsays that task can't be reached, butBulkImportInlineViewreaches it withthreads=None. Bind the task and passself.request.id(one-click suggestion inline). Codex rates this P1; I don't, because only the audit id is missing. - [P3] New:
core/sources/models.py:243:get_version_urlrebuilds a version's URL from its label. Use the new version's ownuri, which is the same string today, so the seed and the version's own URL can't drift apart. - [P3] New:
0047addsversioning_modeand0048removes it. Neither has shipped, so folding them into a single migration that addsseeded_fromdrops the round trip, and the reverse-migration gap Codex found in0048with it. Do it unless a shared database (staging?) already ran0047. oclapi2#955 also adds a sources0047; whichever merges second renumbers.
The rename (ocl_online#672). Each case below was probed at b14c5f0f:
- An import-seeded version records
{"type": "import", …}, and HEAD records that version, as D4 recommends. - POST
…/versions/records HEAD and ignores aseeded_fromin the payload. - PUT on a version can't change it.
- HEAD keeps its seed through later versions made from HEAD.
- The HEAD and version details return
seeded_fromand noversioning_mode. - A Source or Source Version import line can't set it, since neither importer's
allowed_fieldsincludes it. - The inline, parallel and zip/tar runners pass the import task id. The deprecated inline endpoint doesn't (above).
- On production, every source version has a HEAD, so the backfill never writes a seed with no URL.
An old isolated_version=true is now ignored. That's fine, since the name never shipped, but any runbook for the LOINC 2.82 staging run needs the new name.
Decisions
The six behaviour questions are D8 on the Decisions tab of the Repo Versions Model doc, for today's meeting. Please note the outcomes here once they're settled.
How it was checked
- Read your design page, the two new commits and the earlier findings against
b14c5f0f. The branch merges cleanly withmasterat015eaaa2(#987, #990, #991 and #992 in). CI is green. - Re-ran the first review's probes at
b14c5f0fon a throwaway stack, plus new probes forseeded_from: HEAD, import-seeded versions, POST with a spoofed seed, PUT, and the HEAD detail. - Codex (codex-cli 0.169.0, xhigh), pass 2: all nine earlier findings unresolved, plus three new ones (P1, P2, P2 by its rating; P3 each here, explained above). I found the deprecated-endpoint switch on my own.
findings.json
[
{
"id": "C1",
"severity": "P1",
"file": "core/concepts/views.py",
"line": 626,
"claim": "Version-scoped children/ and parents/ branches never run: is_source_version() reads parent_resource, which is not the source version in get_queryset, so it is always False.",
"scenario": "Version URL children/ is answered from HEAD's links; in a 4-import run /v4/concepts/P/children/ returned A and B although B is not in v4.",
"action": "Resolve the repo version from the URL kwargs before branching and add a test where a version differs from HEAD.",
"confidence": "high",
"source": "both",
"codex_check": "partly",
"introduced_by_pr": false,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved",
"probe_b14c5f0f": "reproduced"
},
{
"id": "C2",
"severity": "P1",
"file": "core/concepts/models.py",
"line": 1419,
"claim": "HEAD children/ of a parent lists a dropped concept: version-row links are kept and HEAD lookup has no active/membership filter.",
"scenario": "v1-v3 with P, A, B; v4 with P, A: HEAD P/children/ returns A and B while B is 404 on HEAD.",
"action": "Return only active HEAD members from HEAD hierarchy lookups.",
"confidence": "high",
"source": "both",
"codex_check": "confirmed",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved",
"probe_b14c5f0f": "reproduced"
},
{
"id": "C3",
"severity": "P2",
"file": "core/importers/models.py",
"line": 1160,
"claim": "Mappings nested in a Concept line are not recorded as seen, so the sweep drops them.",
"scenario": "Concept with a nested mapping plus a version line: version and HEAD end with 0 mappings.",
"action": "Track nested mapping ids or reject nested mappings in isolated imports.",
"confidence": "high",
"source": "both",
"codex_check": "partly",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved",
"probe_b14c5f0f": "reproduced"
},
{
"id": "C4",
"severity": "P2",
"file": "core/importers/models.py",
"line": 458,
"claim": "Dropped counts are discarded; the import result never says how much left HEAD.",
"scenario": "Concepts-only isolated import leaves 0 mappings in the version and HEAD with no error.",
"action": "Return the counts; optionally a dry run or a drop threshold.",
"confidence": "high",
"source": "claude",
"codex_check": "partly",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved",
"probe_b14c5f0f": "reproduced"
},
{
"id": "C5",
"severity": "P2",
"file": "core/importers/models.py",
"line": 369,
"claim": "The version's membership is seeded from HEAD by a queued task, so later HEAD changes alter the release.",
"scenario": "A second import or edit changes HEAD before the seed task runs.",
"action": "Snapshot membership in the commit transaction or block a new isolated import while processing.",
"confidence": "medium",
"source": "codex",
"codex_check": "partly",
"introduced_by_pr": false,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved"
},
{
"id": "C6",
"severity": "P3",
"file": "core/concepts/models.py",
"line": 1272,
"claim": "Isolated imports still queue per-concept hierarchy tasks that can run late.",
"scenario": "A late task overwrites HEAD parents after a newer commit.",
"action": "Skip those tasks in isolated imports.",
"confidence": "medium",
"source": "both",
"codex_check": "partly",
"introduced_by_pr": false,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved"
},
{
"id": "C7",
"severity": "P2",
"file": "core/mappings/models.py",
"line": 425,
"claim": "Isolated mapping updates keep relation-derived text such as to_concept_name.",
"scenario": "Release 2 omits to_concept_name; the new version keeps the old label.",
"action": "Reset omitted optional fields before resolving relations.",
"confidence": "medium",
"source": "both",
"codex_check": "partly",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved"
},
{
"id": "C8",
"severity": "P2",
"file": "core/importers/models.py",
"line": 456,
"claim": "Two isolated imports into one source can run at once.",
"scenario": "The first commit's sweep drops what only the second import sent.",
"action": "Per-source reservation from preflight to commit.",
"confidence": "medium",
"source": "both",
"codex_check": "partly",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved"
},
{
"id": "C9",
"severity": "P3",
"file": "core/concepts/models.py",
"line": 1461,
"claim": "The hierarchy resolver skips parent URLs that name a concept version.",
"scenario": "Parallel import with a version URL parent: the link is never made. Not reproduced.",
"action": "Resolve versioned and versionless URLs to the versioned object.",
"confidence": "low",
"source": "codex",
"codex_check": "not-run",
"introduced_by_pr": true,
"status_b14c5f0f": "unresolved",
"codex_pass2": "unresolved",
"codex_pass2_severity": "P2"
},
{
"id": "C10",
"severity": "P2",
"file": "core/common/utils.py",
"line": 466,
"claim": "seed_from_import=true on the deprecated upload/ and file-url/ endpoints is validated, then never reaches the runner.",
"scenario": "POST /importers/bulk-import/upload/?seed_from_import=true with a release file: 202, plain import, a version made from HEAD, nothing dropped.",
"action": "Reject the switch with a 400 on endpoints that can't seed.",
"confidence": "high",
"source": "claude",
"introduced_by_pr": true
},
{
"id": "C11",
"severity": "P3",
"file": "core/common/tasks.py",
"line": 285,
"claim": "bulk_import_inline isn't bound, so a seeding import through the deprecated bulk-import-inline endpoint records task null.",
"scenario": "POST /importers/bulk-import-inline/?seed_from_import=true: seeded_from is {type: import, task: null}.",
"action": "Bind the task and pass self.request.id as self_task_id.",
"confidence": "high",
"source": "codex (F2.3, rated P1)",
"introduced_by_pr": true
},
{
"id": "C12",
"severity": "P3",
"file": "core/sources/models.py",
"line": 243,
"claim": "HEAD's seeded_from URL is rebuilt from the version label rather than taken from the version's uri.",
"scenario": "A label needing URL encoding gives a seed URL that doesn't resolve (as the version's own URI already would).",
"action": "Use the new version's uri.",
"confidence": "medium",
"source": "codex (F2.9, rated P2)",
"introduced_by_pr": true
},
{
"id": "C13",
"severity": "P3",
"file": "core/sources/migrations/0048_source_seeded_from.py",
"line": 49,
"claim": "0047 adds versioning_mode and 0048 removes it; reversing 0048 loses which versions were import-seeded.",
"scenario": "Migrate a database with import-seeded versions back to 0047 and forward again: they become HEAD-seeded.",
"action": "Fold 0047 and 0048 into one migration while neither has shipped.",
"confidence": "high",
"source": "codex (F2.10, rated P2) + claude",
"introduced_by_pr": true
}
]|
Pass 2 review: changes in 85a6d41. Fixed
Still open, not in this push: the nested-mapping sweep, the dropped counts (D8.6 / ocl_online#674, which is on today's meeting agenda), queued membership seeding, concurrent seeding imports, mapping relation text, late hierarchy tasks, the versioned parent URL resolver, The local stack was down, so CI is running the tests for this push. Pylint 🤖 Addressed by Claude Code |
Codex review, pass 3 (codex-cli 0.169.0, commit 85a6d41)Verdict: fix-first. There are two P1s, and both reproduce on a test stack at Rechecked on
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "85a6d41d",
"verdict": "findings",
"prior": [
{
"id": "C1",
"status": "resolved"
},
{
"id": "C2",
"status": "regressed"
},
{
"id": "C3",
"status": "unresolved"
},
{
"id": "C4",
"status": "unresolved"
},
{
"id": "C5",
"status": "unresolved"
},
{
"id": "C6",
"status": "unresolved"
},
{
"id": "C7",
"status": "unresolved"
},
{
"id": "C8",
"status": "unresolved"
},
{
"id": "C9",
"status": "unresolved"
},
{
"id": "C10",
"status": "resolved"
},
{
"id": "C11",
"status": "resolved"
},
{
"id": "C12",
"status": "unresolved"
},
{
"id": "C13",
"status": "unresolved"
}
],
"findings": [
{
"id": "F3.1",
"severity": "P1",
"tag": null,
"file": "core/concepts/models.py",
"line": 1420,
"claim": "The C2 fix makes historical hierarchy URLs depend on current HEAD membership.",
"scenario": "Import v1 with P and C\u2192P, then v2 with C parentless and P omitted. GET /v1/concepts/C/?includeParentConceptURLs=true now returns an empty parent_concept_urls list: historical serializers call this helper with versioned=False, and P's inactive HEAD is excluded despite P remaining a v1 member. The new version-scoped parents/ view still returns P, so the two API representations disagree.",
"action": "Apply the active-membership restriction to HEAD-scoped reads while preserving historical hierarchy links in version serializers. Add a historical-detail assertion after dropping its parent from HEAD.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F3.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 456,
"claim": "The transaction starts after concept imports have already changed HEAD's hierarchy.",
"scenario": "Start with ROOT, P1 and C\u2192P1, set ROOT as hierarchy_root, then import C parentless while omitting ROOT. Concept version creation calls update_versioned_object(), which replaces HEAD's parent links before IsolatedVersionCommit.run(). The root-drop check subsequently rejects the version, but rolling back this transaction leaves C's HEAD hierarchy changed. test_hierarchy_root_drop_rolls_back_the_hierarchy uses this scenario but asserts only concept membership, so it misses the failure.",
"action": "Defer HEAD hierarchy mutations, including per-concept hierarchy tasks, until the isolated commit transaction. Assert that HEAD's original parent links survive a rejected import.",
"lines_delta": null,
"confidence": "high"
}
]
} |
|
Codex pass 3: both P1s are fixed in adde0b0.
Checked locally: Since pass 2: 🤖 Addressed by Claude Code |
Codex review, pass 4 (codex-cli 0.169.0, commit adde0b0)Verdict: fix-first. The main path works on a full LOINC 2.82 load: the version holds exactly the release, nothing carries forward, and parent links are replaced correctly. Five P1s and three P2s remain. F4.1 to F4.7 were reproduced on a test stack, and F4.8 comes from reading the test. Decisions from Jon (2026-11-18)
Findings
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "adde0b05",
"verdict": "findings",
"prior": [
{
"id": "C1",
"status": "resolved"
},
{
"id": "C2",
"status": "resolved"
},
{
"id": "C3",
"status": "unresolved"
},
{
"id": "C4",
"status": "unresolved"
},
{
"id": "C5",
"status": "unresolved"
},
{
"id": "C6",
"status": "unresolved"
},
{
"id": "C7",
"status": "unresolved"
},
{
"id": "C8",
"status": "unresolved"
},
{
"id": "C9",
"status": "unresolved"
},
{
"id": "C10",
"status": "resolved"
},
{
"id": "C11",
"status": "resolved"
},
{
"id": "C12",
"status": "unresolved"
},
{
"id": "C13",
"status": "unresolved"
},
{
"id": "F3.1",
"status": "resolved"
},
{
"id": "F3.2",
"status": "unresolved"
}
],
"findings": [
{
"id": "F4.1",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 636,
"claim": "Seeding imports can still publish hierarchy changes before the commit.",
"scenario": "In an archive or single-thread inline import, add a new child C under existing P and omit the configured hierarchy root. The new-concept task writes C's HEAD and initial-version parent links outside the transaction. The root check rejects the version, but HEAD can still list C under P. Existing-concept updates also write the new concept-version links outside the transaction, and HEAD hierarchy reads include that latest row.",
"action": "Defer hierarchy tasks for both new and updated concepts in seeding imports. Write the HEAD and concept-version links in the version transaction and test the HEAD API after a rejected import.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 327,
"claim": "Import-seeded versions lose repository configuration that POST versions inherit.",
"scenario": "Give HEAD property definitions, filters, FHIR meta, and semantic matching. POST /versions/ carries those settings forward through SourceVersionListView.create. A seeding import that omits those fields creates a version with empty properties, filters, and match algorithms and null meta. Supplying new properties, filters, or meta on the Source Version line also has no effect on HEAD because the importer strips them.",
"action": "Apply explicitly supplied metadata to HEAD and reuse the POST version defaults when constructing the seeded version. Add a test that compares both creation paths with configured HEAD metadata.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.3",
"severity": "P1",
"tag": null,
"file": "core/concepts/serializers.py",
"line": 639,
"claim": "A regenerated release export includes hierarchy links from current HEAD.",
"scenario": "Seed v1 with C under P1, then seed v2 with C under P2. Regenerate the v1 export. C's v1 row still links to P1, but the export unions it with C's HEAD links, so v1 now exports both P1 and P2 as parents.",
"action": "Pass the source version into the export serializer and resolve its hierarchy from the exported release. Add an export assertion before and after a later import moves a child.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.4",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 457,
"claim": "An owner or source mismatch between the content and version line can empty the target HEAD.",
"scenario": "An editor uploads a release whose concept and mapping lines name LOINC-Staging, while its Source Version line names LOINC. Both sources are editable. The rows succeed in LOINC-Staging, and the commit treats every existing LOINC member as unseen. It drops them and reports a successful empty LOINC release.",
"action": "Validate that each concept and mapping line targets the source named by the Source Version line before importing any content.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.5",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 200,
"claim": "An ordinary import can report a dropped concept as updated while it remains absent from HEAD.",
"scenario": "Seed a release that drops A, then submit an ordinary bulk import with update_if_exists=true and a changed name for A. The importer finds the inactive HEAD row and reports UPDATED. The new concept version joins HEAD's source membership, but the HEAD row stays inactive. GET /concepts/A/ still returns 404, while a subsequent POST /versions/ can seed A from the same HEAD.",
"action": "Handle dropped rows explicitly in ordinary imports so the update result, HEAD visibility, and membership used for later snapshots agree.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.6",
"severity": "P2",
"tag": null,
"file": "core/importers/models.py",
"line": 1485,
"claim": "A parallel import silently falls back to HEAD seeding when another version line precedes the Source Version in its batch.",
"scenario": "Import a valid Concept line followed by a Collection Version line and the sole Source Version line, with seed_from_import=true. Preflight accepts the order. The runner groups both version lines together and checks only the first row for Source Version. The ordinary worker creates the source version from HEAD and leaves omitted codes in place.",
"action": "Give the validated Source Version line its own commit step, or reject the mixed input during preflight.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.7",
"severity": "P2",
"tag": null,
"file": "core/concepts/serializers.py",
"line": 805,
"claim": "Version-scoped hierarchy endpoints still expose out-of-release links in their optional nested fields.",
"scenario": "Seed v1 with X under P and B under X. Seed v2 with unchanged P and X, with duplicate-version prevention enabled so X's row is reused, and omit B. GET /v2/concepts/P/children/?includeChildConcepts=true returns X with B in its nested children field, even though /v2/concepts/X/children/ is empty.",
"action": "Use the resolved source version for the optional children and parents fields and the has_children flag. Test a retained row whose related concept was dropped.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F4.8",
"severity": "P2",
"tag": null,
"file": "core/importers/tests.py",
"line": 6951,
"claim": "The dropped-concept 404 assertion uses a code that the test never imports.",
"scenario": "The fixture imports P and C, then drops P. The final request checks B, so it still returns 404 if dropped concepts remain reachable through the HEAD detail endpoint.",
"action": "Request P in the 404 assertion, or move the B assertion back to the fixture that imports and drops B.",
"lines_delta": null,
"confidence": "high"
}
]
} |
|
@paynejd decided on Nov 18 that the guard against large drops goes into this PR before it merges, not as a follow-up. The behaviour: an import into an isolated version reports how many resources it drops from HEAD, and refuses a large drop unless the request says the drop is intended. Without it, anyone with edit access could run an import that drops almost everything from HEAD and use up the version id, which is hard to undo. The design treats this as the one behaviour to guard rather than accept. He also confirmed decisions D1 to D7 as built (tracked on OpenConceptLab/ocl_online#672). |
|
Next steps for LOINC 2.82 (Jon, 2026-11-18) @snyaggarwal, the rebuilt LOINC 2.82 import file is ready (OpenConceptLab/ocl-content#7), so the staging run can use it directly.
|
…48_source_verification
2496d91 to
5776c40
Compare
|
Rebased onto master (
Checked locally on a fresh test database, so the renumbered migrations apply from scratch: 🤖 Addressed by Claude Code |
…rchy root and line metadata before any content, link concepts with assigned ids and versioned parent URLs, and report archive drops
|
Codex pass 5 is addressed in cf31316. It's a normal push on top of 5776c40. The guard and hierarchy-root check now run before any content imports (F5.1, F5.2)
Findings
Checked locally: Still open: C3, C5, C7, C8, C12 and C13; F4.3 is tracked on ocl_online#687. 🤖 Addressed by Claude Code |
Codex review, pass 6 (codex-cli 0.169.0, commit cf31316)Verdict: fix-first. One P0 and five P1s, all reproduced on a test stack (F6.3 and F6.5 up to the preflight step), plus six P2s. The P0, F6.1, is new in cf31316 and breaks the task status of every archive import, not only seeding ones. Rebase check: cc94bd4 and 254d5b2 match 825bf09 and 2496d91 apart from the merged field list in Pass 5 findings at cf31316
Findings
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "cf31316e",
"verdict": "findings",
"prior": [
{
"id": "C1",
"status": "resolved"
},
{
"id": "C2",
"status": "resolved"
},
{
"id": "C3",
"status": "unresolved"
},
{
"id": "C4",
"status": "resolved"
},
{
"id": "C5",
"status": "unresolved"
},
{
"id": "C6",
"status": "unresolved"
},
{
"id": "C7",
"status": "unresolved"
},
{
"id": "C8",
"status": "unresolved"
},
{
"id": "C9",
"status": "resolved"
},
{
"id": "C10",
"status": "resolved"
},
{
"id": "C11",
"status": "resolved"
},
{
"id": "C12",
"status": "unresolved"
},
{
"id": "C13",
"status": "unresolved"
},
{
"id": "F3.1",
"status": "resolved"
},
{
"id": "F3.2",
"status": "resolved"
},
{
"id": "F4.1",
"status": "unresolved"
},
{
"id": "F4.2",
"status": "resolved"
},
{
"id": "F4.3",
"status": "unresolved"
},
{
"id": "F4.4",
"status": "resolved"
},
{
"id": "F4.5",
"status": "resolved"
},
{
"id": "F4.6",
"status": "resolved"
},
{
"id": "F4.7",
"status": "unresolved"
},
{
"id": "F4.8",
"status": "resolved"
},
{
"id": "F5.1",
"status": "resolved"
},
{
"id": "F5.2",
"status": "resolved"
},
{
"id": "F5.3",
"status": "resolved"
},
{
"id": "F5.4",
"status": "resolved"
},
{
"id": "F5.5",
"status": "regressed"
},
{
"id": "F5.6",
"status": "resolved"
},
{
"id": "F5.7",
"status": "resolved"
},
{
"id": "F5.8",
"status": "unresolved"
},
{
"id": "F5.9",
"status": "regressed"
}
],
"findings": [
{
"id": "F6.1",
"severity": "P0",
"tag": null,
"file": "core/importers/importer.py",
"line": 83,
"claim": "Archive import results fail to deserialize, breaking task status and completion reporting.",
"scenario": "A ZIP or TAR import schedules subtasks and serializes its initial summary with `dropped: null`. Pydantic accepts the omitted default when constructing the summary, but rejects explicit null when `ImportTask.import_task_from_json` reads it back because the field is declared as `dict`. Polling the task returns 500 and `import_finisher` fails, including for ordinary archive imports and successful seeded imports.",
"action": "Declare `dropped` nullable and test the round trip from the archive runner through the finisher and task-detail response, with and without counts.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 510,
"claim": "Idless mapping lines can hide a large drop on every runner.",
"scenario": "HEAD contains 2,000 concepts and 2,000 mappings. A release keeps the concepts and supplies 2,000 idless mappings with changed target codes. The importer creates new mapping identities. Preflight credits those lines with retaining every old mapping, then the sweep drops all 2,000 old mappings and uses the version ID without confirmation. If omitted concepts alone trigger a refusal, its message still underreports the mappings.",
"action": "Resolve distinct retained mapping identities using the importer's matching and update rules. Where preflight cannot establish the identity, stage the writes and check the actual drop against the original HEAD before publishing any changes.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.3",
"severity": "P1",
"tag": null,
"file": "core/importers/importer.py",
"line": 548,
"claim": "ZIP and TAR preflight count DELETE lines that the archive workers skip.",
"scenario": "An archive lists 1,500 existing mappings with `__action: \"DELETE\"` and keeps the concepts. Preflight counts all 1,500 mappings as retained. The workers skip those lines without recording a failure, so the sweep can drop them all without confirmation. If a skipped Concept line names the hierarchy root, preflight also misses that omission and the root check refuses only after other content writes have landed.",
"action": "Use the same effective content lines for preflight, archive processing, and hierarchy collection. Test both a large drop and a root omission through the archive runner.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.4",
"severity": "P2",
"tag": null,
"file": "core/importers/models.py",
"line": 498,
"claim": "Numeric JSON mapping IDs can make preflight refuse a release that retains every mapping.",
"scenario": "A source has numeric mapping mnemonics stored as strings. A release sends those same IDs as JSON integers. The mapping importer's Django `CharField` lookup matches each integer to its stored string, while preflight compares the raw integers against strings. If the apparent omissions cross the threshold, the release is refused even though the actual drop would be zero.",
"action": "Normalize explicit IDs using the same representation as the importer lookup. Test a release that retains numeric mapping IDs supplied as JSON numbers.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.5",
"severity": "P1",
"tag": null,
"file": "core/importers/importer.py",
"line": 554,
"claim": "Archive preflight validates empty placeholders in place of version metadata.",
"scenario": "A ZIP or TAR contains a renamed concept, a new concept, and a Source Version line with `filters: [\"status\"]`. The scanner passes `filters: []` to preflight, so the content workers run. The version subtask then sees the actual array and rejects it. The renamed concept, its new version, and the new concept remain in HEAD.",
"action": "Read the complete Source Version object during archive preflight and validate it before scheduling any content. Test that an invalid nested value leaves HEAD and its concept versions unchanged.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.6",
"severity": "P2",
"tag": null,
"file": "core/importers/models.py",
"line": 391,
"claim": "Malformed display metadata can still break HEAD and release detail responses.",
"scenario": "A seeding line sets `meta` to `{\"display\":{\"concept_filter_order\":1}}` and the source has at least one filter. The dictionary check passes and the import saves it to HEAD and the release. Both detail serializers call `filters_ordered`, which attempts to unpack the integer and returns 500.",
"action": "Validate the shape of the display metadata that source responses consume. Add a rejection case with existing filters and confirm both source details remain readable.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.7",
"severity": "P2",
"tag": null,
"file": "core/concepts/serializers.py",
"line": 47,
"claim": "The optional hierarchy URL fields still expose concepts outside the requested release.",
"scenario": "In the existing nested-hierarchy test, v1 contains P, X under P, and B under X. Version v2 reuses X and omits B. Request v2's P/children/ with `includeChildConceptURLs=true`. The inherited `child_concept_urls` field still lists B because it ignores `repo_version`, even though the version-scoped `children` and `child_concepts` fields are empty.",
"action": "Pass the resolved source version to the inherited hierarchy URL fields and extend the reused-row test to request those fields.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.8",
"severity": "P1",
"tag": null,
"file": "core/sources/models.py",
"line": 327,
"claim": "HEAD comparisons and existing HEAD exports can still report dropped codes.",
"scenario": "Export HEAD, then seed a release that only drops codes. The sweep leaves the dropped rows' timestamps intact, so HEAD can still serve the cached export under the same key. A fresh `$compare` against HEAD also includes the dropped rows because the HEAD checksum query selects versioned objects without filtering `is_active`.",
"action": "Exclude dropped identities from HEAD checksum maps and invalidate HEAD export and comparison caches when membership changes. Test a drop-only import against previously generated results.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.9",
"severity": "P1",
"tag": null,
"file": "core/concepts/models.py",
"line": 1326,
"claim": "Dropped mappings remain visible on HEAD concepts and in mapped-code search.",
"scenario": "A seeded release keeps A and drops its mapping to code X. A HEAD concept detail request with `includeMappings=true` still returns that mapping because the relation query ignores `is_active`. The drop task reindexes the mapping alone, and even rebuilding A's search document uses the same unfiltered relation and keeps X as a mapped code.",
"action": "Use active HEAD mappings for the concept response and search document. Refresh the mapped-code documents of concepts affected by the sweep.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.10",
"severity": "P2",
"tag": null,
"file": "core/sources/models.py",
"line": 272,
"claim": "Applying `match_algorithms` to HEAD bypasses HEAD's vector synchronization.",
"scenario": "HEAD is the only semantic version of a source. A seeding import with `index=false` keeps its existing codes and changes `match_algorithms` to `[\"es\"]`. The direct save updates HEAD and creates a lexical release. Neither path queues the sync that a regular HEAD edit would run, so HEAD's concept documents retain vectors after semantic matching has been disabled.",
"action": "Queue the existing HEAD vector sync after commit when the semantic flag changes, and test that the import schedules it for HEAD.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.11",
"severity": "P2",
"tag": null,
"file": "core/importers/models.py",
"line": 736,
"claim": "Inline and parallel concept deletions can change hierarchy before the version transaction.",
"scenario": "An isolated import includes a DELETE for C, which is under P, followed by an invalid Concept line. Retirement uses the ordinary concept-version path, which clears C's HEAD parent relation and can queue hierarchy work. The invalid line blocks the version commit, but C's hierarchy has already changed.",
"action": "Defer hierarchy effects for concept retirement in seeded imports, or reject DELETE actions during preflight if they are unsupported in a standalone release.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F6.12",
"severity": "P2",
"tag": null,
"file": "core/common/tasks.py",
"line": 714,
"claim": "The admin hierarchy repair silently skips explicit child version URLs.",
"scenario": "An admin calls `amend-hierarchy` with an existing parent URL and the URL of a historical child version. The previous task linked the named child row and its latest version. The replacement resolves only versioned-object rows for child URLs, so it completes without adding either link.",
"action": "Preserve exact child-row resolution for the admin repair and test it with a historical child URL.",
"lines_delta": null,
"confidence": "high"
}
]
} |
…ings, refuses delete lines and reads archive lines whole; dropped codes leave HEAD's comparisons and concept mappings; archive summaries round-trip
|
Codex pass 6 is addressed in 820cb32. It's a normal push on top of cf31316.
Lost child after a commit-time rejection, from your notes: this matches what I hit while testing pass 4. A concept with children gets one extra version on its first identical re-import, and its children keep pointing at the old row. It happens on master without seeding, so it isn't changed here, and it needs its own ticket. Checked locally: Still open: C3, C5, C7, C8, C12 and C13; F4.3 is tracked on ocl_online#687. 🤖 Addressed by Claude Code |
Codex check of commits cf31316..820cb32 (codex-cli 0.169.0)Verdict: fix-first. Five P1s and two P2s. All five P1s were reproduced on a test stack, and each one passes at cf31316, so each comes from 820cb32. Pass 6 findings at 820cb32
Findings
Also seen on the stack, not from these commits: a Source Version line with findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "820cb326",
"verdict": "findings",
"prior": [
{
"id": "F6.1",
"status": "resolved"
},
{
"id": "F6.2",
"status": "regressed"
},
{
"id": "F6.3",
"status": "resolved"
},
{
"id": "F6.4",
"status": "resolved"
},
{
"id": "F6.5",
"status": "resolved"
},
{
"id": "F6.6",
"status": "resolved"
},
{
"id": "F6.7",
"status": "resolved"
},
{
"id": "F6.8",
"status": "unresolved"
},
{
"id": "F6.9",
"status": "regressed"
},
{
"id": "F6.10",
"status": "resolved"
},
{
"id": "F6.11",
"status": "resolved"
},
{
"id": "F6.12",
"status": "regressed"
}
],
"findings": [
{
"id": "FC.1",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 475,
"claim": "One id-less mapping line can credit multiple HEAD mappings as retained and bypass confirmation.",
"scenario": "HEAD has 1,500 source-target pairs with two distinct mapping IDs per pair, one retired and both still active. A release keeps every concept and sends one id-less mapping per pair. Preflight credits all 3,000 mappings because both IDs share the same key. MappingImporter selects the non-retired row for each pair, so the sweep drops 1,500 mappings without confirmation. The previous guard would have refused this release.",
"action": "Count the specific mapping identity each line will update using the importer's candidate selection and ordering. Test a release with duplicate candidates and verify that refusal leaves HEAD unchanged.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 466,
"claim": "Preflight rejects releases whose id-less mapping lines identify existing targets by code alone.",
"scenario": "HEAD has 1,500 mappings with stored target source URLs and a unique match for each from-concept, map type and target code. A release keeps all concepts and supplies those same triples using `from_concept_url` and `to_concept_code`, with no target URL. MappingImporter applies no target source predicate and would update all 1,500 identities. Preflight instead requires their stored target URLs to match a key containing `None` and refuses the release as a large drop.",
"action": "Use the same optional target source and encoded-code predicates in preflight and MappingImporter. Add a threshold-crossing test for code-only targets.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.3",
"severity": "P1",
"tag": null,
"file": "core/sources/models.py",
"line": 1028,
"claim": "Sequential ID allocation can reuse a mnemonic that still belongs to a dropped mapping.",
"scenario": "A source with the default sequential mapping IDs imports an explicit mapping ID `1`, leaving its sequence at the initial value. A seeded release drops that mapping. The next ordinary id-less import creates a different mapping, and the maximum-ID query skips the inactive row. The allocator assigns `1` again. Two identities now share the same source and mnemonic, and an explicit import of `1` can select and reactivate the older row.",
"action": "Calculate the maximum allocated mnemonic across all existing identities, including inactive rows, for both mapping and concept sequences. Keep active membership filtering on read paths.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.4",
"severity": "P1",
"tag": null,
"file": "core/sources/models.py",
"line": 1347,
"claim": "A cached HEAD comparison can keep reporting a code as missing after an ordinary import restores it.",
"scenario": "A seeded release drops A. A subsequent `$compare` builds and caches a HEAD concept map without A. An ordinary import resends A unchanged and the duplicate-checksum path reactivates it through `restore_to_head()`. That method saves only `is_active` and reattaches the memberships, so `last_child_update` stays fixed. HEAD reads see A again, but the cached comparison still reports it missing.",
"action": "Advance HEAD's cache revision on restoration even when the resource checksum is unchanged. Test a comparison cached between the drop and the restore.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.5",
"severity": "P1",
"tag": null,
"file": "core/concepts/models.py",
"line": 1326,
"claim": "Dropping a mapping from HEAD now hides it from concept detail and mapped-code search in a release that still contains it.",
"scenario": "Release v1 contains A and M1 mapping A to X. Release v2 keeps A and omits M1. The v1 mappings subresource still lists M1, but `v1/concepts/A/?includeMappings=true` loses it because the detail serializer reads active HEAD mappings. If M1's from-concept FK names the v1 concept row, the new drop task also refreshes that row's search document and removes X from v1 mapped-code search.",
"action": "Use release membership for embedded mappings and version-scoped mapped-code search. Apply the active HEAD filter to HEAD requests and index fields that serve HEAD.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.6",
"severity": "P2",
"tag": null,
"file": "core/concepts/models.py",
"line": 1333,
"claim": "The version-scoped concept mappings endpoint can return a soft-deleted mapping revision.",
"scenario": "An ordinary v1 created through POST `/versions/` contains M1 targeting X. HEAD later changes M1 to target Y, and an admin soft-deletes the historical revision targeting X. The deletion leaves the v1 membership row intact. The new `v1/concepts/A/mappings/` query follows that membership and returns the deleted revision, even though the direct mapping API excludes inactive revisions.",
"action": "Filter historical mapping members by `is_active=True` in the concept mappings endpoint. Test both an admin-deleted revision and an active historical revision whose HEAD identity was dropped.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.7",
"severity": "P2",
"tag": null,
"file": "core/concepts/models.py",
"line": 2096,
"claim": "The admin hierarchy repair can add links using a parent version URL that does not exist.",
"scenario": "An admin submits an existing historical child URL and a parent URL whose version suffix names a deleted or mistyped revision. The previous task required the supplied parent row to exist. The new historical-child path strips the suffix first and links both the historical child and its latest revision to the current parent.",
"action": "Resolve explicit parent version URLs exactly before looking up each parent's latest revision. Test that a missing parent revision adds no links.",
"lines_delta": null,
"confidence": "high"
}
]
} |
…ings as the importer does; dropped ids aren't reused, restores refresh HEAD caches, releases keep their own mappings, and parent version URLs resolve exactly
|
The Codex check of cf31316..820cb32 is addressed in fd31cb8. It's a normal push on top of 820cb32.
Shared rows: when one concept version is in both an older release and HEAD (an unchanged row), its search document serves both. Its mapped codes follow HEAD. Checked locally: Still open: C3, C5, C7, C8, C12 and C13; F4.3 is tracked on ocl_online#687. 🤖 Addressed by Claude Code |
Codex check of commits 820cb32..fd31cb8 (codex-cli 0.169.0)Verdict: fix-first. Three P1s come from fd31cb8 and were reproduced on a test stack: FD.1, FD.2 and FD.4. Each one passes at 820cb32. FD.5 was also reproduced, but most of it predates this commit (see below). The LOINC 2.82 import file can't trigger FD.1 or FD.2: all 250,840 of its Mapping lines name both ends by URL, with no c7 findings at fd31cb8 (reproduced at minimum 1 / 10% with c7's probes)
Findings
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "fd31cb86",
"verdict": "findings",
"prior": [
{
"id": "FC.1",
"status": "resolved"
},
{
"id": "FC.2",
"status": "resolved"
},
{
"id": "FC.3",
"status": "resolved"
},
{
"id": "FC.4",
"status": "resolved"
},
{
"id": "FC.5",
"status": "unresolved"
},
{
"id": "FC.6",
"status": "resolved"
},
{
"id": "FC.7",
"status": "resolved"
},
{
"id": "FC.8",
"status": "resolved"
}
],
"findings": [
{
"id": "FD.1",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 490,
"claim": "Preflight credits existing mappings that the importer's exact from-code lookup cannot match.",
"scenario": "HEAD contains 1,500 mappings with target source URLs. An id-less release resends each mapping with `from_concept_url`, a matching `from_concept_code`, and `to_concept_code` alone. The new matcher credits all 1,500. The importer's exact TextField lookup compares the stored from code to the string form of the whole list of variants, so each line creates a new mapping with no target source URL. The sweep drops all 1,500 existing identities without confirmation. The previous preflight refused the file because the stored target source URLs did not match the omitted URL.",
"action": "Make preflight and the importer use the same from-code predicate. If variants are intended, use `__in` in the importer as well. Test the threshold with both from fields and a code-only target.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 621,
"claim": "The broadened code-only lookup lets create-only imports bypass large-drop confirmation.",
"scenario": "A mapping-only source owns 1,500 mappings whose from-concepts are in another source and whose targets have stored source URLs. An inline or parallel seed with `update_if_exists=false` resends those from URLs and target codes without IDs or target URLs. The new preflight credits the existing mappings. The importer creates distinct mappings with no target source URL, and the sweep drops all 1,500 originals without confirmation. The previous preflight rejected these code-only lines.",
"action": "Pass the runner's update mode into preflight and credit an existing identity only when that mode will update it. Cover the create-only case with a threshold-crossing test.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.3",
"severity": "P2",
"tag": null,
"file": "core/importers/models.py",
"line": 474,
"claim": "Preflight can refuse a release that retains every mapping because it chooses against a fixed snapshot of retirement states.",
"scenario": "Each of 1,500 pairs has an older non-retired mapping and a newer retired mapping, both active. An inline release sends two id-less lines per pair with the same endpoint URLs, both marked retired and with changed extras. The first line retires the older mapping. The second then selects the newer mapping because both candidates are retired. Preflight chooses the older row for both lines and refuses the release as a 1,500-mapping drop. The previous preflight credited both identities in this case.",
"action": "Plan candidate selection in application order when lines can change later matches. Test two lines for one pair where the first line changes which identity the second selects.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.4",
"severity": "P1",
"tag": null,
"file": "core/concepts/serializers.py",
"line": 284,
"claim": "An older release's concept list can lose a mapping even when the concept itself has left HEAD.",
"scenario": "V1 contains A and its mapping M1. A later seed drops both. A's surviving v1 revision still has `is_latest_version=True` because the sweep removes HEAD membership without clearing that flag. The v1 list with `includeMappings=true` now filters out inactive HEAD identity M1. The previous list included it, and v1 detail and the mappings subresource still include its release revision.",
"action": "Pass the resolved source version into the list serializer and preload mappings from that version's membership. Test a release list after dropping both a concept and its mapping.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.5",
"severity": "P1",
"tag": null,
"file": "core/concepts/models.py",
"line": 1326,
"claim": "Reindexing a historical concept can add a mapped code that never belonged to its release.",
"scenario": "V1 contains A without a mapping to X. V2 edits A and adds a mapping from A's versionless URL to X. V3 drops that mapping. A full reindex of v1 now follows A's identity to the inactive mapping and indexes X for the older-only concept revision. A v1 mapped-code filter can return A and the target repo can appear in its facets. Before this commit the active filter excluded the dropped mapping on that reindex.",
"action": "Build mapped-code fields for historical revisions from the relevant release memberships. Test a reindex where the dropped mapping was introduced after the release being searched.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.6",
"severity": "P2",
"tag": null,
"file": "core/concepts/serializers.py",
"line": 319,
"claim": "Embedded brief mapping URLs change from editable resource URLs to revision URLs on ordinary source versions.",
"scenario": "A source that has never used seeding creates v1 through POST `/versions/`. A client reads `v1/concepts/A/?includeMappings=true&mappingBrief=true` and uses an embedded mapping's `url` for a HEAD edit. The earlier URL addressed the mapping identity. The new URL ends in the revision ID and rejects PUT or PATCH. The full form keeps the versionless `url` and now reports the snapshot revision's `uuid`, `version`, and `version_url`. Retirement and direct `mapTypes` and `targetRepoUrls` filters now apply to snapshot rows. Inverse mode still bypasses the map-type and target-repo filters.",
"action": "Preserve the versionless `url` for brief embedded mappings and use `version_url` for the release revision. Cover the response contract on a source that has never used seeding.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.7",
"severity": "P2",
"tag": null,
"file": "core/sources/models.py",
"line": 1041,
"claim": "A dropped numeric mnemonic outside the integer range can still cause sequential ID reuse.",
"scenario": "A source with the default mapping sequence has explicit IDs `1` and `3000000000`, so its sequence still starts at 1. A seed drops only `3000000000`. In the next ordinary id-less import, the widened maximum query casts the dropped mnemonic to a PostgreSQL integer and fails. The allocator swallows that error and assigns 1 again. The previous query excluded the dropped row and advanced past the existing ID 1.",
"action": "Use a range-safe maximum for sequence allocation and handle an out-of-range mnemonic without discarding the maximum of valid IDs. Test allocation with a dropped oversized numeric mnemonic.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.8",
"severity": "P2",
"tag": null,
"file": "core/concepts/views.py",
"line": 377,
"claim": "Concept detail on `/latest/` can embed each mapping twice when that alias resolves to HEAD.",
"scenario": "A source is created with `released=true` and has no numbered release. `/latest/concepts/A/?includeMappings=true` resolves to HEAD. The new serializer context treats HEAD as a release and reads its mapping membership, which contains both the identity and the latest revision for M1. The response embeds M1 twice. The previous detail path returned only the identity.",
"action": "Use the HEAD serialization path whenever the resolved source is HEAD, including when the URL uses `latest`. Add a detail test for a released HEAD.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FD.shared",
"severity": "P3",
"tag": null,
"file": "core/sources/models.py",
"line": 315,
"claim": "The older release's detail and mappings subresource show its snapshot. The concept list and mapped-code search follow HEAD for the unchanged concept row.",
"scenario": "V1 contains A and M1 from A to X. A later seeded version keeps the same concept revision and drops M1. On a fresh v1 read, `concepts/A/?includeMappings=true` and `concepts/A/mappings/` still show v1's M1. The v1 concept list with `includeMappings=true` omits M1. After indexing, v1 search loses M1's mapped-code boost for X, A no longer matches X through the applicable `same_as_map_codes` or `other_map_codes` filter on account of M1, and M1 no longer contributes to the `targetRepo` facet count.",
"action": "Record the behavior for the release decision.",
"lines_delta": null,
"confidence": "high"
}
]
} |
…tches from codes as the importer does; release concept lists and older concept versions use the release's own mappings; latest-as-HEAD reads HEAD
|
The Codex check of 820cb32..fd31cb8 is addressed in f027af0. It's a normal push on top of fd31cb8.
Checked locally:
Still open: C3, C5, C7, C8, C12 and C13; F4.3 is tracked on ocl_online#687. 🤖 Addressed by Claude Code |
Final review (codex-cli 0.169.0, commits fd31cb8..9c75a44)Verdict: Ready to merge once 2 items are fixed. f027af0 fixes the FD scenarios as reported. Two small items remain. FE.2 changes how ordinary imports match mappings. The other is a product decision made today: a version line's Checked on a test stack at 9c75a44 (large-drop guard at minimum 1 / 10%):
Codex marks FD.1 and FD.3 to FD.7 "regressed". In each case the original scenario is fixed, and the fix opened the side case listed below as FE.n. Fix before merge
Ship and ticket (none of these loses or corrupts content on the LOINC 2.82 load or changes ordinary imports; † = matters only while the large-drop guard exists)
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "f027af05",
"verdict": "findings",
"prior": [
{
"id": "FD.1",
"status": "regressed"
},
{
"id": "FD.2",
"status": "resolved"
},
{
"id": "FD.3",
"status": "regressed"
},
{
"id": "FD.4",
"status": "regressed"
},
{
"id": "FD.5",
"status": "regressed"
},
{
"id": "FD.6",
"status": "regressed"
},
{
"id": "FD.7",
"status": "regressed"
},
{
"id": "FD.8",
"status": "resolved"
},
{
"id": "FD.shared",
"status": "unresolved"
},
{
"id": "C3",
"status": "unresolved"
},
{
"id": "C5",
"status": "unresolved"
},
{
"id": "C7",
"status": "unresolved"
},
{
"id": "C8",
"status": "unresolved"
},
{
"id": "C12",
"status": "unresolved"
},
{
"id": "C13",
"status": "unresolved"
},
{
"id": "F4.1",
"status": "resolved"
},
{
"id": "F4.3",
"status": "unresolved"
},
{
"id": "F4.7",
"status": "resolved"
}
],
"findings": [
{
"id": "FE.1",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 474,
"claim": "The guard can approve a large drop by crediting mappings the import never updates.",
"scenario": "Repeat this pattern for 1,500 pairs in a source small enough to cross the percentage threshold. Each pair has an older live mapping A and a newer retired mapping B. In an inline seed, the first ID-less line retires A, the next line creates an explicitly named mapping C for the same pair, and the last ID-less line selects C. Preflight ignores the new C and credits B. In a parallel seed, a worker can apply a second line with omitted `retired` before the first line retires A. Both lines then select A, while file-order preflight credits A and B. Both imports can drop all 1,500 B identities without confirmation. The previous preflight would have refused.",
"action": "Use the same mapping choices for admission and execution, including identities created during the import and ordering across chunks. Enforce the threshold against the identities actually retained before committing any changes to HEAD.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.2",
"severity": "P1",
"tag": null,
"file": "core/importers/models.py",
"line": 917,
"claim": "An ordinary import can overwrite or retire a mapping from a different source when its `from_concept_url` does not resolve.",
"scenario": "A mapping repository holds a mapping from `S1/X` to `T/Y`. An ID-less line supplies `S2/X` as its from URL, `X` as its from code, and the same target and map type. S2 exists but X has not been loaded there. The new predicate matches the S1 mapping by code and rewires it to S2. An inline or parallel delete line can retire the S1 mapping instead. Previously the exact lookup missed, so the update path created a separate S2 mapping and the delete found no match. Ordinary inline, parallel, and OCL archive updates share the new lookup. Explicit IDs and create-only writes still use their existing paths.",
"action": "Constrain unresolved from URLs by both source and code. When the URL resolves, use that concept identity and reject conflicting codes. Cover ordinary imports with colliding codes and encoded variants.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.3",
"severity": "P2",
"tag": null,
"file": "core/importers/importer.py",
"line": 556,
"claim": "ZIP and TAR preflight can refuse a release that keeps every mapping because it strips `retired` before simulating updates.",
"scenario": "HEAD has 1,500 pairs of retired mapping identities. For each pair, the archive resends the older mapping by ID with `retired: true`, then sends an ID-less line for the same endpoints. The actual importer leaves the older mapping retired and chooses the newer one for the second line. Preflight makes the older one appear live, credits it twice, and reports 1,500 drops. Before the fix, the fixed retirement snapshot credited both. Inline preflight can make the same mistake with `retired: \"1\"`, which the model saves as true.",
"action": "Keep `retired` in the archive preflight projection and share boolean normalization with the importer. Test the archive preflight and execution together.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.4",
"severity": "P2",
"tag": null,
"file": "core/importers/tests.py",
"line": 7001,
"claim": "The new file-order test passes with one mapping per pair, so it misses the behavior it claims to test.",
"scenario": "The setup imports the live mapping first, then tries to create its retired duplicate. `MappingValidationMixin.clean()` rejects the second row because a live mapping with the same endpoints and map type already exists. The test ignores the first import's failures. The second import can send both lines to the sole surviving identity and still report zero drops.",
"action": "Create both mappings while retired, reactivate the older one, and assert that both identities are present before the test import and retained afterward.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.5",
"severity": "P1",
"tag": null,
"file": "core/concepts/models.py",
"line": 1345,
"claim": "Reindexing a concept revision shared by two releases adds the later release's mapped codes to the earlier release.",
"scenario": "V1 publishes A without mappings. V2 reuses A's revision and adds M from A to X. V3 edits A and moves M to start at B. Before the fix, a fresh index of the old A revision found no current mapping from A after the move. Now the index takes M from V2's membership, so a V1 mapped-code search can return A for X and count X's repository in its `targetRepo` facet. V1's mapping membership is still empty for A.",
"action": "Make mapped-code matching and faceting use the requested release's mapping membership. Test two releases that share a concept revision and have different mappings.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.6",
"severity": "P2",
"tag": null,
"file": "core/concepts/models.py",
"line": 1345,
"claim": "Reindexing removes mapped codes from older concept revisions held only by a collection.",
"scenario": "A collection expansion pins an old revision of A and a mapping from A to X. The source has no numbered release containing that revision. Before the fix, the concept document picked up the mapping through A's identity. Now the historical lookup only checks the revision's source memberships, which are empty. The collection still lists the mapping, but its mapped-code search no longer finds A for X after a full reindex.",
"action": "Preserve mapped-code matching for collection-held revisions and use the expansion's mapping membership for collection-scoped searches.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.7",
"severity": "P2",
"tag": null,
"file": "core/mappings/serializers.py",
"line": 207,
"claim": "Brief embedded mappings on source-version URLs now include `extras` by default.",
"scenario": "A client requests a release's concept detail or list with `includeMappings=true&mappingBrief=true`. A mapping with a populated `extras` field now returns it even though `includeExtras` was omitted. The new subclass misses the class-name check that strips extras from the previous brief response.",
"action": "Apply the same extras rule to both brief serializers and assert the full brief response shape alongside the corrected URL.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.8",
"severity": "P2",
"tag": null,
"file": "core/sources/models.py",
"line": 1039,
"claim": "The 18-digit cutoff can make the sequential allocator issue an existing 19-digit mapping ID.",
"scenario": "A source with its sequence still at 1 imports explicit IDs `999999999999999999` and `1000000000000000000`. The new maximum lookup sees only the first ID. The next ID-less create advances the sequence and assigns `1000000000000000000` again. Mapping creation checks the temporary mnemonic before allocation, and the database uniqueness rule includes the revision, so both identities can persist. The previous overflowing cast left the sequence at its initial allocation and did not collide in this case.",
"action": "Include 19-digit values that fit PostgreSQL bigint and check the allocated mnemonic for collisions. Test allocation itself with adjacent IDs across the digit boundary.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FE.9",
"severity": "P2",
"tag": null,
"file": "core/concepts/views.py",
"line": 209,
"claim": "A version's concept list now reports hierarchy fields and hierarchy flags from different scopes.",
"scenario": "A source release has root A, whose only child is a visible concept in another source. Request the release's concept list with `onlyHierarchyRoot=true&includeChildConceptURLs=true`. The new version context returns an empty child URL list, while `has_children` still reads the unscoped links and returns true. Clients show an expandable root, but the release's `children/` endpoint returns no children. Before the fix, the flag and the embedded URL list both described the unscoped links.",
"action": "Use the resolved release membership for the concept list's hierarchy flags and filters as well as its embedded hierarchy fields.",
"lines_delta": null,
"confidence": "high"
}
]
}Review by Claude Code (launch worker review-985-final), with Codex. |
|
@snyaggarwal Jon would like this merged Fri Nov 20 so the LOINC 2.82 staging load can run. The two items in the final review above (FE.2, and To save you time, we're building both fixes tonight as a PR into this branch, with tests and a Codex check, and we'll link it here when it's ready. Merge it if it looks right to you. If you'd rather push your own fixes, do; we'll post the Codex check of your commits here within the hour. |
|
@snyaggarwal Both "Fix before merge" items are in #1014, a PR into this branch. Merge it if it looks right to you.
Tests: new tests run inline and through a parallel part. Review: two Codex passes, a simplification review and a final check; no P0 or P1 is open. One answer to pass 2 was reverted after the final check. The accepted P2s (F1.3, F2.1 to F2.3) are listed on #1014. Posted by Claude Code for Jonathan. |
* OpenConceptLab/ocl_online#655 | A mapping line whose from URL doesn't resolve matches a mapping by code only within that URL's source, so an import never updates or retires another source's mapping (FE.2) MappingImporter.get_queryset and the seeding preflight's MappingMatcher now also require the mapping's from_source_url to be the line's from source when the from concept URL doesn't resolve, with or without from_concept_code. The same source's mapping still matches, so re-importing an id-less line that names its from code updates it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav * OpenConceptLab/ocl_online#655 | A seeding import's Source Version line sets match_algorithms on the new version only; HEAD keeps its own and its vectors aren't resynced apply_version_metadata_to_head skips match_algorithms, which stays in ISOLATED_METADATA_FIELDS so the line still sets and checks it on the version, as POST .../versions/ leaves HEAD's alone. Nothing else it copies can change HEAD's semantic flag, so the HEAD vector sync that went with it is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav * OpenConceptLab/ocl_online#655 | An unresolved from URL's source is matched as mappings are saved: by link to the source it resolves to, else by the stored URL (FE.2 review, pass 1) A mapping saved from a canonical from URL is linked to the source the URL resolves to and stores that source's own URL, so a text match on the line's URL missed it: a re-import failed uniqueness and a DELETE found nothing. A linked mapping now matches when it's linked to the source the line's URL resolves to, and an unlinked one when its stored from source URL is the line's, in MappingImporter and MappingMatcher alike. That also stops a stale stored URL from matching a mapping linked to another source. Each update variant in the cross-source test now starts from S1's mapping alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav * OpenConceptLab/ocl_online#655 | The from source lookup moves into its criteria helper, inside pylint's local-variable limit for MappingImporter.get_queryset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav * OpenConceptLab/ocl_online#655 | An unresolved from URL's source is compared by identity when both sides have one, else by the URLs a mapping stores for it (FE.2 review, pass 2) The line's from source URL is resolved versionless, so an explicit HEAD path names its source. A mapping's source is its from source link, else its from concept's source; when the line's URL resolves to a source and the mapping has one, the two must be the same. Otherwise the mapping's stored from source URL must be one the URL is stored as, which includes the resolution URL a version-qualified canonical URL is stored under. A mapping linked to a source since retired is found again by its URL, as before this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav * OpenConceptLab/ocl_online#655 | Revert the pass 2 change to from source matching: its versionless lookup misreads some canonical URLs and its URL fallback matches mappings linked elsewhere This reverts commit 42aa7a4, which answered pass 2's three P2 findings. The final Codex check found it broke more than it fixed: stripping a version segment can resolve a canonical URL to another source, and the fallback for a URL that resolves to no source matched mappings linked to another source. The tree returns to 1fdb827, which pass 2 found free of P0 and P1 defects; F2.1 to F2.3 are accepted as P2 edge cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWhAoApU55xQW8puav --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…mapped codes From the final review of #985 (FE.5, FE.6 and the rest of FD.4). MappedCodes now decides all of a document's mapped-code fields, and replaces Concept.get_indexed_mappings: - a row HEAD holds, or that no source version holds (a version only a collection holds), takes HEAD's mappings, as it did before #985. Such a row lost its mapped codes on reindex (FE.6). - any other row takes the codes of the latest release that holds it, not the union of every release's (FE.5). A concept dropped from HEAD keeps its latest row, which no longer follows HEAD (FD.4). - each other release whose codes differ gets its release_map_codes entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9
…pped codes (#1010) * OpenConceptLab/ocl_online#703 | A release's search matches its own mapped codes A concept unchanged since a release keeps one row, shared by HEAD and the release, and so one search document, whose mapped codes are HEAD's. Searching the release by a mapped code found HEAD's codes: those HEAD added, and not those it dropped. - The concept document gets release_map_codes: one entry per release whose own active mappings (as Concept.get_version_mappings reads them) give other codes than the document's. Documents without a difference carry none, so HEAD and a latest release equal to HEAD index as before. - ReleaseMapCodes loads the releases' codes for a chunk of rows in two queries; full indexing and the partial mapped-codes updates both use it. - A search in a release (a version or latest) rewrites each clause on a mapped-code field to read the release's entry where the document has one, else its own fields: the search box, the target repo filter, and $match against a release URL. Documents without an entry match and score as before. HEAD's queries are unchanged. - The targetRepo and targetRepoMapType facets in a release count the release's own codes. - concept_release_map_codes adds the field's mapping to an existing concepts index (no reindex), and with --source fills it on the documents of that source's releases that need an entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | One rule for a search document's own mapped codes From the final review of #985 (FE.5, FE.6 and the rest of FD.4). MappedCodes now decides all of a document's mapped-code fields, and replaces Concept.get_indexed_mappings: - a row HEAD holds, or that no source version holds (a version only a collection holds), takes HEAD's mappings, as it did before #985. Such a row lost its mapped codes on reindex (FE.6). - any other row takes the codes of the latest release that holds it, not the union of every release's (FE.5). A concept dropped from HEAD keeps its latest row, which no longer follows HEAD (FD.4). - each other release whose codes differ gets its release_map_codes entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex pass 1: backfill every release doc, scope $match filters, group entries - F1.1: the backfill rewrites the mapped codes of every row the source's releases hold. Documents indexed before this carry HEAD's codes, and a row HEAD doesn't hold now takes its latest release's, with or without entries. - F1.2: --source with --index is refused; the updates go to the concepts index. - F1.3: $match in a release scopes its filters, so the kNN filters and a filter-only row read the release's codes too, not only the lexical clauses. - F1.4: a fuzzy concept search in one source_version reads that version's codes. - F1.5: the release facets keep FACET_SIZE buckets after merging. - F1.6: releases with the same codes share one entry, whose version lists them, so a long release history doesn't repeat the same codes per release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex pass 2: latest rows keep HEAD's codes, $match highlights entries, new releases drop stale entries - F2.2: the versioned object and the latest version keep HEAD's codes as their own, since global search reads the latest version. A concept dropped from HEAD keeps its latest row's codes in entries, so its releases still find it. - F2.3: $match in a release puts each lexical mapped-code clause's entry match in named inner hits, highlighted; CustomESSearch.get_highlight adds them to the hit's highlight under the field's own name, so bestMatch keeps the hit. - F2.4: appending a new release's name to its members' docs also takes that name out of their entries. A release has HEAD's codes when made, so an entry naming it was left by a deleted release of the same name. - F2.1, F2.5: a fuzzy search's source_version no longer selects the release whose codes it reads (back to F1.4 as accepted). - F2.6: the kNN filter test checks the filter names v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex pass 3: entries keyed by release id, viewable releases only, union kept for collection search - F3.3 (and F2.4 at its root): entries name their releases by source version id, not name. A release made again under a deleted one's name has a new id, so no entry is stale, and the append script is back as it was: running a release's indexing again no longer drops its entries. - F3.1: a search in a release (a version or latest) reads the release's codes only if the user can view it; otherwise each document's own, as before. - F3.2: a fuzzy search no longer rewrites its mapped-code filters: it isn't scoped to the URL's source version. - F3.4: a row only releases hold keeps the codes of every release that holds it as its own, as the base branch does, for collection searches; each release whose codes differ reads its own entry. - $match resolves its release's id from the repo params, if exactly one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Simplification review: smaller MappedCodes and command, one test fewer - S1: a row's own code key is computed once, not once per release. - S2: MappedCodes doesn't guard an empty id list; the queries return nothing. - S4: the command reads the expected mapping inline. - S5: test_partial_updates_carry_the_entries goes; the command test covers partial updates that carry entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex check: private releases' codes only in entries, fuzzy search in one viewable version - FC.1: a row only releases hold takes its own fields from the public releases that hold it. A private release's codes are only in its entry, which a search reads only for a user who can view that release. - FC.2: a fuzzy concept search that selects one source version with source_version, which the user can view, reads that version's codes by its id. The id names that version alone, so a URL naming another source's version of the same name changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex check: a release's access change rebuilds its rows' codes; fuzzy search back to each doc's own codes - FC.5: when a release's public_access changes, the rows only releases hold (whose own fields take the public releases' codes) get their mapped codes rebuilt on the indexing queue, 5,000 ids a task. - FC.4, FC.6: the fuzzy search rewrite for one source_version (FC.2) is removed. Fuzzy search reads each document's own codes, as it did before this PR (F1.4, accepted). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | Codex check: queue a release's code rebuild on commit; fuzzy test selects v1 too - FC.7: the mapped-code rebuild after a release's access change is queued once the change commits, so the tasks read the new access. - FC.10: the fuzzy search test also selects v1 with source_version and still gets only B. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVSZwPgUucRdN8D9U9 * OpenConceptLab/ocl_online#703 | A row no release holds reads only HEAD's active mappings get_unidirectional_mappings filters is_active only for the versioned object and the latest version, so an older row that only a collection holds took the mappings HEAD had dropped too. Its own fields now take HEAD's active mappings, as HEAD's rows do. The test keeps one mapping and drops another. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | $match reads a SAME-AS input from same_as_map_codes, so a release reads its own $match built its SAME-AS clause on same_as_mapped_codes, which no document has, so the clause matched nothing and the release rewrite skipped it. The clause now reads same_as_map_codes, the indexed field, which the Mapper already sends; same_as_mapped_codes is still read as the same input. In a release, the clause reads that release's codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | Codex pass 4: a new release's concepts and mappings are written together A release is seeded in two writes, its concepts, then its mappings. A concept's search doc rebuilt between them saw the release hold the concept with no mappings, so it got an entry with no codes for that release, and the release's indexing, an append, kept it: a search in the release missed that concept's codes until another rebuild. The two writes are now one transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | The backfill rewrites a source's older rows too, so a collection-only row gets HEAD's active codes --source rewrote only the rows the source's releases hold. An older row no release holds, such as a version only a collection holds, was indexed with no mapped codes before, and now takes HEAD's active ones, so the backfill rewrites every older row of the source as well. The test indexes such a row as before and checks it gains the code HEAD kept, not those HEAD dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | Codex pass 5: an import that changes HEAD's mappings refreshes the older rows no release holds An older row no release holds, such as a version only a collection holds, reads HEAD's codes. A mapping edit through the API reindexes every row of the concept, but an import refreshed only the versioned object and the latest row, both for the mappings it imports and for those a seeding import drops. So the older row kept codes HEAD no longer has. Both paths now refresh those rows too (Concept.get_unreleased_older_ids). Rows a release holds keep their release's codes, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | Backfill test follows a seed that drops M7 through to the collection-only row's doc After the backfill gives the collection-only row X07, the next seed keeps A and drops M7. The test now runs that seed's mapped-code refreshes and checks the doc loses X07 with no second backfill. The import test keeps the HEAD-only import path, and one fixture helper builds an edited A. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | Codex pass 6: a fuzzy search's facets read each doc's own codes, as its hits do A fuzzy search in a release matches each doc's own codes, but its facets came from the release's codes, so they could offer a map type no hit has. A fuzzy request now isn't scoped to the release at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn * OpenConceptLab/ocl_online#703 | --source help names the older concept rows it also rewrites Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUwCLvLBDodjZbS2Yn --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
OpenConceptLab/ocl_online#655, OpenConceptLab/ocl_online#672
What this does
This adds source versions seeded from an import, for publishers like LOINC who release each version as a complete, standalone artifact. Today every new version carries HEAD forward. A version seeded from an import instead makes HEAD exactly what the release contains, and then snapshots that HEAD.
You start one with
seed_from_import=trueonPOST /importers/bulk-import/or/importers/bulk-import-parallel-inline/. The import must contain the content, then exactly one Source Version line. It works with the JSON-lines and zip importers; npm imports are refused.IsolatedVersionCommitdoes the last step for the inline, parallel and zip/tar runners. It replaces HEAD's hierarchy, drops what the import didn't contain and creates the version in one transaction. If the commit is rejected (a validation error, or the hierarchy root would be dropped), the hierarchy and HEAD membership stay as they were. After the commit, retried tasks on theindexingqueue (index_dropped_source_children, one per 5,000 ids) reindex the dropped codes and recount HEAD. Each Task saves its arguments, so it can be rerun, and shows a final failure. A parallel part that failed or has no result blocks the version.seed_from_import=truemakes the import seed the version; the Source Version line has no mode key. The zip importer reads the Source Version lines (only those) while it counts resources, so the line is checked before anything imports.parent_concept_urlsand replace the old links, not add to them. A parent change forces a new concept version.ImportHierarchyresolves the links once into ids, then adds the latest-version links and replaces HEAD's links 5,000 children at a time. The parallel runner and themake_hierarchytask use it too.extras,external_id,datatype,sort_weightand the retire fields from the import, not from its previous version.seeded_from. A version made from HEAD records{"type": "repo_version", "url": ".../HEAD/"}, and one seeded from an import records{"type": "import", "task": "<import task id>"}. HEAD records the version an import last re-seeded it from, and is otherwisenull. Migration0047added aversioning_modecolumn;0048replaces it withseeded_fromand backfills it: existing versions as seeded from HEAD, or from an import where 0047 recorded one.children/andparents/show the requested version's own members.Changelog compare on large diffs
A 2.81 → 2.82 compare ran out of memory, and once it fit in memory, its result (1.4 GB) was over Postgres's 1 GB
jsonblimit.CHANGELOG_ENRICHMENT_MAX_RESOURCES(default 50,000 new, removed or changed resources), a changelog skips names, descriptions andprev_*, and setsmeta.enrichment_skipped.Also fixed
Decimal(ijson), so any concept with a number inextrasfailed to save.Behaviour changes to be aware of
GETon HEAD returns 404 for it while older versions still have it.Testing
core/importers/tests.pyandcore/integration_tests/tests_sources.py:pylint -j0 core/exits 0.core.importers core.sources core.integration_tests.tests_sources core.common core.concepts core.mappingsran 1,224 tests.BulkImportLimitsTest.test_grandfathered_npm_url_is_downloaded_and_handed_over_as_uploadfails, as it does on master. A few tests that share the local ES fail only in parallel runs and pass on their own.Not in this PR
seeded_fromcan't be set in a request.match_algorithms.idare slow: each runs aMAX(mnemonic)scan, 2–6 s each.The frontend part, showing the versioning mode in version details, is in OpenConceptLab/oclweb3 on the branch of the same name.
🤖 Generated with Claude Code