Repository navigation
Conversation
Add blind_tags.py (the single producer of tags, trapdoors and fp v2, all via totalreclaw_core) and LSHHasher.hash_keyed; remove the unkeyed LSHHasher.hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the legacy fact and tombstone encoders with encode_fact_protobuf_keyed and encode_tombstone_protobuf_keyed (sorted field 5, version 4, field 14 = 1, empty-blob inactive tombstone), byte-identical to core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… calls (internal#573, P4) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (internal#573, P5) KeyedWriteRecord (facts this process wrote skip the query), the dedicated FactIndexScheme query, and the pre-confirmation check in pin_confirm. The operations/client/retype hooks land in the rewire commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
p-diogo
force-pushed
the
feat/573-python-keyed-tags
branch
from
December 5, 2026 02:24
cb2d9f8 to
de3aede
Compare
Collaborator
Author
…ternal#573, P6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
operations, retype_setscope, contradiction, claims_helper, client, crypto and the import engine now use blind_tags and the keyed encoders; fact and trapdoor hashing is gone from client code. Includes the guard hooks (require_keyed_fact, wrote_here plumbing, client writers) and the updated existing tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… conditional Review nits: the pin and retype comments still described the legacy v=3 tombstone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
p-diogo
force-pushed
the
feat/573-python-keyed-tags
branch
from
December 5, 2026 02:56
de3aede to
61763f3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Held for the #573 cutover. Do not merge.
mainmust stay releasable for the backlog RC.Python / Hermes / enclave client wiring for keyed blind indices (internal#573). Draft. No version bump, no publish, no labels.
What changed
python/src/totalreclaw/blind_tags.py: the only producer of tags, trapdoors and content fingerprints. It callstotalreclaw_coreonly (BlindIndexer,hash_keyed,sort_dedup_tags,generate_search_trapdoors_keyed,generate_content_fingerprint_v2). No hashing and no key derivation in client code.LSHHasher.hashis removed;hash_keyedand a read-onlycoreproperty are added.encode_fact_protobuf_keyedandencode_tombstone_protobuf_keyedreplace the legacy encoders. Field 5 sorted and deduplicated, version forced to 4, field 14 = 1 written last; tags must be 64 lowercase hex and the blob must be valid hex (both rejected without echoing the value). Tombstone: empty blob,decay_score0,is_active0, version 4, field 14 = 1. Byte-identical to core on valid input.tag_count;client.remember_batchand the import engine pass one built from the client's keys.X-TotalReclaw-Index-Scheme: 1onRelayClient._base_headers()(subgraph, billing) anduserop._make_ctx()(every bundler and paymaster JSON-RPC call). Constants live inrelay.py.require_keyed_factwith the dedicatedFactIndexSchemequery,IndexSchemeUnconfirmedError(ValueError),KeyedWriteRecord/keyed_writes_forinwrite_gate.py(ids only, 15 min, 256 entries), writers inclient.py, andwrote_hereplumbing through pin, unpin, retype and set_scope. Fails closed; a read block propagates.pyproject.toml) is deliberately not done.Call-site table
operations.store_fact: tags, entity tags, sort/dedup, fp v2store_factencoderstore_fact_batch(same as P-1..P-6)search_factstrapdoors viablind_tags.query_trapdoors; 5-per-batch split kept; comment rewordedestimate_payload_bytes(payload, tag_count=None), docstring rewordedentity_namesis non-emptyDIGEST_TRAPDOOR,compute_entity_trapdoor(s)deletedfind_duplicate_textsuses fp v2LSHHasher.hash_keyed+coreproperty, nohashTests
Added:
test_keyed_tags_573.py,test_protobuf_keyed_573.py,test_index_scheme_header_573.py,test_index_scheme_guard_573.py,test_wire_no_unkeyed_573.py(includes raw and hex positive controls and a half-ported-write control),test_no_client_hashing_573.py(with positive controls).Existing tests updated, and what replaces the deleted ones:
test_claims_helper.py:compute_entity_trapdoor(s)andDIGEST_TRAPDOORtests replaced byentity_namestests; hash parity moved totest_keyed_tags_573.py(entity vectors) and the grep gate.test_crypto.py: unkeyedgenerate_blind_indices/ fp v1 wrapper tests replaced by keyed-tag and fp v2 tests.test_entity_trapdoor_roundtrip.py,test_search_entity_trapdoors.py: now keyedentity_tag; asserts the unkeyed sha256 form is not sent.test_lsh.py: unkeyed bucket parity replaced byhash_keyedplus a no-hashcheck; keyed parity intest_keyed_tags_573.py.test_protobuf.py,test_v1_parity.py,test_pin_batch_cross_impl_parity.py,tests/parity/test_outer_protobuf_parity.py(Python leg): legacy goldens replaced by comparison with the core keyed encoders; field 14 present, 9/11 absent.test_batch_sizing_rc4.py: est >= real keyed payload, entity tags counted;test_search_concurrency.py/test_search_read_short_circuit.py: chunk-count preconditions lowered (stems-only roughly halves trapdoors).test_pin_unpin.py,test_retype_setscope.py,test_wave2a_hermes_fixes.py,test_remember_derives_entities_728.py: mocks answer the guard query withindexScheme: 1; the v3 tombstone test now asserts the scheme-1 tombstone.test_client_bundle_mode.py,test_importance_scale.py,test_decay_score_789.py,test_rc13_import_wave.py,test_search_pin_state.py,generate_py_vectors.py(calls core directly): renamed APIs.Full suite (CI command): 4527 passed, 17 skipped, 0 failed. Untouched
mainat39cd8ea1: 4423 passed, 17 skipped, 0 failed (no pre-existing failures). Parity:test_outer_protobuf_parity.py,test_keyed_blind_indices_parity.py,test_decay_score_parity.py18 passed.Guard message (user-facing copy, needs owner approval)
Marked user-facing copy, needs owner approval.
Spec deviations
pin_confirm.pinned_change_notice, before the client call. To keep "no confirmation token on refusal",pinned_change_noticenow runs the guard first for those three actions via a newTotalReclaw.ensure_keyed_fact. A refusal raisesIndexSchemeUnconfirmedError(aValueError, shown as{"error": MSG}). Costs one extra guard query on unpin/retype/set_scope of a pinned fact (the operation's own guard queries again).blind_tags.tag_counter(keys)helper added (not in the 5.1 API list) to build thetag_countcallable;entity_namesalso skips whitespace-only names (the old helper hashed them).tests/parity/fixtures/outer-protobuf-v1.jsonstill holds legacy bytes (used by the MCP and Rust legs, and I did not edit it), so the Python leg compares with core keyed output per vector instead of the fixture hex.client.pystill pass no LSH hasher (unchanged from before), so rewritten facts carry stem and entity tags but no LSH tags, as today.CI note
The Python tests need a
totalreclaw-corewith the keyed API, which no published core has (internal#573 blocker B1). Thepython-testsjob builds core from source (maturinwheel, thenpip install --force-reinstall), so it can pass. The dependency floor inpyproject.tomlis unchanged (P7 deferred). Locally: build the wheel,uv pip install --force-reinstallit, thenuv run --no-sync.🤖 Generated with Claude Code