Skip to content

OpenConceptLab/ocl_online#452 | $cascade walks a level at a time and a cut walk keeps the nearest entries; reference filters with FHIR's operators matched in the database, behind the switch - #1088

Open
paynejd wants to merge 66 commits into
masterfrom
fhir-452-b-filters

Conversation

@paynejd

@paynejd paynejd commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Part of OpenConceptLab/ocl_online#452. Not part of the Dec 1 run.

Includes a fix for its interaction with #1087.

Stacked on #1086 (base fhir-452-b-eval), with #1085 (the $cascade fix, branch fhir-452-cascade) and #1089 (search options, branch fhir-452-ref-modifiers) merged in, so until they merge this diff shows their commits too. Merge order: #1085, #1086, #1089, then this. This PR's own commits are $cascade walks a level at a time... and those after it.

Behaviour changes for API users

A truncated $cascade keeps the nearest entries (decided Nov 30: a fix, for API users too, not behind the switch). A strict walk that reaches max_results ($cascade with max_results, $clone over its budget) now keeps every level before the cut, then the cut level's entries by id, mappings first. Before, it kept the lowest row ids across the whole walk, so a nearer entry could be dropped for a deeper one. The number of entries and the truncated flag are as before, and an untruncated answer is unchanged.

Example (checked on both): A has children B and C, and B has children D and E, created before B and C, so with lower ids. $cascade from A with max_results=4:

  • before: A, B, D, E. Walking B's children took the walk over the limit, and the lowest ids were kept, so A's own child C was dropped for two grandchildren;
  • now: A, B, C, D. A and its children, then the grandchild with the lower id.

Nothing else changes with the switch off.

What changes

1. $cascade walks a level at a time (its own commit; for truncated walks, see Behaviour changes)

  • One step for a whole level. Concept.get_level_cascaded_resources and Concept.get_level_hierarchy_queryset answer with what each concept's own step answers, together, in one query per kind (mappings, mapped concepts, hierarchy). The per-concept step (get_cascaded_resources, get_hierarchy_queryset) is that step for a level of one, so the hierarchy has one definition.
  • No recursion. cascade() and cascade_as_hierarchy() are loops. A chain deeper than about 900 levels was a 500.
  • Untruncated answers are unchanged. Tested against a walk concept by concept (a cycle, two parents, mappings, retired concepts; a source's HEAD and a collection; both directions; levels 1, 2 and all), and by the existing $cascade, $clone, reference and collection tests.
  • What changes for every caller of a truncated walk ($cascade with max_results, $clone over its budget):
    • A strict walk that reaches max_results keeps every level before the cut, then the cut level's mappings and concepts by id (mappings first). Before, it kept the lowest row ids across the whole walk, so a nearer concept could be dropped for a deeper one.
    • It reads no more of a wide level than fits, plus one to tell it was cut. Before, it read every id of the level first.
    • Whether a walk is truncated, and how many entries it returns, are as before. $clone still refuses a walk its budget stopped.

2. Reference filters matched in the database, behind the switch

With the switch off (API users today), nothing changes: filters go through the search index, only = and in apply, and expressions and parsing are as before. Search options (excludeWildcard and the like) are read by #1089's code, which with REFERENCE_SEARCH_OPTIONS_TOGGLE off (everywhere) is master's: they select nothing, as today. Outside a FHIR evaluation the switch's toggle is read once a build or a parse, not once a reference. A test per new operator checks it's refused as before.

Under the switch (ExpansionEvaluation.fhir_rules: FHIR's evaluations turn it on; EXPANSION_FHIR_RULES_TOGGLE turns it on for API users once the expansion-rules decisions are made), a concept reference's filter entries are matched in the database (core/collections/filters.py):

Property = / in not-in exists regex hierarchy
concept, code the code as FHIR spells it (decoded: ND53.Y&XK70 for a stored ND53.Y%26XK70), as every op on codes reads it yes yes is-a, descendent-of, child-of, is-not-a, generalizes, descendent-leaf (the root found by its FHIR spelling)
display (as display_name picks it) yes yes yes yes
concept_class, datatype, id_lowercase ignoring case, as the index yes yes yes
retired, is_latest_version, locale, name_types, description_types, updated_by exactly, as the index yes yes yes
extras.<key>, and a property the source declares (Source.properties) exactly yes yes yes
q, and the index's fields about a concept's repository, memberships and mappings on the search index, as before
  • One definition of a value (value_texts): an object with a value by that value (as Concept.properties reads a property), a list's items, a string as it is, a boolean as true/false, a number as JSON writes it, a Coding by its code. =, in and not-in are settled in the database by a containment search, and exists by the value's JSON type; only a Coding (which has no text if it also has a value), or for exists a list or an object, is read and checked, and only those that fail are listed to leave out. regex reads the values a page at a time. not-in and exists false keep a concept without the property. regex matches the whole value on RE2 (linear time, google-re2 added); a pattern RE2 can't compile is refused.

  • Declared properties are read as Concept.properties reads them: the extras value, else, for a class or datatype property, the concept's own (compared as the index does). They apply only in a version whose source declares them, and only one the reference's creator can view. A declared name wins over an OCL field or search parameter of the same name, except q.

  • extras changes meaning under the switch: exact, where the index matched words (extras.CLASS=chronic found "Chronic Care").

  • Hierarchy filters are walked with $cascade: hierarchy only, through retired concepts, matched by concept, complete or too costly. At request time, a walk past REFERENCE_HIERARCHY_FILTER_LIMIT (100,000 concepts, a fixed server setting) raises EvaluationTooCostly. A build, a rebuild or an add walks the whole hierarchy. An unknown code selects nothing (is-not-a: everything).

  • Codes ignore case when the source says it isn't case-sensitive (a version that says nothing, as its HEAD says), when there's no exact match: in filters, code references, an expansion's batched code references, and the lookup of the versions holding a concept version (the concept version itself stays exact).

  • Refusals: what can't be applied is refused when added, with its reason (get_filter_errors), and selects nothing (filter_not_applied), as now.

  • Expressions record their operator: an op other than = and in, or a second clause on one property, is written as property:op=value (eq for =), with property names escaped, and read back by the parser one clause each. So p=v and p not-in v are two references; before, both were written p=v, so adding both kept one. A supplied expression whose query string doesn't read as its structured filter takes the filter's.

  • Search options follow REFERENCE_SEARCH_OPTIONS_TOGGLE under the switch too, read by the same code as without it, so FHIR and the API stay one model: off, an option is matched as a field the index doesn't have and selects nothing, as on master; on, options are set aside and apply to q. The one difference left: a filter whose entries are all set aside selects every concept of the version from the database under the switch, where the index path selects the indexed ones.

  • What a filter can't apply is reported per version evaluated, as the filter reads each version's declared properties alone.

Tests

  • Search-index parity (ES-tagged): every keyword field, with case variants (DIAGNOSIS, True, FR) and combined with q, selects the same concepts with the switch on and off.
  • dry_run_rebuild, off against on, on a collection filtered as production's filtered collections are (retired, locale, map_source, extras.CLASS): only the extras word match changes. Off against what's stored: no change.
  • dry_run_rebuild on local filtered collections (a copy of a test database with real content and 10 production collections' references, rolled back): of its 6 collections with filtered references, one changes with the switch on: a demo collection whose filter is only search modifiers gains its 4 concepts (and 3 mappings by its cascade), where the switch-off path selects nothing (the July 2025 behaviour above). A LOINC vitals panel's extras.CLASS=PANEL.VITALS, evaluated in LOINC 2.81 with the switch on, selects the same 6 concepts its stored expansion got through the index. The other four (a CIEL concept_class filter and pasted searches with no system) resolve nothing in that copy, with the switch off or on.
  • A test per operator, with the switch on and off; with it off, every new operator is refused exactly as before.
  • LOINC 2.81's shape: a release whose child row links to an older row of its parent; is-a, generalizes, child-of and descendent-leaf reach the release's rows.

Cost on production (EXPLAIN only, no ANALYZE; LOINC 2.81 holds about 290,000 concepts)

Query Cost
extras.CLASS = CHEM, or concept_class in (...), in LOINC 2.81 about 589,000: one read of each of the release's rows. The index path reads the same rows' ids and sends one search per 500
display = Glucose in LOINC 2.81 (only concepts with that name get a display worked out) about 14,000
a regex page of 5,000 codes about 7,000
a display regex page of 5,000 about 1.5 million: a display is worked out per concept, so a display regex over a LOINC-sized release is too costly at request time
a hierarchy level of 3 concepts, down about 5,800
a hierarchy level of 2,000 concepts, down / up about 237,000 / 214,000 in one query, where the per-concept step cost 2,000 to 6,000 per concept (4 to 12 million for the level)

A regex's matches are an id list, uncapped at build time, as an index filter's matches always are (_apply_filters sends every match as one IN list): RE2 runs in Python, reading the codes a page of 5,000 at a time, so memory stays flat but the matches are sent back as ids. At request time the evaluation's deadline bounds it; a build, a rebuild or dry_run_rebuild has no cap, by decision, since a cap would fail builds that work today through the index. Extras and hierarchy matches, and the database path's last step, stay in the database as subqueries or conditions. Each filter adds its own conditions to the query, not a copy of the filters before it.

Proposal for Sunny: a GIN index on concepts.extras (jsonb_path_ops). Production has none. An extras filter is written as containment (extras @> {"key": value}), so such an index could serve it. Today, on LOINC 2.81, the filter reads all ~290,000 rows of the release. Not added here: your call. With it, a selective value would read only the rows that hold it.

Review

Three Codex defect passes (9, 9 and 8 findings), a simplification review (8 of 9 cuts applied), and two Codex checks of the later commits (6 and 3 findings). Every P0 and P1 is fixed. One P1 from the last check is master's behaviour (a filter with a bad schema saved by a collection that doesn't auto-expand); here that filter now selects nothing. Two P2s are accepted: descendent-leaf at a source's HEAD follows master's HEAD hierarchy, where a child is found through any row and a parent through the latest; and a source declaring a property named like a search modifier and using it beside q, which no production source does.

Full test gate on 030fcfbe: pylint 10.00; 4,187 tests (2 skipped) and the 807 search-index tests OK; coverage 97%.

Follow-up: a regex filter on concept or code matches a code as FHIR spells it, so a code OCL stores percent-encoded (ICD-11's ND53.Y%26XK70) is decoded first, as FHIR's operations decode it (5d209ec; Codex check clean).

Follow-up: #1086's review answers and #1085's new head merged in (3e7c75a, 1a22813). Adapted here to #1086's interface: CodeReferenceBatch takes references and searches each version for its own repository's codes, exactly and then ignoring case; the hierarchy walk's version and a source's declared filter properties are read for the reference's viewer (can_view: its creator, or at request time the caller); and a reference given another evaluation reads its declared properties again (916270c, with a test). The $cascade child step keeps #1085's join and NOT EXISTS in this branch's walk a level at a time. Codex checks: one P2 fixed; one P1 answered (master's saved-results fallback for pinned references, unchanged here and answered on #1086).

Sunny's review (Nov 30), answered:

Four Codex checks of these commits: the first found one P1 (each extras filter copied the queryset before it into a subquery, doubling the query per filter) and four P2s, fixed in 2eaadce with the display filter, which did the same; two later P2s on extras stored as a list are fixed (439ffd9, 255ef3a). Accepted: escapes that mix upper and lower case within one stored code, and case-insensitive matching of encoded codes that mix the case of letters outside ASCII (both would need decoding inside the database; OCL's encoders write neither); and a concept edited between the check of a Coding and the query that uses it (a build isn't isolated from concurrent edits; the next build settles it). The last check is clean. Full test gate on 255ef3ae: pylint 10.00; 4,226 tests (2 skipped) and 821 search-index tests OK; coverage 97%.

Merged master after #1085 and #1086, then #1089's new head (3c44dff0, 6bccd158), then master after #1089, #1109 and #1106 (dda7f29b); no change to the reviewed code. #1109 turned REFERENCE_SEARCH_OPTIONS_TOGGLE on in every environment: where this description says it's off, search options now apply to q, as on master.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt

paynejd and others added 28 commits November 29, 2026 09:03
…lection follows a link to any row of a concept

- In a source version, $cascade's hierarchy step (Concept.get_hierarchy_queryset) matched a link's exact row, then
  kept it only if the version held that row. A child whose row links to an older row of its parent (the parent changed
  in a later release, as in LOINC 2.81) lost that parent, and the parent lost that child. The step now matches by
  concept, as the version views already do (get_version_hierarchy_queryset): a version's concepts cascade to their
  parents and children in that version, whichever row a link names.
- A collection's expansion, at HEAD or in a version, is read the same way. It can hold HEAD rows as well as version
  rows, so a member that is its concept's HEAD or latest version also has the links of the other one, as the API reads
  a concept at HEAD. Before, a collection version never reached a HEAD row, and a collection at HEAD never reached a
  version row.
- get_version_hierarchy_queryset takes the member set, and reads parents from every row of the concept the version
  holds, not only the first. The exact-row variant of get_hierarchy_related_queryset had no other callers and is gone.
- A source's HEAD is unchanged. Covers $cascade (flat and as a hierarchy, both directions), $clone and cascade
  references in collection expansions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
… expansion, no deleted members, a HEAD's newest latest version; $clone clones a concept once

Codex review pass 1 (F1.1 to F1.4):
- A collection's hierarchy step reads the concepts of the expansion the rest of its cascade reads (its default one),
  not every expansion of the collection version (F1.1).
- It leaves out deleted members, as the HEAD walk did, such as a HEAD row an import dropped from its source (F1.2).
- A HEAD member has the links of its newest active latest version only, as get_hierarchy_ids reads it, not those of
  an older row still flagged latest (F1.3).
- $clone clones each concept once when a release holds two rows of it (F1.4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
…s that expansion; deleted rows and a stopped clone walk

Codex review pass 2 (F2.1 to F2.3):
- $cascade under a collection version's named expansion (.../expansions/<name>/concepts/<code>/$cascade/) walks that
  expansion, its hierarchy and its mappings; the version's own route walks its default expansion, as before. The
  expansion goes from the view through the Bundle to Concept.cascade and cascade_as_hierarchy. Before, the mappings
  always came from the default expansion, whatever the URL named (F2.1).
- $clone refuses a cascade its budget stopped, even when two rows of one concept leave it at or under the budget,
  rather than cloning part of it (F2.2).
- In a source version, deleted rows are no part of the cascade's hierarchy, as in a collection: their links don't
  count, and they aren't returned (F2.3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
… views' parents as before; a collection root's own links

Codex review pass 3 (F3.1, F3.3, F3.4):
- $clone reads the cascade's stopped flag only when the cascade gives one: its early returns (an equivalent already
  in the target, cascadeLevels 0) don't (F3.1).
- The version views (a source version's concept parents) read the first row of the concept the version holds, as
  before; only the cascade reads every active row (F3.3).
- A reverse cascade in a collection also reads its root's own links, as before, so a root the route found in another
  expansion of the version still reaches its parents in the expansion walked (F3.4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
…rows helper, reuse the newest-latest subquery

Simplification review (S1 to S4): the helper that read each row's links as get_hierarchy_ids does had one caller and is
inlined; annotate_has_children uses newest_latest_version_id rather than its own copy of the rule; shorter docstrings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
… a collection's reverse cascade

Codex check FC.1: the root's own row, read in a reverse cascade in a collection, counts only when it isn't deleted,
as the expansion's members do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qXRkP3QEc5U3NfPZp9
…sionEvaluation the caller may supply

An ExpansionEvaluation says how one expansion is evaluated: which rules it follows (fhir_rules: OCL's new
EXPANSION_FHIR_RULES_TOGGLE decides for API requests, read only when asked; a caller can set them) and how what
its references and system-version entries name resolves. Its resolve() is the one entry point for both, ahead of
the shared resolver, so a caller with content of its own can answer for a canonical first, even with the URL
registry on. The version is passed apart from the URL.

add_references and seed_children take an optional evaluation and set it on each reference while they evaluate
it. Callers that pass none are unchanged: each reference resolves under its own default, which calls the
resolver exactly as before. Nothing reads fhir_rules yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…est time, rolled back, with side effects refused and a deadline

ExpansionEvaluation.at_request_time(seconds) opens an evaluation for one request: a transaction rolled back when
it closes; side effects refused while it's open (Celery tasks and cache writes raise in tests and are skipped in
production with an error logged; a search index write raises in both; an on_commit hook is refused at close, the
rollback dropping it); and one deadline for all it runs. Each statement gets SET LOCAL statement_timeout from the
time left, add_references checks it before each reference, and running out raises EvaluationTooCostly once rolled
back.

Under it, add_references and seed_children index nothing and write nothing back to the references or to health,
and Expansion.build_at_request_time builds a new expansion of a collection version at once.

The guard lives in core/side_effects.py: the task classes check it before they queue (a once task before it takes
its lock), the cache backend is django_redis's with its writes checked (core.common.cache.RedisCache), and the
search client's transport refuses writes (RefusingTransport). With no evaluation open they behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…ences to one source version in one query

A reference to one concept by its code, with nothing else to apply (no concept version, cascade, transform or
value set), is now evaluated with the others like it: add_references resolves each as before, then finds all their
codes with one query per source version (CodeReferenceBatch), applies the expansion's parameters once to what they
found, adds it once, and writes back and records each reference's result as it did one at a time. Each finds what
it found on its own: in a version, the concept with that code, the newest if the version holds two; in HEAD, the
concept itself; only in versions its creator can view.

add_references also reads its owner's resolution namespace once rather than once per reference (a toggle read
each). A request-time build of 10 or 40 code references now runs the same number of queries; one at a time it ran
about six more per reference.

Tests build each case both ways (batched and one at a time) and compare members, mappings, recorded versions,
unresolved entries, each reference's reason, what's written back and what's indexed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…32-bit link sequences it advances

A rollback gives back none of the ids a request-time evaluation used, so each request advances the sequences of
the link tables it writes for good. LINK_SEQUENCE_TABLES lists the ones with 32-bit ids (concept and mapping
source links, parent links, expansion members, reference results and an expansion's recorded versions), and
link_sequence_usage() reads how much of each range is used. at_request_time() refuses to open
(EvaluationUnavailable) once one reaches 90%, leaving the rest to OCL's own writes.

A test checks that every table with 32-bit ids a request-time build inserts into is on the list.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…der kept, the guard tightened

- Code references excluded are evaluated together too, one query per source version.
- A run of code references is applied before any other reference, which may read the expansion being built (a
  value set reference to its own collection), so every reference sees what it saw one at a time.
- Members a request-time evaluation removes no longer mark the stored collection's last_child_removal_at, which
  held its row until the rollback.
- Bulk indexing and the indexing signal tasks check the guard in the calling thread, before their worker threads
  (which don't see it) start.
- An on_commit hook is refused when it's registered, savepoints included, not only at close.
- The deadline covers the sequence check, and an evaluation that finishes past it is too costly.
- A relative url|version is split for the evaluation's resolve too, unless the resolver reads it as canonical.
- The test runner's no-op cache refuses writes at request time, as the deployed cache does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…e deadline, one search per version, nested guards

- Search index reads during a request-time evaluation get only the time its deadline leaves, with no retries, and a
  search ends on the index's side too (its timeout); out of time, or timed out, is too costly.
- A code batch is told every code the expansion's code references name, so each source version is searched once,
  however other references split them into runs.
- Expansion parameters that read members (exclude-system, date) apply reference by reference, as before, since an
  earlier reference's concepts can change what a later one adds.
- The sequence check runs inside the evaluation, within its deadline.
- A nested evaluation restores the outer one's on_commit guard when it closes.
- Fix: the bulk index guard named its document with __name__, which an instance doesn't have, on every bulk index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…erence at a time did

- What batched code exclusions removed is queued for indexing as a list: a set isn't JSON, so a build that
  indexes outside tests failed (found by crew fhir-b-versions' review).
- With a parameter that reads members (exclude-system, date), what's indexed is re-read once added, as one
  reference at a time did, so the same members are indexed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…ested deadlines, read routes, indexing re-read

- A savepoint's rollback or release, and a statement in a failed transaction, run without the deadline's SET LOCAL,
  so an error caught in a savepoint leaves the evaluation usable.
- A nested evaluation ends by the outer one's deadline, for statements and search reads alike.
- A search request is a read by its endpoint (the first segment starting with _), so a document whose id looks
  like a read's endpoint is still a write.
- With a parameter that reads members, what's indexed is the parameters' own query re-read once added, as one
  reference at a time did (a text filter's matches stay as matched).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…ps the nearest entries when cut, and no longer recurses

- One step for a whole level: Concept.get_level_cascaded_resources (mappings, mapped concepts, hierarchy) and
  get_level_hierarchy_queryset answer with what each concept's own step answers, together, in one query per kind.
  The per-concept step (get_cascaded_resources, get_hierarchy_queryset) is that step for a level of one, so the
  hierarchy has one definition.
- cascade() walks level by level in a loop, so a walk's queries grow with its depth rather than its size, and a
  chain of any depth no longer hits Python's recursion limit (it did past about 900 levels). cascade_as_hierarchy()
  is a loop too.
- Untruncated answers are unchanged: the same concepts and mappings, proven against a walk concept by concept
  (a cycle, two parents, mappings, retired, source HEAD and a collection, both directions, levels 1, 2 and all),
  and by the existing $cascade, $clone, reference and collection tests.
- What changes, for every caller of a truncated walk ($cascade with max_results, $clone over its budget): a strict
  walk that reaches max_results keeps every level before the cut, then the cut level's mappings and concepts by id
  (mappings first). Before, it kept the lowest row ids across the whole walk, so a nearer concept could be dropped
  for a deeper one. It also reads no more of a wide level than fits (plus one, to tell it was cut), where it read
  every id of the level first. Whether a walk is truncated, and how many entries it returns, are as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…tes, one forwarding test less

- The search transport takes for reads only the endpoints OCL sends (_search, _count, _msearch, _mget and a
  scroll); any other request is a write.
- A test that seed_children forwards its evaluation goes: the request-time tests go through it.
- Import order and a long line (lint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…queries, a test stub's model

- A search of every index (_all) is a search: _all names indexes, it isn't an endpoint.
- The deadline wrapper passes a composed query (psycopg2.sql) through; only a string can be a savepoint's rollback.
- The equivalence test's text filter stand-in answers with the model it was given (mappings too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWrEkUwedkj6bUPC61
…base, with FHIR's operators, under FHIR's rules

Behind the per-evaluation switch (ExpansionEvaluation.fhir_rules): FHIR's evaluations turn it on, and API users
keep today's behaviour until EXPANSION_FHIR_RULES_TOGGLE is turned on for them. With it off, nothing here changes:
filters go through the search index, only = and in apply, and expressions and parsing are as before.

Under it, a concept reference's filter entries are matched in the database (core.collections.filters):
- = and in on OCL's keyword fields as the search index matches them (concept_class and datatype ignoring case;
  retired, locale, name_types and description_types exactly), and exactly on extras.<key>: a value's text, a boolean
  as true or false, a number as written, each item of a list, a Coding by its code. The index matched extras as
  words ("chronic" found "Chronic Care").
- new ops: not-in (a concept without the property is kept), exists, and regex: the whole value, on RE2 (linear
  time; google-re2 added); a pattern RE2 can't compile is refused.
- on a concept's code (concept or code) and its display (as display_name picks it).
- hierarchy filters on concept or code, walked with $cascade: is-a, descendent-of, child-of, is-not-a, generalizes,
  descendent-leaf. Hierarchy only, through retired concepts, matched by concept, complete or too costly: a walk past
  REFERENCE_HIERARCHY_FILTER_LIMIT (100,000) raises EvaluationTooCostly, unless the reference is evaluated in the
  background.
- q, and the search index's text and relation fields, stay on the index (= and in, as before).
- what can't be applied is refused at add time with its reason, and selects nothing.
- codes are matched ignoring case when the source says it isn't case-sensitive (a version that says nothing, as its
  HEAD says): in filters, in code references, and in an expansion's batched code references.
- an op other than = and in is written into the reference's expression as property:op=value, and read back by the
  parser, so "p=v" and "p not-in v" are two references (they were one expression, so adding both kept one).

Proven by a test per operator with the switch on and off, a parity test with the search index (each keyword field,
with case variants, selects the same concepts both ways), a dry_run_rebuild of a collection filtered as production
collections are (only the extras word match changes), and a hierarchy filter over a release with a link to an older
row (LOINC 2.81's shape).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…nambiguous expressions, whole walks outside request time

- A hierarchy filter's walk is limited only at request time (REFERENCE_HIERARCHY_FILTER_LIMIT); a build, a queued
  rebuild or an add walks the whole hierarchy, so a rebuild never stops part way.
- A property the source declares (Source.properties) can be filtered by its code, read as Concept.properties reads
  it: its extras value, an object's value unwrapped, else, for a class or datatype property, the concept's own.
  extras.<key> unwraps an object's value too.
- Under FHIR's rules an expression keeps every clause: an op other than = and in, or a second clause on one
  property, is written property:op=value (eq for =), one clause each, and read back so.
- A concept-version reference's code stays exact, as the versions holding it are found by it.
- exists treats an empty list as no value; a number matches only as JSON writes it (2, not 2e0); descendent-leaf
  sees a child that cycles back to the root; the case-insensitive code batch looks codes up in one map.
- The wide-level walker test checks that no read of children is unbounded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…ere evaluated, concept versions ignoring case, more fields in the database

- A property the source declares is checked in the versions the reference is evaluated in (an expansion's
  system-version), not only its own, and is read as declared even when OCL has a field of that name; a class or
  datatype with no extras value compares the concept's own as the index does (ignoring case).
- The add-references check resolves each reference in its collection, as adding it does.
- Under FHIR's rules a concept-version reference's code is matched ignoring case in a source that isn't
  case-sensitive, in finding the versions that hold it too; the version itself stays exact.
- is_latest_version, id_lowercase and updated_by are matched in the database, as the index matches them; the index's
  fields about a concept's repository, memberships and mappings stay on it.
- A property name that reads as property:op is written with its own op, so the two can't collide.
- exists treats a wrapped empty value ({"value": []}, {"value": null}) as no value; a filter value with a non-ASCII
  digit stays a string match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…xtras value, declarations of the version evaluated

- An extras value's texts (value_texts) are the one definition every op compares: =, in and not-in find their
  candidates by a containment search the database can index, then check each by it, as regex and exists do. An
  object with a value is read by its value only, a Coding by its code; null and nested lists are no value.
- A filter applies a declared property only in a version whose source declares it, and only one its creator can
  view; reporting reads the reference's own version and those it's evaluated in. A declared property named like a
  search parameter (page, limit) is a filter.
- A supplied expression whose query string isn't its structured filter (a copied one, changed) takes its filter's.
- The batched lookup of the versions holding concept versions ignores case whatever kind of reference comes first.
- A declared display is read from its extras value by every op; a digit string too long for an int stays a string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…ids helper, no unused union, regex check and tokens inline

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…n empty text is no value, names escaped, q a search

- A supplied expression is compared with its structured filter only once the filter's schema is valid, so an invalid
  one is refused as before; a list's values compare in any order.
- exists counts only a text that isn't empty ('' and {"value": ""} are no value, as before the last pass).
- Under FHIR's rules a property name is escaped as a value is, so one with & or = reads back whole.
- q is a text search wherever it's declared, in checking and in applying a filter alike.
- An expansion's lookup of the versions holding concept versions takes its own rules (the code batch's), not the
  first reference's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
…ilter selects nothing; tests for a declared q and the expansion's own rules

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTiXpee3gahwF7WgUt
@paynejd
paynejd requested a review from snyaggarwal November 29, 2026 18:25
… its search again, in either spelling

A reference made from a pasted search URL carries that search's options
(excludeWildcard, excludeFuzzy, includeSearchMeta, searchMapCodes,
exactMatch, verbose) in its filter. Since the change for ocl_issues#2201
(camelCase filter properties such as conceptClass), the camelCase options
were matched as fields the index doesn't have, so such a reference
selected nothing. References saved since then store the options
snake_cased, which were matched the same way.

- The options are recognised in either spelling before the camelCase
  switch, and never matched as fields. conceptClass and the other
  camelCase properties still work.
- They're applied to `q` as the search API applies them: exact matches,
  or wildcard matches too when excludeWildcard is false, or fuzzy matches
  too when excludeFuzzy is false; searchMapCodes false leaves out map
  codes. A reference still matches exactly unless its filter says
  otherwise.
- A filter of options alone selects everything the reference's system or
  value set has, as the search with no `q` lists it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
paynejd and others added 11 commits November 29, 2026 23:40
…under each evaluation a reference is given

A reference given another evaluation forgets the filter properties it read under the last, as it
forgets what it resolved: at request time, each opening reads only what its caller can view then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWddiMQHvvG5BYWRfh
… fix (ee68373), so it comes from #1089 with its toggle

ee68373 copied an earlier head of #1089 into this
branch, without the REFERENCE_SEARCH_OPTIONS_TOGGLE that #1089 now keeps
it behind. With the switch off, that changed what references with search
options select. The next commit merges its head instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
The search options fix, behind REFERENCE_SEARCH_OPTIONS_TOGGLE (off
everywhere), so with the switch off a reference with search options
selects what it selects on master. This branch now stacks on #1089 as
well as on its base.

Conflicts: the index path is #1089's, now get_index_filter_clause_property,
which get_filter_clause_property calls when filters aren't matched in the
database. The database path is unchanged here; the next commit makes it
follow the same toggle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
…llow REFERENCE_SEARCH_OPTIONS_TOGGLE as without them

A reference's search options (excludeWildcard, exactMatch and the like, in
any spelling OCL's own filters read) and a pasted search URL's other
parameters are now read by the same code under FHIR's rules as without
them: get_index_filter_clause_property, with the toggle and all. With the
toggle off, an option matched as a field the index doesn't have selects
nothing under both, as on master; with it on, options are set aside and
apply to `q`. A field an option is matched as goes through the search
index, and its errors are the ones without FHIR's rules.

Before, the database path always set them aside, so under FHIR's rules a
reference with search options selected what the toggle-off path doesn't.

Tests: the members each option case selects, with the toggle off and on,
are the same with FHIR's rules as without; the errors are the same too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
… or a parse, not once a reference

With the switch off, each reference evaluated without an evaluation made
its own default, and each read OCL's toggle for FHIR's rules: once per code
reference on every rebuild (filter_by_code asks whether codes ignore case),
once per filtered reference, and once per expression with a query string
when parsing.

- CollectionReference.default_to: a reference with no evaluation yet takes
  a shared default.
- Expansion.add_references, given no evaluation, shares one default with
  its references and its code batch.
- The parsers share one evaluation (the caller's, else a default) and read
  filters under its rules (the parser read the toggle itself before); the
  references they make default to it. A value set's compose shares one
  across its includes and excludes, a conversion across its references,
  and references generated from another (cascade and transform) take its.

Test: the switch is read as often adding and rebuilding one reference as
four, and once a rebuild (four times without the shared default).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
… compares a code as FHIR spells it

OCL stores a code with reserved characters percent-encoded (ICD-11's
ND53.Y&XK70 as ND53.Y%26XK70), and FHIR spells it decoded. A regex already
compared the decoded code, but =, in, not-in and a hierarchy's root
compared the stored one, so `concept = ND53.Y&XK70` selected nothing while
`concept regex ND53\.Y&XK70` selected it.

They now match every form OCL stores the code in (stored_forms: as it
is, and percent-encoded as OCL and the FHIR layer's stored_codes encode
it), in the database, ignoring case where the source does. A value that
reads as percent-encoded isn't matched as it is, so ND53.Y%26XK70 selects
nothing, as with a regex. Only under FHIR's rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
…chy matches stay in the database

An extras match read every candidate into Python and sent the matching
ids back as one IN list; a hierarchy filter did the same with the walk's
concepts, and the database path's last step with everything selected.

- Extras: = and in are settled by the containment search, exists by the
  value's JSON type (a string that isn't empty, a number or a boolean), as
  a subquery. Only values that search can't settle are read (a Coding for
  = and in, which value_texts reads by its value if it has one; a list or
  an object for exists), and only those that fail are listed, to leave out.
- Hierarchy: the walk's concepts as $cascade answers them, their concepts
  and a leaf's children as subqueries.
- The database path's last step selects by subquery.

A regex still runs in Python (RE2), reading a page at a time, so its
matches are an id list; at build time it isn't capped, as the index
path's matches never are.

Also wraps two long test lines from the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
…ted unapplied in each version it's evaluated in

unapplied_filters read what all the versions a reference is evaluated in
declare, together, but the filter reads what the version it evaluates
declares, alone. A property one release declares and another doesn't
selected nothing in the other, and health recorded no filter_not_applied.
It now reads each version alone, as the filter does, and reports an entry
it can't apply in any of them. Without FHIR's rules nothing changes.

Also: a docstring names get_level_hierarchy_ids, which replaced
get_hierarchy_ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
… conditions, numeric extras keys, escapes in either case, an option stays an option

From a Codex check of the commits answering the review:

- An extras filter put the queryset it was given into both the outer
  query and a subquery, so each extras filter doubled the query: twelve
  in one include made thousands of copies. A display filter did the same
  (from before). Both are now plain conditions on the concepts.
- An extras key that looks like a number (extras.123) was read as a list
  index by `exists`; it's read as text now.
- A code stored with lowercase escapes (1%2b1, which an import keeps as
  given) is found by its FHIR spelling too, and where codes ignore case a
  character outside ASCII is matched in either case (CAF%C3%89 by café).
- A search option whose field a source declares (exclude_wildcard) is
  still an option without the toggle, matched through the index as
  without FHIR's rules.

Each has a test that fails on the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
…t an object have no value under a key, for exists too

Extras stored as a list (["123"]) have the key in Postgres's sense (? matches
a list's strings) but no value under it, so `exists` read an unknown type and
dropped the concept from both `exists true` and `exists false`. A missing
value now reads as JSON null, so `exists false` and `not-in` keep it, as
they did before extras matching moved into the database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
…nts only when extras is an object

Postgres's ? also finds a string in a list, so extras stored as ["0"] had
the key 0 for has_key, and extras.0 exists true read the list's first
item; extras stored as ["datatype"] suppressed a declared datatype
property's fallback to the concept's own datatype. A key now counts only
when extras is an object, for the match and for what has no value alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVC3osEQxNxh6dcRnV
@paynejd paynejd changed the title OpenConceptLab/ocl_online#452 | $cascade walks a level at a time; reference filters with FHIR's operators matched in the database, behind the switch OpenConceptLab/ocl_online#452 | $cascade walks a level at a time and a cut walk keeps the nearest entries; reference filters with FHIR's operators matched in the database, behind the switch Nov 30, 2026
@paynejd

paynejd commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

@snyaggarwal, every point is answered in its thread. New head 255ef3ae.

Codex checks of these commits found one P1 (each extras filter doubled the query), now fixed; the last check is clean. Full gate: pylint 10.00; 4,226 tests and 821 search-index tests OK; coverage 97%.

paynejd added a commit that referenced this pull request Nov 30, 2026
…es), which the FHIR series builds on

fhir-452-b-codes ends the queue of OCL API PRs, so the FHIR series sits on all of them:
#1085, #1086, #1089,
#1088, #1087, #1090,
#1091, #1092 and #1093, and
the core changes that need them together. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qV2gzsF5GhF5BwTJ6x
paynejd added a commit that referenced this pull request Nov 30, 2026
…I PRs

Two conflicts:
- core/concepts/models.py: the API PRs' version. It holds this PR's two changes there
  (Concept.get_property_value, and the hierarchy step reading an annotated latest version), which
  now come with the API PRs, beside #1088's level-at-a-time hierarchy step.
- core/settings.py: both sides' settings.

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

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review round 2 (Sunny): verdict approve

Reviewed at 255ef3a, against round 1 at 5d209ec. The blocking finding is fixed, and every other round-1 item is fixed or answered. One new should-fix, under the switch only, and two nits.

# Round 1 Status Commit
1 blocking: switch-off path picked up #1089's fix without its toggle (models.py:1355, :1236) fixed: the copy is reverted and #1089's head merged in. has_param_in_filter, both _get_search_criterions and get_index_filter_clause_property (body) are #1089's line for line 455cc88, 5818398, 3817038
2 should fix: truncated $cascade order changes with the switch off (concepts/models.py:1819) answered: kept as a fix for API users. Recorded under "Behaviour changes for API users" with an example, and in the title PR body, thread reply
3 should fix: one extra toggle query per code reference (models.py:1261, :1267) fixed: one shared default evaluation per build, parse, value set compose and conversion. A test counts the reads 7c1d68b
4 should fix: =/in/not-in and hierarchy roots compared the stored code, regex the decoded one (filters.py:269, :372) fixed: stored_forms for =, in, not-in and find_root. It matches the FHIR layer's stored_codes, plus lower-case escapes a820e37, 2eaadce
5 should fix: regex and extras matches sent back as one IN list (filters.py:207, :253) fixed for extras and hierarchy (plain conditions and subqueries). Regex stays an id list, by decision, read 5,000 codes at a time and documented in the body 59f9af6, 2eaadce
6 nit: parser read the global toggle (parsers.py:329) fixed: the parser reads its evaluation's fhir_rules 7c1d68b
7 nit: unapplied_filters checked all versions together (models.py:2643) fixed: each evaluated version read alone, with a test for the two-release case fea2262
8 nit: docstring named get_hierarchy_ids (concepts/models.py:1595) fixed fea2262

New findings

Severity Where Finding
should fix (switch on only) core/collections/filters.py:359, :362 A regex on extras.<key> or on a declared property still reads extras that aren't an object. 439ffd9 and 255ef3a made =, in, not-in and exists require an object (key_criterion), but extras_texts still uses extras__has_key and key in (extras or {}). With extras ["123", "0"], as in tests_filters.py:461, extras.123 regex .* passes has_key, then extras.get('123') raises AttributeError, so the evaluation or build fails. A declared datatype with extras ["datatype"] raises TypeError at extras['datatype'], and extras stored as a number or true raise TypeError for any declared-property regex. Fix: use self.key_criterion() in the first branch and isinstance(extras, dict) and key in extras in the second, and add regex cases to that test.
nit core/collections/models.py:1439 The get_index_filter_errors docstring reads "can't apply can't be applied".
nit core/concepts/tests/tests.py:3232 A test docstring (from #1085) still names get_hierarchy_ids, which this PR removes.

Does merging change behaviour for existing users with the switch off? Only the truncated $cascade order, which is decided and documented. I checked each changed path:

  • Stack: I diffed the head against a merge of the current heads of #1085, #1086 and #1089 (c4f0f3f, c3aa422, ef86e19). What's left is this PR's own work. The #1085 merge keeps its join and NOT EXISTS unchanged, applied to a whole level.
  • Search options: #1089's code, so with REFERENCE_SEARCH_OPTIONS_TOGGLE off it is master's. A pasted-search-URL reference selects nothing on a rebuild, as today.
  • get_filter_clause_property, get_filter_errors, unapplied_filters: off, they call the index versions. The errors come out per entry, with the same text and order as the old loop.
  • get_filter_values now splits not-in too. Off, not-in is refused before values are read, so nothing changes.
  • _apply_filters: off, the index path is unchanged; only a system_version argument is added.
  • Expressions and parsing: off, build_expression, filter_to_querystring and the parse_qs path write and read as before.
  • Code matching: filter_by_code, get_repo_versions_with_resource_version, get_repo_versions_holding_resource_versions and CodeReferenceBatch.search run the same exact-match queries. Case folding needs fhir_rules.
  • check_filters now passes the collection. Off, the errors don't read it.
  • Untruncated $cascade is unchanged since round 1, apart from #1085's join.
  • New for everyone: google-re2 is imported at startup (CI builds it), and the REFERENCE_HIERARCHY_FILTER_LIMIT setting, which is unused with the switch off.

Shared default evaluation (7c1d68b): fhir_rules is cached on one ExpansionEvaluation. Each build, parse, value set compose and conversion makes its own, and none is kept at module or class level, so a toggle change applies from the next build or request. The evaluation's viewable cache is keyed by viewer, so sharing it across a build's references doesn't mix users. A parser's references carry its evaluation into the build that follows, so such a build can read the toggle twice. That's harmless.

Switch-off tests: every new op refused as before, nothing changes with the switch off, search options under both toggles with FHIR's rules off and on, the toggle-read count, the keyword-field index parity, and the dry_run_rebuild comparison.

Credit: the author's own checks found the extras subquery that doubled the query per filter, and the extras-as-list cases for exists and has_key (439ffd9, 255ef3a). The three accepted cases are the author's: mixed-case escapes in one code, non-ASCII case folding of encoded codes, and a concurrent edit between check and query. So are the $cascade example, the local dry_run_rebuild counts, the EXPLAIN costs and the full test gate on 255ef3a.

CI: Pylint, Tests and Snyk all pass on 255ef3a.

What I could not verify: I ran no tests and made no staging or production queries, so I relied on CI and the author's gate. I found the regex crash by reading the code, not by running it, and didn't check whether production has concepts whose extras aren't an object. I didn't recheck the EXPLAIN costs. The GIN index on concepts.extras is still a separate decision before the switch goes on for API users.

Base automatically changed from fhir-452-b-eval to master December 1, 2026 05:08
paynejd and others added 4 commits December 1, 2026 00:34
Brings in #1085, #1086,
#1082 and #1073. The two
conflicts were adjacent additions (master's EXPANSION_FHIR_RULES_TOGGLE and
evaluation import next to this branch's REFERENCE_SEARCH_OPTIONS_TOGGLE);
both are kept. No change to this branch's own code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWUTom6BGgjQy6oehZ
Brings in the squash merges of #1085 and
#1086, whose original commits this branch already
holds, and #1082. Every conflict keeps this branch's
side: the squashes match the original commits byte for byte, and the merged
tree equals this branch's previous head plus #1082's
changes. No change to this branch's own code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWUTom6BGgjQy6oehZ
…merge into fhir-452-b-filters

Takes #1089's new head, so this branch holds the
commit that will reach master. No change to the files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWUTom6BGgjQy6oehZ
Brings in the squash merge of #1089, whose original
commits this branch already holds, and #1109 and
#1106. The conflicts are where
#1109 changed #1089's lines:
models.py keeps this branch's side, and the toggle and its test are
master's, so REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every environment. The
squash matches the original commits byte for byte, and this branch's diff
against master is the same as before. No change to this branch's own code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
paynejd added a commit that referenced this pull request Dec 2, 2026
…nto fhir-452-b-codes

Takes #1088's new head, which brings in master
(#1089, #1109 and
#1106): REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every
environment, as on master. Merged cleanly; no change to this branch's own
code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
paynejd added a commit that referenced this pull request Dec 4, 2026
Two conflicts, both where each branch adds to the same place, so both sides
are kept: the imports in core/collections/models.py, and the end of
core/collections/evaluation.py (CodeReferenceBatch.search_folded, then
EvaluationResolution). One line resolves by meaning: without an evaluation
given, Expansion.add_references' references and code batch share the build's
own default (build_evaluation), instead of the second default
#1088 made for them, so OCL's toggle is still read
once a build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
paynejd added a commit that referenced this pull request Dec 4, 2026
… into fhir-452-b-apart

Two conflicts, both where each side adds to the same place, so both are
kept: the imports in core/collections/models.py, and CodeReferenceBatch's
methods in core/collections/evaluation.py (found_by_version beside
#1088's case-insensitive lookups). No change to this
branch's own code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
paynejd added a commit that referenced this pull request Dec 4, 2026
…or _apply_filters takes any further arguments

#1088 gives CollectionReference._apply_filters a further argument, so the
stand-in that #1090's exclusion test patches in takes it too.

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

This branch has not been deployed

No deployments
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.

2 participants