fix(sof): align $viewdefinition-run with v2 spec error & body shapes#114
Merged
Conversation
Three spec-compliance items from the v2 OperationDefinition audit (`crates/sof/docs/spec-inconsistencies.md`): 1. Absent `patient` / `group` references are now `400 Bad Request` with an `OperationOutcome`, per the spec's error table — the previous "200 OK + Warning: 199 header" path is gone. New `SofError::ReferencedResourceNotFound` carries the absence; the filter in `filter_resources_by_patient_and_group` returns Err instead of an outcome wrapper, dropping `PatientGroupFilterOutcome`. 2. `sof-server` now accepts a bare `ViewDefinition` body as an alternative to a `Parameters` wrapper (the HFS REST handler already did). Other operation parameters must come from the query string in that shape. 3. The HFS REST system-level route at `/$viewdefinition-run` was already wired (verified during audit) — capability output and docs continue to advertise it. Updates the see-also section of `spec-inconsistencies.md` to record item #1 as a resolved deviation and notes the bare-ViewDefinition shortcut as a deliberate-but-spec-silent convenience.
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.
Summary
Three spec-compliance fixes for SQL-on-FHIR
$viewdefinition-run, surfaced by an audit of the v2 OperationDefinition against both binaries (sof-serverand HFS REST):patient/group→400 Bad Request+OperationOutcome. Spec's error table is explicit (Referenced patient/group not found (400)). The previous "200 OK +Warning: 199 - "..."HTTP header" path is retired. Carrier: newSofError::ReferencedResourceNotFound; the filter returnsErrinstead of aPatientGroupFilterOutcome { resources, warnings }wrapper, which is removed.ViewDefinitionbody. Matches HFS REST. Other operation parameters (filters,_format,_limit,_since,header) must come from the query string when using this shape./\$viewdefinition-runroute on HFS REST was already registered (verified during the audit). No code change needed — confirmed bytest_run_view_definition_system_level_route.crates/sof/docs/spec-inconsistencies.mdis updated: see-also drops the absent-target deviation, adds a note on the bare-VD shortcut, and a new "Resolved spec deviations" section records what closed.Test plan
cargo fmt --allcargo clippy -p helios-sof -p helios-rest --all-targets --features R4 -- -D warnings ...(CI flags) — cleancargo test -p helios-sof --features R4— all suites pass (incl. newtest_run_view_definition_bare_body, updatedtest_filter_with_unresolvable_group_returns_bad_request)cargo test -p helios-rest --features R4— all 31 sof_run tests pass (incl. updatedtest_inline_run_rejects_absent_patient_target_with_400)