Skip to content

OpenConceptLab/ocl_online#452 | A reference's search options apply to its search again, in either spelling - #1089

Merged
snyaggarwal merged 11 commits into
masterfrom
fhir-452-ref-modifiers
Dec 2, 2026
Merged

snyaggarwal merged 11 commits into
masterfrom
fhir-452-ref-modifiers

Conversation

@paynejd

@paynejd paynejd commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Not part of the Dec 1 run.

Merging this changes nothing. The fix is behind a new toggle, REFERENCE_SEARCH_OPTIONS_TOGGLE, off in every environment. Turn it on only after the data step for the references that never added anything is decided (OpenConceptLab/ocl_online#797); the date it goes on waits for that decision. Until then, rebuilding the 61 collection versions below on master still empties them, with the toggle off too.

Ticket: OpenConceptLab/ocl_online#452 (OCL API fix).

What was wrong

A collection reference can be made from a pasted search URL, such as /orgs/O/sources/S/concepts/?q=fever&excludeWildcard=true&excludeFuzzy=true&includeSearchMeta=true. Its filter then carries that search's options: excludeWildcard, excludeFuzzy, includeSearchMeta, searchMapCodes, exactMatch, verbose.

The change for ocl_issues#2201 (Jul 2025) made camelCase filter properties work, such as conceptClass. Its switch also caught these options:

  • The camelCase options became matches on fields the search index doesn't have (exclude_wildcard and so on), so the reference selected nothing.
  • Snake_case copies: the switch renamed the options in place, so references saved since store them snake_cased. Master matched those as fields too.

What changes with the toggle on

  • Both spellings are options. excludeWildcard and exclude_wildcard (and so on) are recognised before the camelCase switch, and never matched as fields. conceptClass and the other camelCase properties work as before.
  • They apply to q as the search API applies them. Matches are exact, plus wildcard matches when excludeWildcard is false, plus fuzzy matches when excludeFuzzy is false. searchMapCodes false leaves out map codes, and a repeated option takes its last value.
  • What changes in matching: a reference still matches exactly unless its filter says otherwise. The extra matches used to be AND-ed with the exact ones, which made excludeWildcard=false do almost nothing. They're now OR-ed, as in the search API.
  • Options alone select what a reference with no filter selects, retired content included. That's what these references selected before Jul 2025, and what the older ones hold today. It's read from the database, so it doesn't depend on the index. An expansion's activeOnly still leaves retired content out.
  • The reference's description leaves the options out, instead of reading them as property matches ("having excludeWildcard equal to ...").

With the toggle off (every environment, as shipped)

Everything is as on master today, and master's own code runs:

  • get_filter_clause_property, get_allowed_filter_properties, get_filter_errors and the description are master's, so the options are matched as fields;
  • a q is matched by master's code (_get_search_criterion_as_before), so even the query sent is the same;
  • options alone select the version only with the toggle on;
  • the toggle is read only for a filter that has a search option.

toggles.json is loaded on every container start, so turning the toggle on is a change to its row there (pk 14).

Impact on a rebuild (production, read-only counts)

207 references carry these options (162 camelCase, 45 snake_case), in 124 collection versions, 42 of them active HEADs. Every one sets all three of excludeWildcard, excludeFuzzy and includeSearchMeta to true, so their q matching is exact either way.

Collection versions Active HEADs Members
Lose members on a rebuild with the toggle off (master as it is). Their references, added before Jul 2025, still hold about their whole target version; with the toggle on they keep it. 61 18 204,456
Grow on a rebuild with the toggle on (upper bound: the target version's size) 53 19
… of which hold nothing from these references today 25 14 up to 1,279,607 active + 124,177 retired concepts, and 2,937,795 active + 387,813 retired mappings
  • The 25 that hold nothing today are what the data step decides (Bump boto3 from 1.24.28 to 1.36.1 #797), and why the toggle stays off until then. Their references were added after the regression, so they've never added anything. The largest gains 286,477 concepts (43,982 retired) and 380,263 mappings (97,946 retired).
  • 22 of the 25 cascade (sourcetoconcepts or sourcemappings). A rebuild calls cascade() once per concept of the target version: 1,423,154 calls if each is rebuilt once. Measured locally, that's about 20 to 30 minutes for each of the three largest (252,212 to 286,477 concepts) and 4 to 6 minutes for each of nine with 58,947. Production wasn't measured. These should be rebuilt through the async path, off-peak.
  • 80 references select nothing either way: 65 are global searches with no repository, and 15 name a version that no longer exists.

Tests

  • CollectionReferenceTest, with the toggle on:
    • each option in both spellings, with no q, selects the whole version (concepts and mappings), retired included, and exactly what a reference with no filter selects, a release with or without its version named, the resource-versions toggle on and off;
    • an unindexed member is selected, with no index call;
    • options with retired=false and with conceptClass;
    • q with the options, excludeWildcard=false OR-ed in, excludeFuzzy=false (with an uppercase typo), and searchMapCodes=false;
    • a repeated option, and a pasted URL parsed into a reference;
    • a quoted q from a search URL, and a q alone with a literal apostrophe.
  • With the toggle off: master's behaviour (options-only and q with options select nothing, verbose alone still goes through the index, a quoted q is read as it is, q's query built as master builds it), and master's clause properties and filter errors. The same checks were also run against master's own code, with the same results, and fail on this PR's previous head.
  • A filter with no search option never reads the toggle; with the toggle on, another spelling of an option (ExactMatch) is reported as a property it can't apply.
  • An options-only reference added to an expansion and rebuilt, with the toggle off (nothing), on (the whole version, retired included), and off again (empty).
  • The toggle's row ships off in every environment, and is what is_search_options_on reads.
  • The description, with the toggle off and on.
  • Unit tests for get_filter_clause_property (each spelling, both toggle states), get_filter_errors and has_param_in_filter.
  • Full gate on ef86e199: pylint 10.00; 814 search-index tests OK; the other 4,061 (2 skipped) OK on a rerun; coverage 97%. The first run had one failure in a timing test in core.capacity, which this PR doesn't touch; it passes alone, and passed in the gate on cd0db49d.

Review

Three Codex defect passes (5, 4 and 2 findings), a simplification review (4 of 5 cuts applied), and two Codex checks of the later commits (1 finding each). Fixed along the way:

  • options alone no longer need every member indexed;
  • fuzzy and wildcard matches get the text in the search API's form (lowercased, trimmed, quotes dropped);
  • a filter that carries search options reads its q that way for exact matches too, while a q alone is matched exactly as before;
  • a repeated option takes its last value;
  • only the two spellings count.

Sunny's review (the toggle, retired content, the cascade cost, the description) is answered in its threads. Its fixes had three Codex checks (5 findings, all fixed; then clean twice) and a simplification review (2 of 5 cuts applied).

Not fixed here:

  • Mapped codes in a release. In a release, a reference's search reads every release's mapped codes, where the search API reads that release's own. Its exact matches already do this today, so it's a separate change: the filter path would need the version being evaluated.
  • A blank repeated option. The parser drops a trailing blank repeated parameter (searchMapCodes=false&searchMapCodes=) for every property.
  • A pasted q="" is an exact search for empty text.
  • A hand-written filter with a quoted q and a display-only option reads its text the search URL's way.

No production reference has any of the last three.

Merged master after #1085 and #1086 (3980d7d7); no change to the reviewed code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qTi2oWEe5q1Dj7NkUp

paynejd and others added 6 commits November 29, 2026 13:48
… 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
…kip the index; last value wins; exact spellings; fuzzy text lowercased

- A filter of search options alone selects what the reference's system or
  value set has without asking the search index, so a member not indexed
  yet still counts, and a large version isn't read 500 ids at a time.
- A repeated option (a pasted URL's excludeFuzzy=true&excludeFuzzy=false)
  takes its last value, as the search API reads it.
- Options are recognised as the search API spells them or snake_cased,
  nothing looser.
- Fuzzy matching gets the lowercased text, as the search API sends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
…elect what no filter selects; the text read as the search API reads it

- A filter of search options alone returns the reference's queryset as a
  reference with no filter does, whatever the resource-versions toggle.
- A `q` value is trimmed and its quotes dropped, as the search API reads
  its text, and the wildcard clause gets the search API's form of it.
  (No production reference's `q` has quotes or surrounding spaces.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
… text as it is; only wildcard and fuzzy normalise it

A reference whose filter has only `q` matches exactly as before, a literal
quote included (a mapped code such as AB'12). Wildcard and fuzzy matches,
which only a search option turns on, read the text as the search API does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
… tests, an early return

- has_param_in_filter returns early for a name that isn't a search option.
- The spelling cases live in get_filter_clause_property's table; the
  release test is a case of the no-filter comparison, which now also
  names the source without a version.
- The repeated-value and snake_case cases stay in the end-to-end tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
…search URL reads its text as that search does

A filter with search options came from a search URL, so its `q` is read
as the search API reads its text (trimmed, quotes dropped) for exact
matches too. A `q` alone is still matched as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWzjyD2kDtz5SyuRMw
@paynejd
paynejd requested a review from snyaggarwal November 29, 2026 19:32
paynejd added a commit that referenced this pull request Nov 29, 2026
…ly exactly as without them

A reference's search options (excludeWildcard, excludeFuzzy,
includeSearchMeta, searchMapCodes, exactMatch, verbose) behave the same
with FHIR's rules on and off: master's fix for them
(#1089), and the database path uses it.

- Both spellings, camelCase and snake_case, are options, through one
  definition (get_search_modifier); the database path's own set is gone.
- They apply to `q` as the search API applies them, through the search
  both paths share.
- A filter of options alone selects what a reference with no filter
  selects, with FHIR's rules on as off.
- An option or a pasted parameter with an op OCL can't apply is refused
  under FHIR's rules too, as without them.

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

@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 (Sunny): verdict needs changes (request changes)

The fix itself reads right. Both spellings are now search options and never fields, q matching follows the search API (exact, OR wildcard, OR fuzzy), and a q alone matches as before. My one block is about when it ships, not about the code.

# Severity Where Finding
1 blocking core/collections/models.py:1320 Changes existing expansions with no switch. Merging puts it in the next release.
2 should fix core/collections/models.py:1226-1228 "As that search with no q lists it" is not true for retired content. The data-step numbers should split it out.
3 should fix core/collections/models.py:1320 A cascade on an options-only reference now walks every concept in the version. Check the 25 before the data step.
4 nit core/collections/translators.py:85-101 (not in the diff) The reference's English text still reads the options as property matches ("having excludeWildcard equal to ...").

Does this change behaviour for existing API users and expansions? Yes. It is a behaviour change, not a switched one.

  • Where it shows: the next time a version's references are evaluated again. That happens on a rebuild (dry_run_rebuild shows the change first) or when a new collection version is created from HEAD and its expansion is seeded. The reference's stored results (reference.concepts/mappings) are written back then too, so its resolved resources jump with it.
  • Who sees what: using the author's counts, 25 collection versions (14 active HEADs) go from nothing to up to their whole target version. The largest gains about 286k concepts and 380k mappings. 61 versions keep members that a rebuild on master today would drop. q matching stays exact for every production reference with options, because all of them set the three options to true.
  • Health: no new reason codes. These references were not filter_not_applied before and are not now. Under the toggle, unversioned references still get the searched version's resource versions: options alone return the same queryset as no filter, which the toggle test covers.
  • What it needs: a decision and a data step for the 25 (#797), as the PR says, before this reaches production. Until this ships, avoid rebuilding the 61 on master.

Credit: the author already reported the release mapped-codes gap, the blank repeated option, q="", and the hand-written quoted q with a display-only option. I don't repeat them.

What I could not verify: I made no production or staging queries, so I did not recheck the counts. I did not check how much of the gain is retired content or how many of the 25 references cascade (findings 2 and 3). I did not trace whether adding an unrelated reference to an autoexpand HEAD re-evaluates existing references. I relied on CI for tests (pylint and tests pass) and did not run them myself. There is no test of an options-only reference through Expansion.add_references or a rebuild, only at the get_concepts/get_mappings level.

if has_unapplied:
return resource_klass.objects.none() # an entry it can't apply never leaves the others to widen it
if not is_searched:
return queryset # search options alone: all it has, as with no filter, indexed or not

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.

blocking. This line is the behaviour change for existing expansions. 25 collection versions (14 active HEADs) go from nothing to their whole target version on their next rebuild, or when a new collection version is seeded. Nothing gates it. The PR says "don't deploy until the data step is decided", but master ships in the next release (2.3.279 is already bumped), so once this merges, nothing holds it back.

Fix: either keep this unmerged until the #797 data step is decided, or put this path behind a toggle that stays off until then, like the per-evaluation switch phase B already uses. Either is fine by me. Say which.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Behind a toggle, your second option, in e92e022 and cd0db49.

  • REFERENCE_SEARCH_OPTIONS_TOGGLE is a new row in toggles.json (pk 14), off in every environment, so merging changes nothing.
  • With it off, master's code runs.
    • get_filter_clause_property, get_allowed_filter_properties and get_filter_errors are master's again, so the options are matched as fields.
    • A q is matched by master's own code (_get_search_criterion_as_before), so even the query sent is the same.
    • This line (options alone selecting the version) runs only with it on.
    • The toggle is read only for a filter that has a search option.
  • Tests: master's behaviour with it off, and the restored one with it on. Also an options-only reference added to an expansion and rebuilt, with it off, on and off again. I ran the toggle-off checks against master's own code too, with the same results. They fail on the previous head, 0be05b8.
  • Still true: rebuilding the 61 collection versions on master empties them, with the toggle off too. The toggle goes on only after the data step for the 25 is decided (OpenConceptLab/ocl_online#797), so its date waits for that.

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.

Fixed in e92e022 and cd0db49. I checked it at ef86e19: with the toggle off, every changed path runs master's code (filter clauses, q matching, descriptions, so stored results, rebuilds and dry_run_rebuild too), and the fixture row is off in all six columns.

Comment thread core/collections/models.py Outdated
criterion = _criterion if criterion is None else criterion | _criterion
return criterion

# a pasted search URL's search options: they change how `q` matches, or what each result shows, never which

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.

should fix. "As that search with no q lists it" is not accurate. The search API leaves out retired concepts and mappings unless includeRetired is set. This path returns them, and the new test expects that (everything includes retired). A pasted /concepts/?excludeWildcard=true... URL showed the user only active concepts, but the reference adds the retired ones too. That is consistent with what the 61 pre-regression versions hold today, so I wouldn't change the behaviour here.

Fix: reword the comment (and the PR text) to "as a reference with no filter selects it, retired included". Split the retired part out of the 25 versions' expected gain, so the #797 decision is made on the real numbers. An expansion's activeOnly still drops them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Kept as you suggest, after checking the history. Before e108607 (Jul 2025), these options were set aside, and a reference with no q selected every indexed concept or mapping of its version, retired ones included. The 61 older versions hold exactly that today.

  • Reworded in e92e022: "selects what a reference with no filter selects, retired content included, as references did before Jul 2025". The PR body says the same. The expansion test checks that a retired concept is added.
  • The 25, split (upper bounds): concepts up to 1,279,607 active + 124,177 retired, mappings up to 2,937,795 active + 387,813 retired. The Bump boto3 from 1.24.28 to 1.36.1 #797 list has them per collection version.
  • One correction: the concept total is 1,403,784, not 1,428,958. Two of the 25 each have two concept references to the same version, which were counted twice.

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.

Fixed in e92e022. The comment and the PR body now say retired content is included, as before Jul 2025, and the expansion test adds a retired concept. Thanks for the active/retired split and the corrected total.

Comment thread core/collections/models.py Outdated
is_searched = True
if has_unapplied:
return resource_klass.objects.none() # an entry it can't apply never leaves the others to widen it
if not is_searched:

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.

should fix (check before the data step). Before this change, an options-only reference selected nothing, so its cascade never ran. Now get_concepts passes the whole version into _apply_cascade, which calls concept.cascade() once per concept. That is up to about 286k calls for the largest of the 25. A rebuild like that can take hours, and the FHIR ValueSet write path builds synchronously.

Fix: count how many of the 25 versions' references set cascade, and put that in the #797 data step. If any do, plan their rebuilds off-peak, or rebuild them through the async path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Counted and measured. It's about half an hour per rebuild for the largest, locally.

  • 22 of the 25 cascade (sourcetoconcepts, or sourcemappings for 2). Only 3 don't. If each is rebuilt once, that's 1,423,154 cascade() calls.

  • Local cost: 3.5 to 5.6 ms per call, depending on how many set and answer mappings the concepts have. On top of that, _apply_cascade keeps the concepts it has walked in a list, and checks each new one against it, so that part grows with the square of the count: 10 s for 60,000 concepts, 40 s for 120,000.

  • Per rebuild: that's about 20 to 30 minutes for each of the three largest (252,212 to 286,477 concepts) and 4 to 6 minutes for each of the nine with 58,947. I couldn't measure production (EXPLAIN only), and its database is a network hop away, so expect it slower.

  • Not new in kind: an unfiltered {system} reference with a cascade walks the same way on master. Production has 11, none over 12,587 concepts, so these would be the first over the large sources.

  • Proposed:

    • the data step first;
    • then rebuild only what it keeps, through the async path, off-peak, one at a time, the three largest last;
    • separately, traversed as a set, which removes the squared part (about 4 minutes of the largest) with no change in behaviour.

    I've left the set out of this PR, because it changes code that runs with the toggle off.

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.

Thanks for counting and timing these. 22 of 25 is enough to plan the rebuilds as you propose (async, off-peak, one at a time, largest last), and the traversed set as its own PR is fine by me.

paynejd and others added 4 commits November 29, 2026 22:08
…nd REFERENCE_SEARCH_OPTIONS_TOGGLE, off everywhere

With the toggle off, a reference's search options are matched as fields, as on master today, so nothing
changes when this merges. With it on, they apply to `q` and options alone select what a reference with no
filter selects, retired content included, as references did before Jul 2025.

- REFERENCE_SEARCH_OPTIONS_TOGGLE: a new row in toggles.json, off in every environment.
- Gated: search options set aside instead of matched as fields, options alone selecting the version without
  the index, and a search URL's `q` text read the search API's way. The allowed properties and the filter
  errors are as on master.
- Tests: the restored behaviour with the toggle on; master's with it off (options-only, `q` with options,
  verbose alone, a quoted `q`, the clause properties); an options-only reference added to an expansion and
  rebuilt with the toggle off and on; the fixture ships it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTi2oWEe5q1Dj7NkUp
…reference's description leaves its search options out

A search option only changes how `q` matches, so the description no longer reads it as a property match
("having excludeWildcard equal to ..."). With the toggle off, the description is as before, since the options
are still matched as fields then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTi2oWEe5q1Dj7NkUp
…toggle off, `q` is matched by master's own code

- With the toggle off, or no search option, `q`'s matches are built as on master (an option read in the
  search API's spelling, the text as it is, the matches AND-ed), so not even the query sent differs.
- With it on, another spelling of exactMatch (ExactMatch) is a property it can't apply, as for the other
  options, instead of being set aside.
- The toggle is read only for a filter with a search option.
- The toggle's fixture row is pk 14, since 13 is taken on another open branch.
- The fixture test turns the toggle on in every environment column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTi2oWEe5q1Dj7NkUp
…n asks has_search_option, and a test asserts the text

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

paynejd commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

Review answered in e92e022, b95a5e3, cd0db49 and ef86e19.

  1. Blocking: the fix is behind REFERENCE_SEARCH_OPTIONS_TOGGLE, off in every environment, so merging changes nothing. With it off, master's code runs. Rebuilding the 61 collection versions on master still empties them, and the date the toggle goes on waits for the data-step decision (OpenConceptLab/ocl_online#797).
  2. Retired content: kept, as references selected it before Jul 2025. The comment and the PR body are reworded, and the 25's numbers are split into active and retired.
  3. Cascade cost: 22 of the 25 cascade. Locally, a rebuild takes about 20 to 30 minutes for each of the three largest. The proposal is in the thread.
  4. Nit: with the toggle on, the description leaves the search options out. With it off, it reads as before.

The fixes had three Codex checks (5 findings, all fixed, then clean twice) and a simplification review (2 of 5 cuts applied).

Full gate on ef86e19: pylint 10.00; 814 search-index tests OK; the other 4,061 OK on a rerun; coverage 97%. The first run had one failure in a timing test in core.capacity, which this PR doesn't touch.

@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 ef86e19, against round 1 at 0be05b8. All four round-1 findings are fixed. One new nit, for the data step.

# Round 1 Status Commit
1 blocking: ships with nothing gating it (models.py:1363) fixed: behind REFERENCE_SEARCH_OPTIONS_TOGGLE, off everywhere e92e022, cd0db49
2 should fix: comment said "as that search lists it", retired content not split out (models.py:1256-1258) fixed: reworded, numbers split into active and retired e92e022
3 should fix: options-only references with cascade (models.py:1363) answered: 22 of 25 cascade, about 20 to 30 minutes per rebuild for the largest three locally; rebuild plan proposed thread reply
4 nit: description read the options as property matches (translators.py) fixed under the toggle, with a test b95a5e3, ef86e19

New findings

Severity Where Finding
nit core/collections/models.py:1295 With the toggle on, another spelling of exactMatch (ExactMatch) makes the reference select nothing, where master sets the entry aside. Count these in the #797 data step too.

Does merging change behaviour for existing users with the toggle off? No. I checked each changed path against master:

  • get_filter_clause_property: off, the options fall through to master's branches and are matched as fields. Adding exactMatch to SEARCH_MODIFIER_FILTER_PROPERTIES changes nothing off, since to_snake_case already makes it a modifier and get_filter_errors already knew it through the case-switch list.
  • q matching: off, _get_search_criterion_as_before is master's code line for line. The rewritten has_param_in_filter is only called on the toggle-on path.
  • _apply_filters: options alone return the whole version only with the toggle on; off, they reach the index search as on master.
  • Description: off, it reads as before.
  • Stored reference results, rebuilds and dry_run_rebuild all go through these, so they match master. Parsers are unchanged.
  • The only difference off is a small toggles query for references whose filter has a search option. A filter without one never reads the toggle (tested).

Toggle: read per call through Toggle.get, with no cache, like the other expansion toggles. That means ExpansionDryRun, which patches Toggle.get, can preview the 25 with this toggle on before the data step. The fixture row follows the file's pattern, is off in all six columns, and load_fixtures applies it on container start. Tests default to off (the fixture test checks this) and use a patch to turn it on or off.

Toggle-off tests: filter clauses, filter errors, q matching (including the exact query master builds), the description, and an options-only reference added to an expansion and rebuilt off, on and off again.

#1088: it copies the ungated version of this fix (get_search_modifier set aside with no toggle), so it needs to use this toggle too, or take this code after this PR merges.

Credit: the author checked the toggle-off tests against master's own code and showed they fail on 0be05b8. The pre-Jul 2025 history check, the active/retired split, the corrected concept total and the cascade timings are all theirs. Three Codex passes and a simplification pass went in before this round.

CI: Pylint, Tests and Snyk all pass on ef86e19.

What I could not verify: I ran no tests and made no staging or production queries, so I relied on CI and on the author's counts and timings. I did not run ExpansionDryRun with the toggle on.

is_modifier = bool(prop) and (
to_snake_case(prop) == 'exact_match' or prop in self.SEARCH_MODIFIER_FILTER_PROPERTIES)
if is_modifier and not self.get_search_modifier(prop) and self.is_search_options_on():
return False # another spelling of exactMatch (ExactMatch): only the two spellings count

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.

nit (for the #797 data step). With the toggle on, a filter entry spelled ExactMatch (or any spelling other than exactMatch and exact_match) now can't be applied, so its reference selects nothing and shows filter_not_applied. On master that entry is set aside and the rest of the filter still runs. That is consistent with the other options, so I wouldn't change the code.

Fix: when the data step counts references, also count ones with another spelling of exactMatch, since they would shrink when the toggle goes on. I expect zero.

paynejd added a commit that referenced this pull request Nov 30, 2026
… 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
paynejd added a commit that referenced this pull request Nov 30, 2026
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
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
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
paynejd added a commit that referenced this pull request Dec 1, 2026
…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
@snyaggarwal
snyaggarwal merged commit 08714ab into master Dec 2, 2026
3 checks passed
@snyaggarwal
snyaggarwal deleted the fhir-452-ref-modifiers branch December 2, 2026 12:46
paynejd added a commit that referenced this pull request Dec 2, 2026
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
Brings in #1089, #1109 and
#1106. The one conflict is the constants import in
core/collections/models.py, where both sides add a name: both are kept. The
toggles are master's, so REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every
environment. 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
…into fhir-452-b-apart

Takes #1087'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 2, 2026
…o fhir-452-c-storage

Takes #1090'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 2, 2026
…nto fhir-452-b-imports

Takes #1103's new head, which brings in master
(#1089, #1109 and
#1106): REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every
environment, as on master. The one conflict is the constants import in
core/collections/models.py, where both sides add names: all 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_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 2, 2026
…nto fhir-452-b-codes

Takes #1091's new head, which brings in master
(#1089, #1109 and
#1106): REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every
environment, as on master. The one conflict is an import line in
core/collections/models.py, next to one this branch changed: this branch's
is 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_01AaZ4qVQviVc1p6MQwqUUed
paynejd added a commit that referenced this pull request Dec 2, 2026
…o fhir-452-c-core

Takes #1094'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 2, 2026
… fhir-452-b9-valueset

Takes #1104'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 2, 2026
… into fhir-452-capabilities

Takes #1102'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 2, 2026
…d into fhir-452-stored-ops

Takes #1083'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 2, 2026
…into fhir-452-b-engine

Takes #1084'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 2, 2026
…to fhir-452-b-workspace

Takes #1095'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 2, 2026
… into fhir-452-b-expand

Takes #1096'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 2, 2026
…to fhir-452-b-validate

Takes #1097'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 2, 2026
…into fhir-452-b-ops

Takes #1098'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 2, 2026
…fhir-452-c-fhir

Takes #1099'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
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