Skip to content

refactor(univmon)!: ASAPv1 only — drop the proto envelope field, add goldens - #176

Closed
GordonYuanyc wants to merge 2 commits into
mainfrom
asapv1-only/univmon
Closed

GordonYuanyc wants to merge 2 commits into
mainfrom
asapv1-only/univmon

Conversation

@GordonYuanyc

Copy link
Copy Markdown
Collaborator

Part of the ASAPv1-only series: one PR per sketch group, each off main. This one removes UnivMon from the protobuf envelope; ASAPv1 (0x10 0x00) is the only UnivMon format left, and it gets its first goldens.

Removed

  • SketchEnvelope.univmon (15) is now reserved 15; reserved "univmon"; (sketch_envelope::SketchState::Univmon is gone). proto/univmon/univmon.proto stays because hydra.proto's HydraCell embeds UnivMonState.
  • The UnivMon section of tests/xtest_consumer.rs and its helpers. UnivMon had no portable or native shim.

Added

  • Goldens on a 3-layer, 2x4, heap-5 pyramid (all dimensions distinct, so a swapped key or a wrongly sliced l2 fails), pushed to sketchlib-golden-bytes; submodule bumped:
    • univmon_str_l3_2x4_h5: string keys; layer 0 holds the Count Sketch golden's signed cells, so both its l2 values are uint64; an incomplete layer; total weight 70000 (standard mode).
    • univmon_i64_l3_2x4_h5: the same with i64 keys including i64::MIN, -129, 2^32.
    • univmon_empty_l3_2x4_h5: a fresh pyramid (key_type "u64").
    • Built through public setters (apply_delta, heap update, set_total_weight, mark_layer_candidates_incomplete); no hash reaches the bytes. Checked in both directions; the reviewer hand-decoded them against spec §3.15.
  • Spec §3.15: a pyramid with no heap entries emits key_type = "u64".
  • The ASAPv1 docs no longer state a fixture count; they defer to the golden README.

Notes

  • Terminal mode (update_mode 2) is only reachable through a hashed insert, so no golden covers it; the golden README says so.
  • ASAPQuery-backend already reads UnivMon as ASAPv1, so this PR does not affect it.

Verification (rustc 1.99)

cargo fmt --check; clippy -D warnings for all four CI feature sets; RUSTDOCFLAGS="-D warnings" cargo doc; gen-proto drift clean; asapv1_golden, xtest_consumer (against the Go producer), --lib -- univmon, pbt -- univmon. Implemented and reviewed by separate agents; review findings are addressed in the second commit.

🤖 Generated with Claude Code

GordonYuanyc and others added 2 commits October 2, 2026 01:00
UnivMon serializes only as ASAPv1 (kind_id 0x10 0x00).

- proto: reserve SketchEnvelope field 15 ("univmon"); UnivMonState and
  UnivMonLayer stay in univmon.proto because hydra.proto's HydraCell still
  embeds them. Regenerated src/proto/generated.
- tests/xtest_consumer.rs: drop the univmon.pb check and its g-sum helpers.
- asapv1_golden -> e2086f0: univmon_str_l2_2x4_h2, univmon_i64_l2_2x4_h2 and
  univmon_empty_l2_2x4_h2, built through L2HH::apply_delta and
  HHHeap::update (no hashing). tests/asapv1_golden.rs checks serialize ==
  golden, the hand-read metadata and payload, the decoded state and the
  re-encode.
- docs: fixture counts say seven kind_ids; features.md and tests.md follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e docs

- asapv1_golden -> 946e5c5: univmon_{str,i64,empty}_l3_2x4_h5 replace the
  l2_2x4_h2 files. 3 layers, 2 rows, 4 columns, heap 5, heap lengths
  [3, 1, 2]; i64 keys add int16 and uint64.
- Fixture docs point at the golden README's Coverage section instead of a
  count; spec 3.15 states the empty pyramid's key_type is "u64".
- features.md: SketchEnvelope's sketches, with UnivMonState only in HydraCell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GordonYuanyc

Copy link
Copy Markdown
Collaborator Author

Outdated. ASAPv1 encodings and goldens landed in #232 and #235 against the current spec; removing the legacy formats is redone on current main in #206 and #207.

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