Skip to content

feat(tdbe): ParsedRight::from_wire_byte (inverse of as_wire_byte)#496

Merged
userFRM merged 3 commits into
mainfrom
feat/495-tdbe-parsed-right-from-wire-byte
May 6, 2026
Merged

feat(tdbe): ParsedRight::from_wire_byte (inverse of as_wire_byte)#496
userFRM merged 3 commits into
mainfrom
feat/495-tdbe-parsed-right-from-wire-byte

Conversation

@userFRM
Copy link
Copy Markdown
Owner

@userFRM userFRM commented May 6, 2026

Summary

  • Adds tdbe::right::ParsedRight::from_wire_byte(byte: i32) -> Option<Self>const fn decoder for the FPSS wire right byte (67 for 'C', 80 for 'P').
  • Inverse of the existing ParsedRight::as_wire_byte. Round-trip property test confirms every variant whose as_wire_byte() returns Some(b) decodes through from_wire_byte(b) == Some(self).
  • Removes the rationale for downstream tick decoders to re-type the 67 / 80 magic numbers at every trust boundary (e.g. thetadatadx-analytics::analytics::_shared::prewarm::chain_snapshot::from_mdds_ticks).
  • Patch bumps tdbe 0.12.8 → 0.12.9 per the 0.12.x patch-only policy. thetadatadx / ffi / tools/cli dependency pins lifted to 0.12.9. The thetadatadx SDK version stays at 8.0.29 — a follow-up release PR rolls the SDK forward.

Test plan

  • cargo fmt --all -- --check
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo build --release -p thetadatadx-ffi
  • 3 new unit tests (decode known bytes, reject unknown bytes incl. negatives & i32 extremes, round-trip property)
  • CHANGELOG entry under [Unreleased] / tdbe

Closes #495.

Friction note

The original v13 cleanup spec named this work as "typed chain-snapshot decoder for endpoints 67/80". The numbers 67 and 80 are NOT MDDS endpoint numbers — they are the ASCII byte values for the option right field ('C' == 67, 'P' == 80). MDDS endpoints are method names on MddsClient (e.g. option_snapshot_quote, option_at_time_quote); the right byte is a tick-field encoding owned by tdbe. This PR lands the cleanup at the right level (a tdbe API on ParsedRight) so the analytics consumer can drop its hardcoded match arms.

userFRM and others added 3 commits May 6, 2026 16:20
Add a `const fn` inverse of the existing `ParsedRight::as_wire_byte`,
decoding the FPSS wire byte (`67` for `'C'`, `80` for `'P'`) into
a typed `ParsedRight`. Returns `None` for any other byte so the
caller can lift the soft-skip / hard-error decision into its own
error type.

Round-trip property test confirms every variant whose
`as_wire_byte()` returns `Some(b)` decodes through
`from_wire_byte(b) == Some(self)`. The `Both` variant has no FPSS
wire encoding, so the test asserts that path stays unrepresentable
on the wire.

Removes the rationale for downstream tick decoders (analytics
chain snapshots, replay validators) to re-type the `67` / `80`
magic numbers at every trust boundary.

Patch bump tdbe 0.12.8 -> 0.12.9 per the 0.12.x patch-only policy;
`thetadatadx` and `ffi` dependency pins lifted to match. No
`thetadatadx` version bump in this commit -- a follow-up release
PR will roll the SDK forward through the next patch.

Closes #495.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`Extended Surfaces` job runs `scripts/check_docs_consistency.py`
which verifies the docs-site changelog mirror matches the
canonical `CHANGELOG.md`. Bring it in sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI's `Extended Surfaces` job runs `cargo check --locked` against
each separately-locked extended-surface crate (`tools/{cli,server,mcp}`,
`sdks/{python,typescript}`). Their `Cargo.toml` declared
`tdbe = "0.12.8"` and the lockfiles resolved to that, so the
locked check failed once tdbe rebased to `0.12.9` on this branch.

Lift the pin to `0.12.9` and refresh each lockfile so the locked
builds pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@userFRM userFRM force-pushed the feat/495-tdbe-parsed-right-from-wire-byte branch from df846f7 to 7225d5a Compare May 6, 2026 14:23
@userFRM userFRM merged commit 45cc5de into main May 6, 2026
32 checks passed
@userFRM userFRM deleted the feat/495-tdbe-parsed-right-from-wire-byte branch May 6, 2026 14:41
@userFRM userFRM mentioned this pull request May 6, 2026
6 tasks
userFRM added a commit that referenced this pull request May 6, 2026
* chore(release): 8.0.31

Patch bump for the additive `tdbe::right::ParsedRight::from_wire_byte`
landed in #496 (which itself patch-bumped tdbe 0.12.8 -> 0.12.9).

Per the v8 patch-only policy. No SDK behaviour change beyond the
new public surface on `tdbe::right`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(release): sync optionalDependencies in sdks/typescript/package.json

The npm `package.json` carries the canonical version on line 3 plus
three `optionalDependencies` entries pinning the per-platform native
binary packages. The version-sync script (`scripts/check_version_sync.py`)
verifies all four match the canonical Cargo.toml version. The release
bump missed the optional-deps trio.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

feat(tdbe): ParsedRight::from_wire_byte (inverse of as_wire_byte) — drop boilerplate at every consumer that decodes Tick.right

1 participant