Repository navigation
Reference profiles: Reference lookup and the rule's catalog picker (PR 5) - #278
Merged
Merged
Conversation
…R 5) search_references(query, program) finds POTA, SOTA and WWFF list rows by reference or name: every word of the trimmed query, upper-cased, found with strpos (so % and _ are literal); 2 to 64 characters and at most 6 words, else null. It reads only reference_catalog and reference_days, counts activations as distinct (base, day) without hidden calls, keeps retired and never-activated rows, and returns the first 25 by activations then reference, with `more`. No new index: one catalog scan, then each match's own primary-key range of reference_days (`us` 0.4 s on the real lists with 2,000,000 synthetic reference_days rows). The header comes from reference_catalog_header, which pgTAP holds equal to reference_profile's catalog. The public reference-search function (verify_jwt = false) refuses a bad query or program with a 400 before any database call, shares the profile's lookupLimit, never logs a query, and reads the reply with a Zod schema. The web gains /ref (Reference lookup, nav item after Callsign lookup, highlighted on every /ref page): q and program in the URL, one request per submitted search, and the Stats snapshot's most spotted references with no query. /ref/<program>/ now goes to /ref. With is / is not, the reference rule's values field searches the lists as you type (debounced, cached for the editor's lifetime, stale answers dropped) and still accepts any typed reference. database.types.ts regenerated; CLAUDE.md, ARCHITECTURE, OPERATIONS and the spec updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both new pages: `home` and `ref-lookup` in Page, `ref-lookup` in PublicPage, and the AppShell nav test's order, LOCKED and OPEN lists with Home and Reference lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- search_references: the activations come from one probe a match when there are few matches and from one grouped pass over reference_days' primary key when there are many (past a twentieth of its reltuples), and the catalog text is built once a row. A query that matches every row (`- -`, since every reference holds a `-`) took 3.8 s at 350,000 list rows and 2,000,000 reference_days rows and now takes 1.1 s, the measured worst case. search_references_at takes the switch point, and pgTAP requires both ways to give the same payload. ARCHITECTURE.md and the spec record the real worst case. - Reference lookup: Look up (or the chosen program chip) on a search that failed asks again, whatever order the URL put q and program in. - Most spotted: the references are no longer h6 headings, nor are the picker's options. - Reference picker: a search in flight is a shared promise in the editor's cache, so every row showing it hears its answer or failure, including after the row that sent it is gone. - Reference picker: Enter on several words the lists match (a name such as "Mount Mitchell") waits for an option instead of adding MOUNT and MITCHELL; blur stays a point for Brad. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow 20261027001500 #277 added 20261027001400_home_flow_sources.sql, the version this branch's migration had, so reference_search moves to 20261027001500 to sort after every migration on main. Its mentions in CLAUDE.md, ARCHITECTURE.md, OPERATIONS.md, the spec and the pgTAP header follow; OPERATIONS.md also names search_references_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A refused query's error clears when Back or a link changes the search.
- nameParts marks the union of every word's occurrences, so overlapping
words ("mitch hell" in Mitchell) are all set in medium weight.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (reference-lookup) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
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.
PR 5 of Reference profiles (spec
docs/superpowers/specs/2026-10-26-reference-profiles-design.md, decisions 11 and 14).What it adds
search_references(query, program)(migration20261027001500_reference_search.sql). Every word of the query must appear in the reference or the catalog name. Matching usesstrposon upper-cased text, so%and_are literal. It reads onlyreference_catalogandreference_days, leaves hidden calls out of activations and last day, and returns the 25 most activated plusmore. A sharedreference_catalog_headerhelper builds the same headerreference_profiledoes, and pgTAP checks the two agree. No new index.reference-searchEdge Function: public,verify_jwt = false, shares the profile's 30-a-minute lookup limit, rejects bad input with a 400 before any database call, and sendsCache-Control: public, max-age=300./refReference lookup page (public), per the Search and SearchPhone artboards. The query and program stay in the URL. With no query it shows Stats' most spotted references without a new request. A "Reference lookup" nav item follows "Callsign lookup" and is highlighted on/refand/ref/*./ref/<program>/now redirects to/ref.is/is notvalues in the connection builder. It searches after 2 characters and a 300 ms pause, caches each (query, program), ignores stale responses, and narrows to one program when the sources hold exactly one of POTA/SOTAwatch/WWFF. Typing and pressing Enter still adds any reference (WWBOTA, IOTA, unlisted), and the existing shape check still applies.Speed
Measured on the real lists (350,553 catalog rows) plus 2,000,000 synthetic
reference_daysrows:mitchell0.2 s,us0.4 s,an0.8 s. The worst case, a query matching the whole catalog (- -), takes 1.1 s. Over 1/20 of the catalog matching, it switches from probing each match to one grouped pass. pgTAP checks that both paths agree.For Brad to confirm
US-2763 or Mount Mitchell,Searching the lists…,Not in the POTA, SOTA or WWFF lists. Press Enter to add it anyway.,Search is unavailable. Press Enter to add a reference.NC-Central Mountains), as PR 4's page does; the canvas drawsCentral Mountains.Checks
All pass locally: Deno fmt/lint/check/coverage, ESLint and typecheck, db lint, pgTAP (including the new
reference_search.test.sql), the smoke test, the sender and profile-lock database tests, and web lint/build/coverage. The function was also served locally and curled.Deploy, before merging
supabase db push(20261027001500)supabase functions deploy reference-search🤖 Generated with Claude Code