Skip to content

feat: share repeated projection material in application contracts - #249

Merged
patrickleet merged 3 commits into
v5from
feat/compact-historical-projection-selectors-20260912
Sep 12, 2026
Merged

patrickleet merged 3 commits into
v5from
feat/compact-historical-projection-selectors-20260912

Conversation

@patrickleet

Copy link
Copy Markdown
Collaborator

Applications retaining several generations of event selectors repeat identical operation lists and body schemas for every projection arm. Forge's complete typed manifest crosses the existing 4 MiB cap even though the authoring DSL already shares mutations.

Emit shared_projection_program_v1 in modeled application-contract data only when it is smaller than the expanded form. Canonical tables share complete operation arrays and exact schema strings; every arm ID, selector identity/version, expression, ordering and effect is retained. expand_projection_program_contract accepts both encodings and reconstructs the original JSON. Validation rejects invalid references, ambiguous inline data, noncanonical/unused table entries and excessive expansion before cloning shared values.

Runtime projection IR, program/binding IDs, execution and client projection-program exports remain unchanged. Old expanded artifacts remain readable and byte-stable. Newly shared Surface artifact fingerprints change deterministically; rebuild service/client artifacts together. The complete wire cap stays 4,194,304 bytes and each opaque value/expanded program remains bounded at 1 MiB.

Forge validation at 7cc8f71b6a494da30f785b4933add6d6d853be73, using a Cargo dependency override with no Forge edits:

Complete artifact Bytes
Losslessly expanded equivalent 4,234,915
Compact canonical manifest 3,225,789
Saved 1,009,126

The expanded equivalent contains exactly the same decoded program data; Rust JSON serialization measured both sizes without numeric conversion. Both previously failing full/authorized-content manifest tests now pass.

Validation:

  • cargo test --all-features --lib: 1,080 passed, 4 ignored.
  • Application composition/plans integration: 35 passed.
  • Full distributed_cli suite: 293 passed, 11 ignored; explicitly enabled CLI manifest integration: 6 passed.
  • Forge GraphQL suite: 43 passed, 4 ignored.
  • Forge projections suite: 42 passed, including retained v2/v3 events and current/retained lifecycle equivalence.
  • Five new tests cover exact 32-selector round trips, stable expanded encoding, full-manifest size/fingerprints, malformed references and bounded expansion.
  • Changed Rust formatting and git diff --check pass.

Stacked on #248; the change introduces no historical-selector omission, replay exemption, Forge workaround or cap increase.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a041d35d-167e-420c-807b-34e8a3db8977

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@patrickleet
patrickleet changed the base branch from fix/surface-contract-unsigned-integer-20260912 to v5 September 12, 2026 18:04
Refs [[unsigned-surface-metadata-breaks-canonical-typed-m]]
Refs [[tasks/compact-historical-projection-contracts]]
@patrickleet
patrickleet force-pushed the feat/compact-historical-projection-selectors-20260912 branch from 58457c7 to a00aae0 Compare September 12, 2026 20:55
Implements [[incidents/distributed-pr249-refresh-continuity-20260912]]
@patrickleet
patrickleet merged commit f79cdb0 into v5 Sep 12, 2026
38 of 39 checks passed
@patrickleet
patrickleet deleted the feat/compact-historical-projection-selectors-20260912 branch September 12, 2026 22:28
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