Skip to content

feat: content-addressed XXH64 op digests for TCode run caching - #155

Merged
SkyeAv merged 1 commit into
mainfrom
runcache/digests
Sep 15, 2026
Merged

SkyeAv merged 1 commit into
mainfrom
runcache/digests

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Layer 1 of 7 in the TCode run-cache stack (stack #162, merges bottom-up): gives every TCode instruction run a XXH64 content address so a later layer can recognize identical instruction prefixes across sections. No behavior change in this layer.

Content addressing

  • Adds src/tablassert/runcache.py with pure canonical(), op_repr(), LABEL_FREE, and prefix_digest(): identical op lists digest identically, any semantic argument change changes the digest, and unsupported argument types raise coded RunCacheError (runcache-unserializable-arg) instead of silently mis-hashing.
  • Label masking: LABEL_FREE excludes the log-context-only section_hash/config_file slots of resolve_batch (stored-args positions 3/4) and fullmap_audit (1/2) so sections differing only in log labels share a digest. Positions index the stored args tuple — compile_subgraph pipes each op's leading LazyFrame through reduce, so signature index minus one.
  • Hash choice: tablassert.rs.xxh64 (bundled Rust xxhash-rust, seed 0, full 16-hex digest) — the same primitive as utils.mkhash section-store keys, so no second hashing implementation or dependency.

Design

  • canonical() branch ordering matters for subclasses: bool before int, Enum before str (repo enums are str, Enum).
  • RunCacheError mirrors the _Coded house style (message + kebab-case code + docs URL), defined locally because TablassertErrorCodes is a closed Literal.
  • Accepted caveat: callables are identified by module.qualname; lambdas would collide (mod.<lambda>). No TCode op is a lambda today.

Testing

  • uv run pytest -q tests/test_run_cache.py tests/test_lib.py tests/test_utils.py → 277 passed (6 new digest tests; runcache.py 100% covered)
  • uv run ruff check . → passed; uv run ruff format --check . → 90 files formatted; uv run pyright → 0 errors

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9c023894-bc52-4aff-ab2e-018dd9d3b8c3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SkyeAv
SkyeAv added this pull request to stack #162 September 15, 2026 17:37
@SkyeAv SkyeAv changed the title runcache/digests feat: content-addressed BLAKE2b op digests for TCode run caching Sep 15, 2026
@SkyeAv
SkyeAv marked this pull request as ready for review September 15, 2026 18:06
@SkyeAv SkyeAv changed the title feat: content-addressed BLAKE2b op digests for TCode run caching feat: content-addressed XXH64 op digests for TCode run caching Sep 15, 2026
@SkyeAv
SkyeAv merged commit fb53121 into main Sep 15, 2026
5 checks passed
SkyeAv added a commit that referenced this pull request Sep 15, 2026
Cut 19.0.0 and bump the package version in pyproject.toml, CITATION.cff,
and uv.lock.

Major: five breaking changes ship. The `tablassert` console command now
requires the optional `[cli]` extra, since `cyclopts` and `rich` left the
base install (#187). Level-one normalization redefines fullmap keys as
cleaned Unicode-lowercase, Porter2-normalized, byte-ordered token sets and
moves the database to schema v6, so every schema-v5 fullmap is rejected and
must be rebuilt (#171, #172, #174, #175, #176). `build-fullmap --aria2c`
is gone -- aria2c is used automatically whenever the `[aria2]` extra is
installed (#178) -- and `--taxon-allowlist` is gone because the built-in
top-100 experimental-taxon allowlist now applies to every build, guarding
both reuse paths by `META.taxon_allowlist` identity (#153). Logging now
requires the `[log]` extra and is fully disabled without it (#152).

Features: `tablassert.net` is a new stdlib-only transient/permanent
classification and retry seam shared by the agent and the BABEL downloader
(#163, #164), with one bounded jittered retry layer across the inner agent,
reflexion, and judge (#167) and machine-readable `error_code` values on
skipped checkpoint records (#166). `build-kg` gained an automatic ephemeral
shared-prefix TCode cache keyed by content-addressed XXH64 op digests
(#155-#159, #161). The `--distill` corpus became schema-uniform v2 with a
sibling `outcomes.ndjson`, a deterministic `RewardConfig`-tunable reward,
and the new zero-dependency `tablassert distill-weigh` command (#180-#183).
`CLASS_FIELD_OVERRIDES` grants the DAKP sparse qualifier stack on the pinned
association classes (#188).

Fixes: `distill-export` partitions its corpus by content and unions the
schema across record files, so a mixed v1/v2 directory no longer CastErrors
or silently stringifies a column (#184); BABEL retry warnings survive the
loguru sink; PMC downloads are idempotent, atomic, and bounded-parallel
(#165); reflexion and judge prompts are hard-bounded (#168).

Changelog:
- versioned the Unreleased section as 19.0.0 - 2026-09-15
- merged three duplicate `### Added` blocks into one
- moved the two `BREAKING:` entries from `### Changed` into
  `### Breaking Changes` and added a `**Migration:**` note to all five
- added PR links to all 17 entries, which carried none
- added the missing entries: the distill v2 corpus/reward/distill-weigh
  stack (#180-#183), the distill-export schema-drift fix (#184), the
  TCode run-cache detail (#155-#161), and the README badge removal (#154)

Docs: none needed here. Every shipped doc change landed with its own PR,
and the docs source-of-truth gate passes against the bumped tree.

Testing:
- make check -> exit 0
- uv run ruff check . -> All checks passed!
- uv run pyright -> 0 errors, 0 warnings, 0 informations
- uv run pytest -> 1622 passed, 52 skipped
- cargo test --manifest-path rust/Cargo.toml -> 156 passed, 0 failed
- cargo clippy --all-targets -- -D warnings -> clean
- uv lock --check -> resolved 169 packages, lock current
- uv run mkdocs build --strict -> exit 0
- docs SSOT + CLI coverage after the changelog edit -> 204 passed
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