Skip to content

docs(terminal-path-links): cut the context down to current behaviour and invariants (#1355) - #1390

Merged
devsuitup merged 2 commits into
mainfrom
docs/1355-terminal-path-links
Nov 29, 2026
Merged

devsuitup merged 2 commits into
mainfrom
docs/1355-terminal-path-links

Conversation

@devsuitup

@devsuitup devsuitup commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Part of #1355.

Summary

Cuts .ai/contexts/terminal-path-links.md down to current behaviour and its invariants, with the reasons the code's pointers cite. No behaviour change.

  • Before: 204 lines, 1859 words. After: 178 lines, 1483 words (80 % of the words). The 55 % target was not reached: the old file carried few narratives, four pointer sites cited content the file did not hold (now answered), and review found five sentences whose scope had to be qualified, not cut.
  • Inventory: 68 statements checked against the code. 58 true (10 of them added from code or pointer sites), 2 false and corrected, 3 not verifiable from this repository (xterm and Claude CLI behaviour, kept as reasons), 4 dated measurements reduced to the reason they support, 1 history-relative statement rewritten as current behaviour.
  • Corrected:
    • The hovered line is read from its first row for at most 24 rows. The old text said the walk covers at most 24 rows, but the walk back to the first row is unbounded (public/terminal-path-links.js, readTerminalLogicalLine).
    • isSensitivePathAsync walks both the JS and the native realpath, as the sync guard does. The old text said the JS one only, which describes resolveOnDiskAsync, not the denylist guard (src/main/shared/resolve-path-on-disk.js, sensitiveCandidatesAsync).
    • "The CLI's Read(…) / Edit(…) headers behave as before" became: a path inside such a header is a candidate like any other.
  • Added, because a pointer cited the file without matching text: the lazy shared resolver and why (public/terminal-manager.js), cmRevealLine on a merge view's .b (public/codemirror-setup.js), and ViewerPanel.revealLine (public/viewer-panel.js).
  • Qualified after review:
    • The eight-in-flight limit is the IPC call's default; resolveTerminalPaths only clamps its concurrency to at least 1.
    • The FIFO reason now separates the asynchronous sniff (fs.promises.open, after the regular-file check) from the panel reader's synchronous readFileSync, which is what can freeze main.
    • A second hover shares the in-flight call only while the entry lasts: 30 s from insertion, pending or not, or until the cap evicts it.
    • The matcher does not keep every part of a URL out: after ? or & a candidate starts (https://example.test/?README.md yields README.md). Unquoted my file.txt gives two candidates, each linked if openable.
    • ViewerPanel.revealLine is cancelled by any open(), the same file included, and by destroy().
  • Headings and levels are unchanged. Every quoted pointer still resolves to its heading, and that heading still holds the cited content and reason.

Docs

Agent docs only: .ai/contexts/terminal-path-links.md. No user doc describes these internals. no-changelog: nothing users see changes.

Tests

  • node scripts/check-docs.js --validate: passed.
  • node scripts/check-doc-refs.js: 0 failures.
  • git diff --check: clean.
  • Pointer check (every quoted name and anchor that targets this file, including names split across two lines, with no exemption list): 8 pointers, 0 failures (the doc's internal reference to "The cache" went with the sentence that held it). On a copy with two headings renamed it fails with 4 failures.
  • No test reads this file's text (git grep -l 'terminal-path-links.md' -- test/ is empty). As a sanity check, test/terminal-path-links.test.js and test/terminal-path-target.test.js ran under Node 22 with --test-concurrency=1: 81 pass, 0 fail.

Not verified

  • That xterm asks a link provider only for the hovered line, and which text WebLinksAddon matches by default.
  • That a FIFO blocks open/readFileSync (OS behaviour), and the Claude CLI's OSC 8 / tasks/ stdout behaviour. Both are kept as reasons.
  • The figures carried over from the old measurements (about 3x cheaper stat, about 40 µs per line, about 80 % of the cap, 5-50 ms network stat) were not re-measured.

Kept

  • The link rule and its reason, and "nothing else filters".
  • The guards in order: invalid text, stat, isSensitivePath, directory, regular file, size, NUL sniff, plus the unreadable-file refusal.
  • Stat first, and why.
  • The regular-file check on both sides, and the FIFO reason.
  • The main-side cwd: remote and unresolved refusal, with reasons, and the panel shell resolving through its owner.
  • pendingLine / consumeChangesPendingLine, the working-tree document in every mode, markdown in source at the line without writing the preference, the same-file reveal, and the stricter editor read with its refusal location.
  • Bare and extensionless candidates and the reason for them, the bare regex verbatim, the :// rule, the quoted pass and its reason, the 255-character component limit, punctuation stripping, overlaps decided after the answers, and 64 candidates per line.
  • The batch, the memo (refusals and in-flight promise included), 30 s, 4096, forget, a failed lookup memoised as unresolved, the extensionless cost, and LRU re-insertion with the cliff it avoids.
  • The write path never touched, 24 rows, no bytes returned, 64 per call, at most 8 in flight, the network-stat reason, and no cwd treated as slow.
  • The OSC 8 reason.
  • Test pointers.

…and invariants (#1355)

State current behaviour and invariants with their reasons; correct the 24-row read bound and the async sensitive-path walk; answer pointer sites that cited content the file did not hold.
@devsuitup devsuitup added the no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived label Nov 29, 2026
@devsuitup
devsuitup merged commit 9df983e into main Nov 29, 2026
10 of 11 checks passed
@devsuitup
devsuitup deleted the docs/1355-terminal-path-links branch November 29, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant