Skip to content

docs: auto-update for PR #2974 — test(governance-types): golden discriminant tests for GroupOp and RootOp#2989

Closed
meroreviewer[bot] wants to merge 1 commit into
masterfrom
docs/auto-pr2974-f6e6bfc
Closed

docs: auto-update for PR #2974 — test(governance-types): golden discriminant tests for GroupOp and RootOp#2989
meroreviewer[bot] wants to merge 1 commit into
masterfrom
docs/auto-pr2974-f6e6bfc

Conversation

@meroreviewer

@meroreviewer meroreviewer Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Automatic Documentation Update

Opened automatically after PR #2974 merged.

Each block shows the documentation change as a diff (added lines in green, removed in red); expand "Why this changed" for the source rationale.

Documentation changes

architecture/local-governance.html — Add golden-byte discriminant tests for all GroupOp variants; Add golden-byte discriminant tests for all RootOp variants; Pin HybridTimestamp::zero() Borsh encoding as a named constant with a self-consistency test

 context/src/group_store/tests.rs
 Comprehensive group store tests including namespace identity, governance, key d…
+context/primitives/src/local_governance/golden_tests.rs (or inline in mod.rs)
+Golden-byte discriminant tests for GroupOp and RootOp/NamespaceOp, plus a self-
+consistency test for HybridTimestamp.
+26 frozen byte-vector constants (GOLDEN_GROUP_OP_NOOP …
+GOLDEN_GROUP_OP_CASCADE_UPGRADE) capture the Borsh encoding of every GroupOp
+variant using all-zeros / empty field data. group_op_discriminants_are_golden
+decodes each constant, asserts the decoded variant matches the expected variant,
+re-encodes and asserts the byte length matches (catching accidental trailing
+bytes), and accumulates all failures into a Vec<String> so every broken ordinal
+is reported in a single run.
+10 frozen byte-vector constants (GOLDEN_ROOT_OP_GROUP_CREATED …
+GOLDEN_ROOT_OP_NAMESPACE_CREATED) encode each RootOp variant wrapped as
+NamespaceOp::Root (byte[0]=0, byte[1]=RootOp ordinal).
+root_op_discriminants_are_golden decodes each constant as NamespaceOp, asserts
+it matches NamespaceOp::Root(<expected variant>), and checks re-encoded length,
+with the same accumulated-failure pattern.
+GOLDEN_HLC_ZERO (24 bytes) captures the Borsh encoding of
+HybridTimestamp::zero(). hlc_zero_golden_bytes_are_self_consistent asserts
+borsh::to_vec(&HybridTimestamp::zero()) == GOLDEN_HLC_ZERO and additionally
+asserts that the last 24 bytes of GOLDEN_GROUP_OP_CASCADE_UPGRADE equal
+GOLDEN_HLC_ZERO, preventing the two constants from drifting when
+HybridTimestamp's layout changes.
+Contributor rules enforced by these tests: adding a new GroupOp variant requires
+appending it at the end of the enum and adding a corresponding golden constant +
+check_group_op! invocation (inserting in the middle breaks the test); the same
+applies for new RootOp variants. If HybridTimestamp gains or loses fields, both
+GOLDEN_HLC_ZERO and GOLDEN_GROUP_OP_CASCADE_UPGRADE must be updated together.
 governance-store/src/namespace/tests.rs, governance-store/src/tests.rs
 New regression and unit tests for namespace genesis: replica_genesis_founder_su…
Why this changed (source: PR #2974)

26 frozen byte-vector constants (GOLDEN_GROUP_OP_NOOP through GOLDEN_GROUP_OP_CASCADE_UPGRADE) are defined using all-zeros/empty field data. A new test group_op_discriminants_are_golden decodes each constant with the current GroupOp enum and asserts the decoded value matches the expected variant. After a successful decode it also re-encodes and asserts the byte length matches, catching golden vectors with accidental trailing bytes. All failures are accumulated into a Vec so the test reports every broken ordinal in one run rather than stopping at the first panic.

10 frozen byte-vector constants (GOLDEN_ROOT_OP_GROUP_CREATED through GOLDEN_ROOT_OP_NAMESPACE_CREATED) are defined. Each is encoded as NamespaceOp::Root wrapping the given RootOp variant, so byte[0]=0 (NamespaceOp::Root discriminant) and byte[1]=RootOp ordinal. A new test root_op_discriminants_are_golden decodes each constant as NamespaceOp, asserts it matches NamespaceOp::Root(<expected variant>), and checks re-encoded length. Failures are accumulated identically to the GroupOp test.

A named constant GOLDEN_HLC_ZERO (24 bytes) captures the Borsh encoding of HybridTimestamp::zero(). A new test hlc_zero_golden_bytes_are_self_consistent asserts that borsh::to_vec(&HybridTimestamp::zero()) equals GOLDEN_HLC_ZERO, and additionally asserts that the last 24 bytes of GOLDEN_GROUP_OP_CASCADE_UPGRADE equal GOLDEN_HLC_ZERO, so the two constants cannot drift apart when HybridTimestamp's layout changes.


Generated by ai-reviewer update-docs. Nothing was auto-merged.

@meroreviewer meroreviewer Bot added automated-docs documentation Improvements or additions to documentation labels Jun 27, 2026

@meroreviewer meroreviewer Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Code Reviewer

Reviewed by 1 agents | Quality score: 85% | Review time: 135.5s


✅ No Issues Found

All agents reviewed the code and found no issues. LGTM! 🎉


🤖 Generated by AI Code Reviewer | Review ID: review-91d5d2eb

@chefsale chefsale closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-docs documentation Improvements or additions to documentation external

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant