Commit 4b0cb84
committed
refactor(search): the ranker moves to its own repo, pinned as a submodule
search.js is now github.com/imqueue/search-ranker, included here at
vendor/search-ranker and to be included identically by @imqueue/mcp. The reason is
drift: the MCP server carried its own implementation of the same ranking rules, the
two answered identical queries differently, and nothing compared them — recall@6 was
99.5% here against 83.9% there before anyone measured. One file with one history
cannot drift from itself.
Byte-for-byte, so this changes no answer: kpi:compare reports 0 better, 0 worse,
12,279 unchanged across the natural and artificial sets, and the served asset is the
submodule's own hash (verified in the browser — dialog opens, index loads, "retry a
failed call" returns the right answer at #1).
THE FAILURE THIS GUARDS AGAINST. buildAssetManifest() finds JS by scanning
directories, and an unpopulated submodule is an EMPTY DIRECTORY: the scan would find
no *.js, report nothing, and emit a complete-looking site with no search.js in it — a
missing asset, not a build error, and no check would object. So the ranker is handled
by NAME rather than by adding its directory to the scan, and its absence throws at
eleventy config load with `git submodule update --init` in the message. Both failure
modes were tested by causing them.
It also refuses to be shadowed: a src/**/js/search.js reappearing is a hard error
rather than "later source wins", because that file would be served in preference to
the pinned ranker with nothing saying so — the exact drift this split ends. Ordered
last in the function so the collision is detectable at all.
scripts/lib/ranker.js exists because the path was spelled five times independently
(three checks, the KPI harness, the asset scan). Moving the file meant finding all
five, and a missed one fails differently in each caller.
compare.js needed more than a new path: `--ref` names a commit in the RANKER's
history, which is no longer in this repo's history at all, so its git calls now run
with cwd inside the submodule. Uninitialised, git says only "does not exist in
'HEAD'", which names neither the cause nor the fix — so that case is caught and
explained.
submodules: true on all six checkout steps, in five workflows — every one of them
runs `npm test` or `npm run build:all`, so without it each fails at the throw above
instead of checking anything. Cloudflare Pages needs no such flag: it clones and
populates public HTTPS submodules, proven on a throwaway branch before this was
started, which is also why .gitmodules must stay public HTTPS rather than SSH.
Contributor note in the README, because a plain `git clone` yields a tree that looks
complete and a build that stops for a reason nothing on disk explains.1 parent e0c4540 commit 4b0cb84
18 files changed
Lines changed: 206 additions & 2791 deletions
File tree
- .github/workflows
- scripts
- lib
- search-kpi
- lib
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
19 | 32 | | |
20 | 33 | | |
21 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
22 | 40 | | |
23 | 41 | | |
24 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
| |||
0 commit comments