Repository navigation
STE-46: GET /licenses lists every licence an address holds, from the contract - #55
Merged
Merged
Conversation
…m the contract Frontend asked (Ancung) for "which licences does G... hold" without iterating get_token 1..total_supply from the browser on every visit. Decision: the list is the tokens contract's own enumeration, not the event index the ticket suggested. getEvents only reaches back about a week on testnet, so an event-built list silently drops older licences after a rebuild; deleting a cache must never change an answer (api-spec 6). Tokens are soulbound and never burned, so each get_token record is cached by id for good and only newly minted ids are read. total_supply is read live on every request, so the list is complete to the current ledger. The indexer now also tails license_minted from the tokens contract into its own table, only to attach mint_tx; a licence older than the event window is listed with mint_tx null, never omitted. Events are accepted per contract: license_minted only from the tokens contract, registry events only from the registry, so nothing new can leak into /feed. A failed total_supply or get_token read is 502, never a shorter list; TokenNotFound below total_supply is a failed read, and the next request fills the gap. Tests: API 170 passed (25 new for /licenses, 3 for event decoding). E2E on testnet against a local API with the indexer on: - all 9 holders' lists equal a direct get_token enumeration (supply 28), every listed licence confirmed by has_license on chain; - mint_tx from indexed events matches 3 known mints; - 19 VERIFIED badges of the developer are not listed as licences; - a fresh production purchase (GAFQ6QYS..., mint dcaac10e) is listed, and its mint_tx attaches once indexed; - with the index file deleted and the indexer off, every list is unchanged (mint_tx null).
…and only registry events drop the /skills snapshot Rebasing onto STE-34 put both tickets' changes into the same poll loop. The first automatic resolution concatenated the two versions and stored registry rows twice; the events table's UNIQUE constraint made that harmless (INSERT OR IGNORE), so it was wasted work rather than wrong data, and this test cannot tell the two apart. The loop was merged by hand; the test pins the combined behaviour that does matter.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
Linear: STE-46 · ACC by Axel 2026-09-17 · reviewers @axelmatsama @fable
What
GET /licenses?agent=G…returns every licence an address holds, newest first. It includesmint_txlinks andtotal_supply. No verdict is joined in; that is a separate read, as in §3.8.Decision: the source is the contract's own enumeration
The list comes from
total_supply()+get_token(id), not from the event index.getEventsonly reaches back about a week, so a list built from events would silently drop older licences after a rebuild.total_supplyis read live on every request.license_mintedevents are tailed only to attachmint_tx. A licence older than the event window is still listed, withmint_tx: null.Tests
E2E (testnet)
/licensesequals a directget_tokenenumeration for all 9 holders.mint_txmatches 3 known mints.Evidence:
docs/evidence/ste-46-e2e-licenses-by-agent-2026-09-17.json.Deploy note
Drop the
deploy_indexvolume on redeploy somint_txis backfilled within the event window. The list itself does not depend on it.