Repository navigation
Conversation
Collaborator
Author
|
🤖 Hold: merge this at the #573 cutover (release order step 7), not before. No workflow deploys the subgraph, but |
p-diogo
added a commit
that referenced
this pull request
Nov 26, 2026
…ailure grep); npm test uses Docker; fix a comment Review nits on #846. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
The mapping now counts a payload only when outer protobuf field 14 (index_scheme) is a varint equal to 1. Anything else creates no Fact, no BlindIndex rows and has no tombstone effect. A marked tombstone for an unknown id is ignored instead of creating an empty Fact. Adds Fact.indexScheme, hardens the varint/length handling in the decoder, shared protobuf vectors generated from the core encoder, matchstick tests and a CI job. Refs p-diogo/totalreclaw-internal#573 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ailure grep); npm test uses Docker; fix a comment Review nits on #846. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
p-diogo
force-pushed
the
feat/subgraph-index-scheme-573
branch
from
December 4, 2026 22:01
d7d1818 to
1d204ab
Compare
Collaborator
Author
|
Rebased onto main |
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.
What
Subgraph side of keyed blind indices (design v2.1, section 6 "On-chain scheme marker" and "New mapping"). Core side (field 14, keyed encoders, keyed tombstones) is already on main (#836).
Refs p-diogo/totalreclaw-internal#573
This subgraph must not replace the production subgraph until the cutover (release order step 7). It drops every legacy (unmarked) fact by design, so pointing the live relay at it early would show empty vaults.
Changes
schema.graphql:Fact.indexScheme: Int!. Always 1 on this subgraph, since unmarked payloads never create a row. Adding a field is additive, so no existing query on the old schema changes validity; I chose non-null over nullable/0-default because no legacy row can exist here.src/protobuf.ts: decodes outer field 14 as a varint (kept as i64, only== 1counts). A field 14 with another wire type is skipped, so it reads as unmarked. Unknown fields are still skipped. Hardening found while writing the vectors:0x81used to read as 1);src/mapping.ts: the rule is total. Not field 14 = 1 means return before any store access, with no liveness exception (isActive = decayScore >= 0.3is unchanged but unmarked payloads never reach it). A marked tombstone (empty blob, decay 0) for an id never seen is ignored instead of creating an emptyFact.Shared protobuf vectors
tests/parity/fixtures/protobuf-index-scheme-vectors.json, generated from the core encoder byrust/totalreclaw-core/examples/generate_index_scheme_vectors.rs(cargo run --example generate_index_scheme_vectors,-- --checkverifies it is current). Nine vectors: marked fact, marked tombstone, legacy fact, legacy low-decay fact, legacy tombstone, field 14 = 2, field 14 wrong wire type, truncated mid-field, truncated inside the field-14 varint. Each haspayloadHex,expecteddecoded fields, andcounts. The relay decoder should load the same file.Tests
Matchstick, 18 passing: decoder against every shared vector plus hardening cases; mapping tests for marked fact indexed, unmarked fact (and low-decay) ignored entirely, marked tombstone for a known id deactivates, marked tombstone for an unknown id ignored, unmarked tombstone ignored, field 14 = 2 ignored, wrong wire type and truncated ignored, mixed batch.
matchstick-asadded; top-levelassemblyscriptdevDep pinned to 0.19.23 (matchstick 0.6.0 needs the 0.19bin/asc; graph-cli already bundles that version for builds).graph test -d(Docker). Newsubgraph-testsCI job runs the vector--check, builds all three manifests and runs matchstick.What a vNext deploy needs (not done here)
graph deploywas run.SUBGRAPH_ENDPOINT/ fallback switch together with the gate flag (steps 7-8). Pedro-approved step.🤖 Generated with Claude Code