Skip to content

fix(ack)!: make preserveBoundary a detached JSON-object wire view - #246

Merged
leoafarias merged 52 commits into
release/2.0from
fix/2.0-boundary-wire-view
Oct 27, 2026
Merged

leoafarias merged 52 commits into
release/2.0from
fix/2.0-boundary-wire-view

Conversation

@leoafarias

@leoafarias leoafarias commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Narrow Ack.preserveBoundary to JSON-object roots: preserveBoundary<R>(AckSchema<Map<String, Object?>, R>), with a non-generic BoundarySchema. The generated wireSchema getter type is unchanged.
  • Parse, runtime validation and encode return a detached, recursively unmodifiable copy of the input map. The inner parse always runs as a parse operation; no encoder runs. This removes three defects at the stack tip: jsonDecode list/map roots were re-encoded through codecs and came back changed, encode accepted values parse rejected, and the wire view returned the caller's mutable map.
  • Generator: infer provably native-JSON Ack.anyOf fields directly as JSON values, so an explicit wire view is no longer needed for heterogeneous JSON fields. Branches are rejected by static type when they decode (codec, enum, instance) or when their declared runtime type is not JSON. Ack.any, Ack.anyOf and Ack.map roots behind type-erased aliases are rejected through a root flag. Numbers in preserved maps infer as num, because wire values are no longer normalised.
  • Exporter: emit the not-null allOf restriction only while null is still reachable in the exported inner model.
  • Docs: wireSchema is a validating JSON wire view, not a raw structural schema. Breaking and Fixed entries added under 2.0.0-alpha.2 in both CHANGELOGs.

PR #228's null-policy design is kept unchanged.

Validation

  • dart test in packages/ack: 2147 passed.
  • dart run melos run test:gen --no-select: 762 passed.
  • Analysis: 6 packages, no issues. Formatting: 302 files, 0 changed.
  • Deterministic generation: regenerated .g.dart files, no diff.
  • dart scripts/api_check.dart 1.7.0 --allow-additive: exit 0. The report lists the preserveBoundary and BoundarySchema changes under breaking changes, allowed by the 2.0 major bump.
  • Each fix has a test that fails on the base and passes here.
  • Independent design review and two code-review passes preceded this PR.

Integration

This is the breaking layer of the 2.0.0-alpha.2 stack. It targets release/2.0 after #228–#245 merged; the chore(stack): merge updated parent branch commit joins that base so this diff shows only this layer. Breaking relative to published 2.0.0-alpha.1 for the preserveBoundary signature and for generated number field types inside preserved maps. Follow-up outside this repo: Stargate's two handwritten preserveBoundary wrappers in human_interaction.dart become unnecessary once pinned to this change.

Base automatically changed from fix/2.0-alias-capture-names to release/2.0 October 27, 2026 13:17
@leoafarias
leoafarias marked this pull request as ready for review October 27, 2026 13:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T13:58:07.900868Z f6bff04 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@leoafarias
leoafarias merged commit ee4e03a into release/2.0 Oct 27, 2026
8 checks passed
@leoafarias
leoafarias deleted the fix/2.0-boundary-wire-view branch October 27, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant