feat: registry search over /api/1 and the keywords setting #245
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/18-registry-search"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #18
What
Two commits, as decided in the issue:
feat(project): keywords setting:keywords "http", "client"instd/project. It is read into the manifest, written to the lock'ssettings, and checked bypublishProblems: at most 5 words, each 2 to 24 characters ofa-z,0-9and-starting with a letter or digit, none named twice. Docs updated: project-trb, PROJECT.md, torb-lock, torb-publish, the std/project page and its declarations block. The skill references are regenerated.feat(registry): search over /api/1:GET /api/1/search?q=<text>&limit=<1..50>&offset=<n>.Cache-Control: public, max-age=60.{query, total, limit, offset, packages:[{package, owner, name, version, description, keywords, capabilities, dependents, published}]}./is matched againstowner/name.{error, problems}.searchandsearch_dependencies. They are rewritten in the sameBEGIN IMMEDIATE ... COMMITbatch as the release row on publish, and as the yank row on yank and unyank. The source is the latest release nobody yanked: the highest stable one, else the highest pre-release. Its settings come from the upload, or from the stored archive's lock.Registry.fillSearch()runs beforelistenand fills every package that has releases but no row. That covers a database from before search, and a package whose archive could not be read at rewrite time (such a package is printed and dropped, and never blocks the write).Why
RELEASE.md 7.9 asks for search over owner, name, description and keywords, ranked by dependents rather than downloads.
instr, not FTS5: the registry reaches SQLite through thesqlite3shell, whose build options belong to the container.sqlText), andinstrhas no wildcards, so',%,_and;match literally.Ranking on package checks waits until the registry computes those checks.
Test
tools/registry/tests/search.test.trb, 25 tests, run over loopback against the registry's own server:fillSearchcompiler/tests/packages.test.trb(keyword lock round trip, publish refusals) andcompiler/tests/project.test.trb(manifestOf keywords).torb check tools/registryis clean;torb format --check;torb docs skill docs skills --check;pdisc check.torb test tools/registry/tests/search.test.trbin the VM gave 25 passed. That run used a stand-in for thesqlite3shell, because there is no sqlite3 binary on the worker; CI has the real one.5f71106: every job green excepttier A (linux-x64), which failed once on the unrelated language-server testcompiler/tests/language-server.test.trb:388(intermittent, the same file fails on other pushes); tier A was re-run on this head.CI red on
5f71106:ci / tier A (linux-x64)(and soci / gates) - 1 of 2757 tests failed,compiler/tests/language-server.test.trb:388("A change redoes the front of its file > a declaration added by a change is known to the file at once",published(answers).get(mainUri) == []). Nothing in this diff touches the language server, and other recent runs fail in the same file on other tests (a keystroke-in-a-body group, "Hover > a function shows its signature", on unrelated pushes), so this looks like an intermittent language-server test rather than a regression of this PR. Please re-run tier A on this head (or push a fix for the flake); every other job, includingtools/release-sync and tools/registrywith the realsqlite3, is green. I read the diff meanwhile and have no blocker so far. One small thing: the PR body still saysForge CI: CI_RESULT. My review request stays pending and runs again once CI has finished.CI on
5f71106is green now. The earlier redtier A/gateswas the known timing flake incompiler/tests/language-server.test.trb(#244): the first run failedHover > nothing to say is null(line 94), the secondA change redoes the front of its file > a declaration added by a change is known to the file at once(line 388) - different tests each time, none in files this PR touches. The third run oftier Aon the same head passed (2757 passed, 0 failed) andgatesfollowed. No code change, so the head is unchanged. Re-requesting review.Approved at
5f71106(CI green, including the re-run of tier A andtools/release-sync and tools/registrywith the realsqlite3).packages.test.trbandproject.test.trb. The earlier tier A failure was the unrelated language-server flake and passes on this head.BEGIN IMMEDIATE ... COMMITbatch as the release/yank row, under the registry write lock (registry.trbpublish/yank holdlock.acquire), and the shell runs with-bail, so a failing statement leaves no partial state. The space-joined keyword column matches the paddedinstrlookup.latestOfand the fallback through the stored archive are consistent with the index.sqlTextstring literals,instrhas no wildcards, control characters and term count/length are refused,limitis capped at 50. The endpoint is public and read-only, answered before any token is read.CREATE TABLE IF NOT EXISTS), filled at start for older databases; the signed index stays the truth./api/1/search), nothing else; no new automation.Non-blocking: none.