Repository navigation
fix(flow): refuse queried non-searchset bundles in bundle() as complete reads - #2163
Open
yunusarda-sudo wants to merge 1 commit into
Conversation
…te reads (OpenAdaptAI#2108) Signed-off-by: Yunus Ardaguney <yunusarda-sudo@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2108.
Context & Problem
In #2098, the FHIR collection reader was updated to refuse queried
collectionbundles as complete reads (verifying that no query is present across configured parameters, requested and effective URLs, and self-links).However, as reported in #2108, the sibling reader in
openadapt_flow/ensure_record.py(FhirReader.bundle()) still accepted any non-searchset bundle without anextlink as complete even when query parameters were sent or present on the URL/self-link, allowing a capped or filtered read to count as a full read.Solution
openadapt_flow/fhir_read.py: Exportcheck_collection_url(aliasing_check_collection_urlfor backwards compatibility).openadapt_flow/ensure_record.py(FhirReader.bundle):initial_urland unpackheadersfromfetch.searchsetorhistorybundle and has nonextlink (if not nxt), apply the collection refusal rule:paramsare present.initial_urlcontains a query.Content-LocationorLocationheader) contains a query.relation: "self"link contains a query.Unreadable(f"{path}: {exc}")on any violation.packages/flow/tests/test_ensure_record.py:test_bundle_refuses_parameterized_non_searchset_bundlecovering configured params, query in path, query in self-link, query in effective URL (content-location), unqueried collection acceptance, and normal parameterized searchset pagination/coverage.Verification
PYTHONPATH=packages/flow pytest packages/flow/tests/test_ensure_record.py -q: 112/112 passed.PYTHONPATH=packages/flow pytest packages/flow/tests/test_page_snapshot_consistency.py -q: 82/82 passed.ruff checkandruff format --check: clean.