Skip to content

Correct self-referencing binary notation specification - #52

Merged
konard merged 3 commits into
mainfrom
issue-51-da669128bb7c
Oct 7, 2026
Merged

konard merged 3 commits into
mainfrom
issue-51-da669128bb7c

Conversation

@konard

@konard konard commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

The specification described (5: 5 5) as the two-byte body 0F 05, while both codecs encode 0F 05 05. Correct the example to 3 binary bytes versus 8 text bytes (62.5% reduction) and clarify the field order: HAS_ID adds an explicit ID; SELF_REF omits the target while retaining the source.

This takes the documentation-correction option in #51. A link such as (7: 5 5) still needs both the explicit ID and shared reference, so the version 1.0 wire format remains unchanged. The specification revision is 1.0.1. JavaScript and Rust release fragments prepare patch releases.

The first CI run also exposed existing Clippy failures on the current stable toolchain (Rust 1.99). A separate follow-up commit replaces equivalent helper expressions, makes binary magic detection const, and documents two lint exceptions. Async methods retain deferred execution, and emptiness assertions remain usable for collections whose elements do not implement PartialEq.

Reproduce the original discrepancy from the repository root:

node --input-type=module -e "import { BinaryNotation, HEADER_SIZE } from './js/src/protocol/binary-notation.js'; console.log(Buffer.from(BinaryNotation.encode({ id: 5, source: 5, target: 5 }).slice(HEADER_SIZE + 1)).toString('hex'));"

This prints 0f0505. New tests read the specification's example and compare its bytes to each codec. Before the correction, these fail with actual [15, 5, 5] versus documented [15, 5]; JavaScript also catches the incorrect text and body sizes. After the correction, they pass. Exact wire vectors cover equal and differing IDs, multi-byte IDs, and no explicit ID, checking encoding, decoding, and size calculation.

Validation:

  • npm test: 915 passed.
  • npm run check: ESLint, Prettier, and duplication checks passed.
  • bun test: 914 passed.
  • deno test --allow-read --allow-net --allow-env --allow-write: 518 passed, 579 steps.
  • RUSTFLAGS=-Dwarnings cargo test --all-features --verbose: 466 unit/integration tests and 47 doc tests passed.
  • RUSTFLAGS=-Dwarnings cargo test --doc --verbose: 47 passed.
  • cargo fmt --all -- --check and the Rust file size check passed.
  • RUSTFLAGS=-Dwarnings cargo +1.99.0 clippy --all-targets --all-features: passed without command-line lint exceptions.
  • Repeated the full Rust tests and doc tests on Rust 1.99 after the CI compatibility changes; all passed. cargo +1.99.0 package --list passed with a clean tree.
  • Initial strict Clippy on local Rust 1.98 reported 27 existing errors, reproduced on unchanged main (bdc7631). The first CI lint job used Rust 1.99 and reported 35 errors, including eight assert_is_empty diagnostics. Preserved log evidence: lines 837 (binary_notation.rs:904, missing_const_for_fn), 892 (memory_backend.rs:199, unused_async_trait_impl), and 1472 (link_cli_notation.rs:551, assert_is_empty). The follow-up addresses these failures while keeping queue behavior and wire bytes the same.

GitHub CI passes on the final commit 12366b45c3b4105592e16df85791176eb6b2e02e: JavaScript pipeline and Rust pipeline. This includes all runtime/OS tests, lint and release checks, the Rust release package build, and benchmark compilation and execution.

Fixes #51

Changes

  • 13 file(s) modified
  • 169 line(s) added
  • 27 line(s) removed
  • Files:
    • docs/BINARY-NOTATION-SPEC.md
    • js/.changeset/self-referencing-binary-spec.md
    • js/tests/binary-notation-spec.test.js
    • rust/Cargo.toml
    • rust/changelog.d/20261007_022500_self_referencing_binary_spec.md
    • rust/src/backends/binary_notation.rs
    • rust/src/backends/binary_notation_tests.rs
    • rust/src/backends/link_cli.rs
    • rust/src/backends/memory_backend.rs
    • rust/src/client/connection.rs
    • rust/src/cluster/node.rs
    • rust/src/queue/manager.rs
    • rust/tests/link_cli_integration.rs

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #51
@konard konard self-assigned this Oct 7, 2026
@konard konard changed the title [WIP] Binary notation: self-referencing links take 3 bytes, the spec says 2 Correct self-referencing binary notation specification Oct 7, 2026
@konard
konard marked this pull request as ready for review October 7, 2026 02:30
@konard

konard commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Working session summary

PR #52 is ready for review.

Corrected the specification to 0F 05 05 (3 bytes), preserved wire compatibility, added JavaScript/Rust regression tests, and resolved Rust CI lint failures.

All local tests and CI checks pass. Changes are committed and pushed; the working tree is clean.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-6.1 Sol
  • Provider: OpenAI
  • Public pricing estimate: $2.633185

📊 Context and tokens usage:

  • 197.1K / 200K (99%) input tokens, 35.1K / 128K (27%) output tokens

Total: (197.1K + 6.6M cached) input tokens, 35.1K output tokens, $2.633185 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-6.1-sol
  • Thinking level: xhigh (~31999 tokens)
  • Model: GPT-6.1 Sol (gpt-6.1-sol)

📎 Log file uploaded as Gist (3395KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
konard merged commit 2d243e9 into main Oct 7, 2026
26 checks passed
@konard

konard commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Auto-merged by hive-mind with --auto-merge flag

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.

Binary notation: self-referencing links take 3 bytes, the spec says 2

1 participant