Skip to content

refactor(coco)!: ASAPv1 only — drop the proto format, add a golden - #172

Closed
GordonYuanyc wants to merge 3 commits into
mainfrom
asapv1-only/coco
Closed

GordonYuanyc wants to merge 3 commits into
mainfrom
asapv1-only/coco

Conversation

@GordonYuanyc

Copy link
Copy Markdown
Collaborator

Part of the ASAPv1-only series: one PR per sketch group, each off main. This one removes CocoSketch's protobuf format; ASAPv1 (0x0c 0x00) is the only Coco format left, and it gets its first golden.

Removed

  • proto/cocosketch/cocosketch.proto (CocoSketchState) and its tools/gen-proto entry; SketchEnvelope.coco (17) is now reserved 17; reserved "coco";.
  • The Coco section of tests/xtest_consumer.rs and its helpers. Coco had no portable or native shim.

Added

  • Golden coco_3x7 (pushed to sketchlib-golden-bytes; submodule bumped): 15 of 21 buckets set directly; nil buckets, the empty key, a 31-byte fixstr / 32-byte str8 key, 2-, 3- and 4-byte UTF-8 keys, every uint width up to u64::MAX, and an occupied bucket holding 0. Checked in both directions.
    • The width is 7, not a power of two, so the fixture pins the spec's % cols fold: 11 of the 15 keys sit in odd columns, which a mask fold cannot produce (verified by swapping the fold to a mask and watching the test fail).
    • Coco's decoder checks each key's placement against its hash (spec §3.12), so this is the one fixture whose decode depends on the hash function; the golden README says so.
  • The ASAPv1 docs no longer state a fixture count; they defer to the golden README.

Notes

  • Coco's RNG seed and state stay out of the payload.
  • For sketchlib-go: decoding this golden requires Go's Coco to store full keys and use per-row seed_list[r] with % cols instead of one seed with a mask, i.e. an algorithm change, not just a codec.
  • Out of scope, existing code: coco.rs / coco/wire.rs compute hash as usize % cols, which differs from the spec's 64-bit % cols on 32-bit targets when cols is not a power of two.

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, --lib -- coco, pbt -- coco, xtest_consumer. The reviewer hand-decoded the golden and re-checked placement with an independent xxh3 program. Implemented and reviewed by separate agents; review findings are addressed in the third commit.

🤖 Generated with Claude Code

GordonYuanyc and others added 3 commits October 2, 2026 00:59
Delete proto/cocosketch/cocosketch.proto (CocoSketchState), reserve the
SketchEnvelope oneof field 17 ("coco"), regenerate, and remove the Coco
section of the cross-language proto consumer. Coco serializes only as ASAPv1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump asapv1_golden to the commit adding coco_3x8.hex, a 3x8 bucket table set
directly: values at both ends of every msgpack uint width, empty, 31-byte,
32-byte and multi-byte UTF-8 keys, and unoccupied buckets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to the golden README

A width that is not a power of two separates the spec's % cols fold from a
mask fold. The fixture adds a 4-byte UTF-8 key. Docs no longer state how many
kind_ids have fixtures; they point at the golden README's Coverage section.

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