Repository navigation
API verification: declared empty search shape, and the 50-plant rerun on Medplum and Gitea - #2525
Conversation
…plants per class - missing-evidence class, kept: a marker search without its items field is still an error, unless it reports total 0 or matches the pack's new search_empty shape. Medplum's empty search Bundle leaves entry out, which made #2437's rule fail closed on every create; its pack now declares search_empty: {path: resourceType, equals: Bundle}. - the Medplum lab's compose raises the per-user FHIR quota and rate limit (loopback lab only); audit-log reads spent the default within seconds. - rerun on Medplum 5.2.8 and Gitea 1.24.6 with 400 clean writes and 50 plants per class: 0 clean stops on each; every log-exposed fault 50 of 50 stopped; known misses reported as misses (Gitea title edits the feed doesn't record, 0 of 50; another caller's change, 0 of 50 on each); Stripe not run (no test-mode key).
search_empty counts only when the answer reports no total or total 0; a Bundle that says it matched something but carries no entries is partial and raises.
Independent adversarial review: REQUEST CHANGESFrom: Gemini Gemini run on 5680f81 ( The documentation updates accurately reflect the benchmark results without overclaiming. The 100 stopped collateral changes on Gitea correspond to two fault classes (comments and close/reopen events) with 50 plants each, which aligns perfectly with "50 of 50 per class," and the known misses are correctly disclosed. However, the implementation of
|
…tial Missing-evidence class: any search answer whose total is above zero but that yields no usable record raises, whether the items field is missing or present and empty.
Independent adversarial review: REQUEST CHANGESFrom: Gemini Gemini run on 9230ef4 ( An analysis of the delta and the resulting When a server returns a response like This violates the premise of the commit ("a Bundle that says it matched something but carries no entries is partial and raises") and results in a fail-open where existing records are missed because the
|
Independent adversarial review: REQUEST CHANGESFrom: Claude Two independent reviewers (fail-open lens, correctness and tests lens) probed this head. Both found the same blocker. Blocker (fail-open): the "reports matches it did not return" guard in
Should fix in the same pass:
Not blocking: a |
… shape; bench-only quota override Review round 1 on #2525, missing-evidence class: - a search that returns items without a usable id raises (never reads as absent), and every item counts toward a duplicate; - a total that isn't a non-negative int raises; an answer reporting matches it doesn't return raises; an items field that isn't a list raises; - search_empty is now {equals: {...}, absent: [...]}: Medplum's pack needs resourceType Bundle, type searchset and no next link; a pack with search_empty but no search_items is refused at load. - the Medplum quota raise moves from the shared fhir_medplum compose file into benchmark/api_scoped/medplum.compose.override.yml, layered by this bench only; other Medplum benches keep the defaults. Pack-shaped tests for each case; a 40-write smoke on real Medplum passed with the new rules (0 stops, every planted fault stopped).
…artifact inventory
|
Round-1 items from the independent Claude review (comment 7075918800) are fixed at
A 40-write smoke on real Medplum passes with the stricter rules: 0 stops, every planted fault stopped. That confirms the declared empty shape matches Medplum's real empty answer. The OperationOutcome-as-match item is filed as #2526. |
Independent adversarial review: REQUEST CHANGESFrom: Claude Round 2. Two independent reviewers probed Confirmed fixed:
Blocking: the guards are still piecemeal, and each remaining hole is a shape that skips them.
Suggested single fix, which covers this whole class instead of adding more guards: when a pack declares a search shape, parse every answer strictly against it, closed by default.
Then add a mutation test: remove each clause and check that a test fails. |
Replaces the piecemeal guards (review round 2 on #2525, missing-evidence class). A declared search_empty shape is checked on every answer; every step of search_items must resolve (a * step needs a list, each element one object, no null or missing step); every record needs a non-empty str or a non-bool int id; a total, when present, must be an int equal to the records returned; the items field may be absent only on total 0 or, with a declared shape, an answer matching it. Each of the 11 clauses is tagged in source and a mutation test removes each one in turn and checks its refusal stops.
400 clean writes and 50 plants per class on Medplum 5.2.8 at the final code: 0 clean stops; every log-exposed fault 50 of 50; another caller's change 0 of 50 (known miss); retries 50/50. RESULTS.md records which commit produced each results file.
|
Round-2 items (independent Claude review at One strict parser instead of guards (
|
Independent adversarial review: REQUEST CHANGESFrom: Claude Round 3. Two independent reviewers re-probed every round-1 and round-2 scenario at this head, and every one now raises.
Two narrow holes remain, both outside the tagged clauses:
Not blocking, carried over: an OperationOutcome |
…st requires acceptance Review round 3 on #2525, missing-evidence class: - after a * fan-out each element is one record: entry:[{resource:[]}] and a resource list no longer flatten into zero or several records (they raise as items without a usable id); the guard is tagged no-flatten-after-fanout. - a name[key=value] absent path resolves strictly: a present parent that isn't a list of objects with string keys raises; the value matches without regard to case. - every tagged clause is now the only check for its probe, and the mutation test requires the probe to be accepted (return ids, no exception) once its clause alone is removed.
|
Round-3 items (independent Claude review at
The Medplum pack is unchanged, so this needed no live rerun. test_txplan_scoped.py and test_txplan.py pass (68). |
Independent adversarial review: APPROVEFrom: Claude This is the final check, diffed against round 3 (0bacd22). I probed Round-3 items, all fixed:
Dropped checks: the two dropped clauses are object-answer and leaf-object. The inputs they caught now raise from other clauses:
All 59 scenarios from rounds 1-3 still raise. No regressions:
Tests: Non-blocking:
|
Reruns resource-scoped API verification (#2437) on Medplum 5.2.8 and Gitea 1.24.6. Each system gets 400 clean writes and 50 plants per fault class, with synthetic data on loopback containers. It also fixes a fail-closed break the rerun found on main.
The fix
Since #2437, a marker search whose answer lacks its items field is an error, not an empty result. That rule is a fail-open fix, and it stays. But Medplum answers an empty search with a Bundle that leaves
entryout, so on main every Medplum create now fails its pre-send marker search.search_empty(ScopedCollection) declares what an empty answer looks like. Medplum's pack sets{path: resourceType, equals: Bundle}. Any other answer missing its items field is still an error, including anOperationOutcome.test_txplan_scoped.py, and the setting is documented in API_VERIFICATION.md.Results (22 November 2026)
The two missed classes are known misses outside the check's scope, which is the resource and the credentials it holds. Every planted fault landed, and the server accepted every side write.
Stripe was not run: no Stripe test-mode key is available, and live keys are never used.
RESULTS.md, CAPABILITIES.md and llms-full.txt are updated. The raw rows are in
benchmark/api_scoped/results/. Ran headless on a local Docker host.