BEE-002: cross-repo backlinks — LINK keys on the target's segment hashlets

Now
OPEN
Sev
MED
Ask
gritzko
Rep
///bee
On1
BEE-001
See
LITE-033
See
LITE-011

The wiki, the tickets and the code are separate git repos that link to each other, so "who links to this page" is a question no single lane can answer today: LITE-033's LINK row keys on pathHl(dst text), which is a full repo-relative path, and its dst is resolved through the LOCAL FSEG descent — so a cross-repo target keys differently depending on which repo was indexed first. This ticket re-keys LINK on the TARGET's own segment hashlets, mints from TEXT alone, and answers a query by fanning out over the BEE-001 registry. Indexing ORDER then cannot change a key, and no lane ever reads another lane.

Input

Context

index/lindex.js scans the tip blobs of ONE repo, reads the F tokens of each moved blob (index/hook.js fTokens), resolves each ref through index/resolve.js against the local tip tree, and puts key = dst_hl:40|0:20|7, val = src path_hl:40|0:20|vnib:4.

Goals

bee lindex <target> names the files that MAY link to it in EVERY registered repo, and the answer does not depend on the order the repos were indexed in.

Constraints

WIP

Design decisions

Ruled by gritzko 2026-08-15 in chat, before any code.

  1. LAYOUT. key = fn_hl:40 | par:20 | 7, val = src path_hl:40 | gpar:20 | vnib:4. Every slot is a truncated TEXT hashlet — the filename's top 40, the immediate parent dir's top 20, the grandparent dir's top 20 — under the LITE-011 FSEG rule: 0 spells absent, a genuine 0 bumps to 1.
  2. TEXT-ONLY MINT. The scan keys on the ref's own segments and resolves nothing, so no lane reads another lane and the indexing ORDER cannot change a key. dstText's FSEG descent retires for LINK; a ticket code (LITE-029) keys as its own text in the fn_hl slot with both ancestors absent, which is exactly today's behaviour.
  3. NO REPO ID, anywhere. The SOURCE repo is the lane that was scanned; the DESTINATION repo is not recorded, so two repos carrying a same-named file produce FALSE SUSPECTS — licensed by the suspects contract, and far cheaper than a dst repo id, which would make REGISTERING a repo invalidate every other repo's lindex mark.
  4. QUERY = FAN-OUT. The target's full path gives two exact keys per lane — fn|0 (a bare-filename ref) and fn|par (a ref naming the parent) — and rows carrying a gpar are kept only when it matches the target's. Anything spelled deeper than the grandparent keys the same as a 3-segment ref, so depth costs false suspects, never a wider probe.
  5. Every lane is opened READ-ONLY during a query and none is brought up: a stale foreign lane answers with fewer suspects, never with a wrong one. Bare bee lindex still scans the LOCAL repo's tip blobs only.
  6. Suspects are named back to TEXT the LITE-033 way, per repo: one descent of THAT repo's tip tree. Output is repo-qualified (the registry path joined to the repo-relative path), local repo first, sorted.
  7. FORMAT BUMP. The new LINK keys share the key space with the old ones, so an old row would answer wrongly: the lane extension bumps and openIndex sweeps the outdated files, as LITE-044 ruled. Cost: one re-derive.

TODOs

Blockers and bummers

Outcome

Landed in the main tree, uncommitted. bee lindex <target> now answers from every registered repo, and the answer no longer depends on indexing order.