Skip to content

refactor(cms)!: ASAPv1 only — drop proto, portable and native formats - #168

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

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

Conversation

@GordonYuanyc

Copy link
Copy Markdown
Collaborator

Part of the ASAPv1-only series: one PR per sketch group, each off main. This one removes Count-Min's protobuf, portable msgpack and native-shim formats; ASAPv1 (0x02 0x00) is the only Count-Min format left. Count-Min-with-heap is a separate PR.

Draft because of the open questions below.

Removed

  • Proto: CountMinDelta, CountMinCell; SketchEnvelope.count_min (10) is now reserved 10; reserved "count_min";. CountMinState stays because hydra.proto and elasticsketch.proto embed it; it goes with those PRs or the final cleanup.
  • message_pack_format::portable::countminsketch: CountMinSketch, CountMinSketchDelta, CountMinSketchWire, SketchlibCms and the sketchlib_cms_* / new_sketchlib_cms / matrix_from_sketchlib_cms helpers, the proto and msgpack delta codecs, aggregate_count, from_legacy_matrix; crate-root re-exports CountMinSketch, CountMinSketchDelta.
  • message_pack_format::native::countminsketch.
  • src/sketches/testdata/cms_envelope_golden.hex and the tests that only exercised the removed formats.

Kept / ported

  • The two ASAPv1 goldens (cms_i64_regular_2x3, cms_f64_fast_2x3) are checked through native CountMin.
  • The 19 Count-Min property laws now run on CountMin<Vector2D<f64>, FastPath> with the ASAPv1 round trip (mutation-checked).
  • New cm_f64_fast_path_places_keys_in_go_cells keeps the check that Rust's fast-path f64 CountMin puts the flow-* keys in the same cells as Go (cells taken from the deleted proto golden).

Open questions

Production (ASAPCollector Go → ASAPQuery-backend) uses three things ASAPv1 has no carrier for:

  1. Deltas: bare CountMinDelta frames, including the hh_keys heavy-hitter channel.
  2. sample_p: the envelope-level sample rate used to rescale sampled CMS.
  3. Silent decode: proto3 skips the now-reserved field 10, so an old Go envelope decodes with sketch_state == None and no error.

Options: design ASAPv1 delta / sampling metadata first, or land this as a hard cut together with a coordinated collector/backend change.

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; --lib, --doc, and filtered asapv1_golden, pbt -- count_min::, e2e -- frequency::, msgpack_compat, sketches_go_parity_probe, xtest_consumer (against the real Go producer). 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 00:42
CountMin serializes to ASAPv1 only. Removes the CountMinDelta and
CountMinCell proto messages and SketchEnvelope's count_min field (10,
now reserved), portable::countminsketch (CountMinSketch,
CountMinSketchDelta, CountMinSketchWire, SketchlibCms and the
sketchlib_cms_* helpers), the native MessagePackCodec shim for CountMin,
and the cms_envelope_golden.hex proto golden. CountMinState stays as the
nested Count-Min state of HydraCell and ElasticState.

The Count-Min property laws that ran through the portable type now run
on CountMin<Vector2D<f64>, FastPath> over string keys, with the ASAPv1
round trip and CountMin::apply_delta in the sequence law.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds cm_f64_fast_path_places_keys_in_go_cells: the 40 non-zero cells of
sketchlib-go's 4x2048 Count-Min after 50 inserts of flow-{i % 10}, listed
inline, reproduced by CountMin<Vector2D<f64>, FastPath, DefaultXxHasher>.
Records in the CHANGELOG that Count-Min deltas, hh_keys and the envelope
sample_p have no ASAPv1 carrier, and drops stale CountMin mentions from
the sample_p proto doc and xtest_consumer.

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