[FEAT]: Canonical versioned trace/result serializer (WS0-05 PR 1) - #185
Draft
Nina Chikanov (nina-msft) wants to merge 5 commits into
Draft
[FEAT]: Canonical versioned trace/result serializer (WS0-05 PR 1)#185Nina Chikanov (nina-msft) wants to merge 5 commits into
Nina Chikanov (nina-msft) wants to merge 5 commits into
Conversation
Introduce rampart/core/serialization.py as the single, neutral full-fidelity Result <-> dict round-trip (Decision D6 gate). Every record carries a single root version (rampart.trace.v1) and decoding dispatches on it, failing closed on an unknown major. The canonical layer defines the supported value domain only: enums encode to .value and fail closed on unknown values, harm_category is a passthrough string, floats must be finite, and free-form maps must be JSON-safe. Transport hygiene (ANSI stripping, float normalization, repr() fallback, size caps) stays at the xdist boundary and is not duplicated here. Binary payloads fail closed pending the WS7 artifact resolver rather than being coerced to text. Also lands the written migration policy (docs/concepts/trace-schema.md): additive-optional = no bump, structural = major bump, missing = not recorded, readers fail closed on unknown major, with named reserved additive slots so WS8 provenance needs no hard migration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Describe only the canonical serializer behavior present on this branch, express later migration and consumer work as policy constraints, generalize future additions outside the reserved collar fields, and remove the ship gate. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove planning references, place constant comments before declarations, drop the unused identity origin field, and make unsupported binary payload messages independent of planned work. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove identity and case_id until their producer is implemented, keep the existing pytest attribution fields optional, and make the reserved metadata constant private. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fail closed on malformed collection fields, incomplete population references, and non-string harm categories. Validate result indices before serialization so the encoder cannot emit boolean indices rejected by the decoder. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
WS0-05 — PR 1: Canonical versioned trace/result serializer
First PR of the WS0-05 execution plan. This is a pure addition: existing consumers are not rewired here.
What this lands
rampart/core/serialization.py— the neutral, full-fidelityResult⇄dictround-trip. Its public surface isResultRecord.to_dict()/from_dict()plusserialize_result()/deserialize_result()wrappers.rampart.trace.v1stamped on every record. Decoding dispatches through a version registry and fails closed on an unsupported major.pytest_nodeidandresult_index. They are omitted when not recorded; stable identity fields are deferred until their producer exists..valueand fail closed on unsupported values;harm_categoryremains a passthrough string; floats must be finite; free-form mappings must be JSON-safe. Reserved transport bookkeeping keys are stripped from the canonical body.rampart.trace.v1, rather than being coerced toPayloadFormat.TEXT.PopulationRef.docs/concepts/trace-schema.md: additive optional fields do not require a bump; structural changes require a new major; absence means not recorded; and future reserved collar fields are named.Tests
tests/unit/core/test_serialization.pycovers round-tripping, field exhaustiveness viadataclasses.fields(), version dispatch, additive tolerance, missing-field defaults, the supported value domain, attribution, and binary-payload rejection.Still to do in this draft
trace.v1.schema.jsonfrom encoder output and add a drift gate.