Repository navigation
Ignixa L3: Native persistence writes - #6076
Draft
Brendan Kowitz (brendankowitz) wants to merge 31 commits into
Draft
Brendan Kowitz (brendankowitz) wants to merge 31 commits into
Brendan Kowitz (brendankowitz) wants to merge 31 commits into
Conversation
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the Firely dateTime lexical shape before truncating date fields. Preserve nonmatching literals in the native node. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6076 +/- ##
==========================================
+ Coverage 81.64% 82.38% +0.73%
==========================================
Files 1036 1038 +2
Lines 40462 40833 +371
Branches 6607 6726 +119
==========================================
+ Hits 33037 33640 +603
+ Misses 5877 5627 -250
- Partials 1548 1566 +18 🚀 New features to boost your workflow:
|
Use inline Element metadata before an explicit companion at the same slot. Preserve literal whitespace and reject empty required-binding codes. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Validate trimmed codes against the versioned Firely enum metadata. Select primitive metadata before validation and retain the same slots for both arrays. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compare acceptance and stored JSON through both Ignixa import paths. Pin the ExampleScenario discriminator difference without weakening the rest of the comparison. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Strip ASCII base64 whitespace during native emission. Compare base64 fixture literals directly and keep the explicit ExampleScenario exception. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use Firely model metadata from the host, validate base64 and numeric literals before writing, and align primitive companions. Exercise both Ignixa import paths against the four versioned corpora. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pin both sides of the textual whitespace exception. Require matching decimal scale when neither writer uses exponent notation. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain fixture timestamps for incremental writes that compare full output. Run import tests that still replace ClockResolver.TimeProvider in one nonparallel xUnit collection. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use an explicit version-specific model provider so prior tests cannot replace the indexer context through global model state. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 task
Restore the original provider when vector tests finish. Select import payloads and embedded fixtures for the test assembly FHIR version, not the global provider. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Register one raw resource factory for PersistenceWrite. Share the Ignixa schema context with import and retain the Firely writer for non-native carriers. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
|
||
| public void WriteObject(JsonObject node, IType type, string path, bool root = false, bool editVersion = false) | ||
| { | ||
| bool resource = root || type.Info.Name is "Resource" or "DomainResource"; |
| } | ||
| else | ||
| { | ||
| Output.Append(metadataWriter.Output, slot.MetadataStart, slot.MetadataLength); |
Comment on lines
+527
to
+534
| foreach (ITypeReference candidate in metadata.Types) | ||
| { | ||
| string code = candidate.Code; | ||
| if (suffix.Length == code.Length && suffix[0] == char.ToUpperInvariant(code[0]) && suffix[1..].SequenceEqual(code.AsSpan(1))) | ||
| { | ||
| return (metadata, schema.GetTypeDefinition(code)); | ||
| } | ||
| } |
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the Firely delegate private and verify that it writes the same bytes for Firely carriers. Fail host startup if the selected writer cannot activate. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Activate the selected persistence writer in a hosted service owned by PersistenceModule. Keep the provider logger independent of writer construction. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reject conflicting singleton choice arms and unreadable temporal values before persistence. Emit root Meta version and timestamp before metadata children without changing nested Meta. Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs AB#198707 Agent: Kestrel Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines
+121
to
+122
| if ((root && name is "resourceType" or "id" or "_id" or "meta") | ||
| || ((removeVersion || replaceVersion) && name is "versionId" or "_versionId")) |
Comment on lines
+112
to
+117
| if ((nativeError is not null && (nativeError is not FormatException || !nativeError.Message.Contains(path, StringComparison.Ordinal))) | ||
| || nativeReadError is not null | ||
| || mixedReadable != nativeReadable | ||
| || unreadableTemporal != (mixedReadError is not null) | ||
| || (unreadableTemporal && mixedReadError is not StructuralTypeException) | ||
| || (mixedReadable && !JsonNode.DeepEquals(JsonNode.Parse(mixed.Data), JsonNode.Parse(native.Data)))) |
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.
Description
This draft includes Tasks 1–5 of AB#198707: the
PersistenceWriteseam and startup diagnostics, the native Ignixa import carrier and date coercion, the Firely-compatible native JSON writer, startup registration and activation, and SQL import integration evidence. No schema or native read changes; native Cosmos validation is out of scope.Enable: Set
FhirServer:CoreFeatures:FhirSdkProvider:PersistenceWritetoIgnixaand restart. If unset, it inheritsSystemDefault, which defaults toFirely. Roll back: Explicitly setPersistenceWritetoFirelyand restart; other seams are unchanged. The startup log reports the selected writer, and host startup fails if the writer cannot be constructed.The baseline is Ignixa import + Firely write (IF): Ignixa import + native write (II) must accept and store equivalent JSON for lines IF accepts, subject to the exceptions below. The writer emits directly from the native node without round-tripping through a Firely POCO or post-processing serialized JSON. It delegates non-native carriers to Firely before writing and never retries a failed native write with Firely.
string,markdown, andxhtml. Outside the existingMeta.lastUpdatednormalization, II preserves readable instant spellings, including partial or offset-less forms that Firely accepts and IF may normalize. Firely readability alone does not make those spellings conformant FHIR instants.System.Decimalprecision that IF rounds or underflows. Values that neither can store are rejected visibly.ExampleScenario.instance[].resourceTypevalues that IF drops.date,dateTime,instant, andtimeagainst Firely read behavior. It rejects malformed instants as IF does and reports a per-line error for malformed dates, date-times, and times that IF can write but the production Firely deserializer cannot read. Readable input spellings are preserved subject to existing import normalization.meta.versionIdandmeta.lastUpdatedscalars before all other root Meta children. This makes the current SQL first-match rewrite target the root rather than an earlier distinct nested value inside rootmeta(for example undermeta.extensionor_source.extension). It does not cover Meta that serializes before rootmeta, such as_id.extension[].valueMeta. Firely writes that shape first too (FF, IF and II alike), so it is inherited behavior. Like document-wide replacement of an equal nested value, it belongs to the open root-scoped SQL meta gate. No production SQL changed.AB#206675 follow-ups: invalid choices such as R4
Observation.valueCode(II rejects; IF can write unreadable output); singleton arrays on non-collection primitives andmeta; null primitive array slots with scalar companions;_photoon a complex element;Extension.urledge whitespace; and Unicode edge whitespace on base64. Malformed rootmetaormeta.lastUpdatedreplacement is pre-existing and out of scope.Open merge gates: AB#206675 (2.1, including its separate corpus) and AB#206676 (2.2 equality) must merge; SQL metadata edits must be scoped to the root; the isolated write performance comparison remains outstanding. This PR stays draft.
Related issues
Refs AB#198707. ADR-2608 defines provider selection.
Testing
Validation at
79771103732bfbb422659ff2a3adb837bd5da647(passed / failed / skipped):FhirSdkProviderConfiguration,PersistenceModuleBundleHandlerTests; the affected class passed 51 / 0 / 0 on isolated rerun.IgnixaImportResourceParser,ModelExtensions,IgnixaRawResourceFactory,FirelyCompatibleResourceJsonWriterResourceDeserializerfor both IF and II.uuidhas no representative schema element.SqlServerImporterIntegrationTests_source.extensionandmeta.extensionstay unchanged. SQL corpus evidence uses four accepted and two rejected parity fixtures, not the separate 2.1 corpus.Four SQL cases are skipped:
GivenReorderedPropertiesWithSameVersion_WhenReimported_ThenSucceedsWithoutNewVersionGivenFirelyWrittenResource_WhenReimportedWithIgnixaNativeWrites_ThenNoSpuriousVersionGivenIgnixaWrittenResource_WhenReimportedWithFirely_ThenNoSpuriousVersionGivenContainedMetaBeforeRootMeta_WhenStoreRewritesRootMeta_ThenOnlyRootMetaChanges(equal-value row only)The PR pipeline's Run R4 SQL vNext SDK Tests (
testR4SqlVNext) and Run Stu3 SQL vNext SDK Tests (testStu3SqlVNext) setSystemDefault=Ignixa, so existing import E2E tests inherit the native writer. CI results for this head are not yet verified.FHIR Team Checklist
Semver Change (docs)
Feature. Adds a configurable SDK seam; no schema change.