fix(labeler): queryLabels honors the full lexicon — `*`, prefixes, sources, paging
uriPatterns was read as a single literal string matched with `uri = ?`, so the
spec's wildcard (`uriPatterns=*`) looked for a subject named "*" and every
generic client got `{"labels":[]}`. Reported by @hipstersmoothie.com.
Now parses uriPatterns as an array (repeated params, comma-joined values, or
both), supports `*` and `prefix*` patterns, and adds `sources`, `limit`
(1-250, default 50) and `cursor` with a response cursor on full pages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fix(labeler): queryLabels honors the full lexicon — `*`, prefixes, sources, paging
uriPatterns was read as a single literal string matched with `uri = ?`, so the
spec's wildcard (`uriPatterns=*`) looked for a subject named "*" and every
generic client got `{"labels":[]}`. Reported by @hipstersmoothie.com.
Now parses uriPatterns as an array (repeated params, comma-joined values, or
both), supports `*` and `prefix*` patterns, and adds `sources`, `limit`
(1-250, default 50) and `cursor` with a response cursor on full pages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
feat(backend): builder mode — offline snapshot build + verified R2 publish
BUILDER_MODE=1 runs the backend binary as a snapshot builder instead of a
server: builds a fresh replica from turso into a scratch path, gates on
doc-count tolerance + FTS sentinel + quick_check, compacts (VACUUM, single
file), writes a manifest (sha256, byte size, source watermark, counts),
and uploads artifact + manifest + latest pointer (LAST) to R2 via rclone.
Never touches /data, never starts the server — scaling-plan invariant #1.
- policy.zig: BANNED_DIDS shared by indexer (insert gate) and builder
(build-time SQL filter) — turso still holds historical patent rows until
paced cleanup; a snapshot must never resurrect them. Bridgy-flagged rows
excluded the same way.
- sync.buildSnapshot: keyset pagination on the uri PK (not OFFSET — linear
turso row reads), 150ms pacing between pages, reuses the existing local
insert path so the schema has one source of truth.
- r2.zig: rclone transport adapted from typeahead (config-file remote,
INDEX_R2_* env, same ops vocabulary). Channels: staging by default,
prod requires BUILDER_ALLOW_PROD=1.
- LocalDb.openAt: open at an explicit path (builder scratch).
- main.zig test block: explicit imports for tap/policy tests — the
isBridgyPds regression test was not being collected without this.
Verified locally against prod turso (SKIP_UPLOAD=1): 25,390 docs / 5,730
pubs / 89,025 tags in ~6min paced, prod canary green throughout
(/popular 151ms mid-build), artifact has 0 banned/bridgy rows, FTS
answers, quick_check ok.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>