Skip to content

docs(touched-files): cut the context down to current behaviour and invariants (#1355) - #1380

Merged
devsuitup merged 3 commits into
mainfrom
docs/1355-touched-files
Nov 29, 2026
Merged

devsuitup merged 3 commits into
mainfrom
docs/1355-touched-files

Conversation

@devsuitup

@devsuitup devsuitup commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part 9 of #1355: .ai/contexts/touched-files.md cut down to current behaviour and invariants, with their reasons. Rationale that only explains history, dated measurements and removal history are dropped; no behaviour change.

  • Before: 649 lines, 6147 words. After: 543 lines, 4968 words (84 % of the lines, 81 % of the words). That is above the ~55 % target: of 182 inventoried statements, 170 were still-true constraints, reasons or test guidance, so they stay. The cut words are measurements, history, duplicated statements, and two paragraphs replaced by pointers to sections that state the same rules in full (changes-view.md "Not a repository" for the GIT_CEILING_DIRECTORIES / GIT_DISCOVERY_ACROSS_FILESYSTEM rules, viewer-panel.md "Local file actions" for the open-path viewer guard).
  • Inventory: 182 items. 167 TRUE, 12 FALSE (corrected, not dropped), plus 6 findings fixed after review, 0 UNVERIFIABLE, 3 history/measurement only (their constraint parts kept).
  • Corrected against the shipped code:
    • file-panel.js reaches the Touched view behind typeof except in endCurrentTab, which calls openTouchedPath and openTouchedTab directly.
    • The tool-line cap is 4 Mi characters (line.length), not 4 MiB.
    • An older-history click during a remote refresh queues a follow-up only when its window passes the loaded range.
    • Unsupported GNU flags leave every accepted remote row unknown; rows refused before transport stay refused.
    • The native realpaths feed the containment comparison, the relative Git operand and a .git-segment check on the native file path (hasGitSegment(canonicalPath)), not the comparison alone.
    • The plain fallback is TOUCHED_PLAIN_REASONS (invalid-path, mixed-eol, too-large, git, repo). That includes an oversized HEAD blob and any blob exit other than 0/128.
    • Read-only pairs use createReadOnlyViewer, not createEditableViewer.
    • A hard link inside a repository is refused (hardlink) only when the read reaches resolveTargetInsideRepo. A rev-unsafe operand (for instance a root-level name starting with -), a failed reread or a plain discovery gives an editable plain pair, and its save writes the hard link in place.
    • The JSON.parse prefilter only guards extractTouches. The cache scan parses every line under 32 MiB once, for its timestamp.
    • Relative-path trust also accepts the folder's recorded remap (verifiedTranscriptCwd). The worktree case is one example of a cwd that encodes to another folder.
    • The sensitive-path guard is described again (denylist over literal and realpath candidates, 8.3 and \\?\ forms, fail closed), with a pointer to ipc-bridge.md "Sensitive-path candidates".
    • A remote row refused before transport is refused with no host answer.
    • Touched reads pass {editor: true, image: true} locally and {editor: true, sessionId} remotely.
    • On a local list, binary/encoding/too-large refusals show "This file can't be shown here." for every origin. Remote lists show the reason text.
    • An 'mcp' open of a stashed file over a dirty editor lists it as opened without a read.
  • Section names cited elsewhere are unchanged headings, at the same levels, with the cited content and reasons under them. A pointer check over every tracked file finds 26 citations and 0 failures, and it fails on a copy with two headings renamed.

Docs

Agent docs only: .ai/contexts/touched-files.md. No user doc changes, because behaviour is unchanged.

no-changelog: agent documentation only, nothing users see.

Tests

  • node scripts/check-docs.js --validate: passed.
  • node scripts/check-doc-refs.js: 0 failures.
  • git diff --check: clean.
  • Pointer check (check-pointers.js <worktree>, no exemption list): 26 citations, 0 failures. On a copy with "Stashed edits" and "Trust" renamed it reports 6 failures (exit 1).
  • node --test --test-concurrency=1 test/git-locale-docs.test.js under Node 22.23.5: 1 pass. It pins this file's wording. It failed on an intermediate draft that wrapped "separate remote change" across two lines, and passed after the fix.

Not verified

  • No app run, no e2e (e2e/changes.spec.js Touched journey not run).
  • The full test suite was not run. The only test that reads this file's text is git-locale-docs.test.js.
  • The info modal's Escape/Tab behaviour is taken from registerModal and its test, not re-run here.

Kept

  • Pointers:
    • "Trust" → ## Trust: the paths are attacker-influenced
    • "Remote sessions" → ## Remote sessions (#454)
    • "Shared editor" → ## Shared editor (#450)
    • "One route into Touched" → ## One route into Touched (#472)
    • "Opened rows" → ## Opened rows (#472)
    • "Stashed edits" → ## Stashed edits (#472)
    • "Markdown, formatted" → ## Markdown, formatted (#472)
  • Decision: Decided (issue (sessions): list the files a session touched, including outside any repository #309): Touched is its own tab and toggle, not a Changes section, because the issue keeps the Changes panel out of scope.
  • Reasons:
    • The list is a lower bound: shell parsing would only give a guessed coverage figure.
    • The sensitive-path check runs before any stat.
    • The 4097-character cache cut keeps the invalid-path guard firing.
    • Cache requests are serialized.
    • The ceiling eviction rule keeps an append and a fresh scan in agreement.
    • Disk checks stop after 8 timeouts, because a timed-out check holds a libuv thread.
    • An uncached extension needs an IPC.
    • "Older files not counted yet" is shown instead of a count.
    • Remote stdin batch, positional output, id_rsa.py refusal, GNU-flag failures read as unknown, oversize refusal.
    • A missing repository file is refused before the Git operand is derived.
    • Strict UTF-8 on reads and saves.
    • Remote and read-only tabs are never stashed, and the stash map has no bound.
    • A refused link or openFile message omits the path.
    • GIF/WebP need a NUL byte to count as images.
    • Errors from detached images are ignored.
    • min-height: 0 on the markdown preview.
    • The lazy require in git-changes-file.js.
  • Ordering constraints:
    • Sensitive check before stat.
    • Remote path checks before normalisation.
    • Inspection after the cache queue is released.
    • On the host, the canonical path is checked before stat and read.
    • A missing repository file is refused before the operand is derived.
    • The .git segment is refused before probing.
    • Symlink guards run before the read-only open.
    • Image sniffing runs after the main guards.
    • show-item-in-folder checks run in their stated order.
    • Row switching runs the discard guard before the read and rechecks after it.
  • Test guidance:
    • Fixture spelling rules for Touched vs Changes.
    • The Windows short-path regression.
    • The fake remote host.
    • markdown: tests use the real marked/DOMPurify.
    • Image DOM tests and the shared harness.
    • The "If you change this, also check" list, with test/session-touched-cache.test.js added.

…variants (#1355)

State current behaviour, invariants and their reasons; drop dated measurements and history. Correct twelve statements the code contradicts (typeof reach, line cap unit, remote follow-up and GNU-flag scope, native-path use, plain-fallback reasons, read-only viewer, hard links, read options, refusal message, opened-row addition, refusal action scope). Section names cited elsewhere are unchanged.
@devsuitup devsuitup added the no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived label Nov 29, 2026
Scope the in-repository hard-link refusal to reads that reach the repository guard, name the native .git-segment check, restore the cwd-trust and sensitive-path detail, limit the prefilter claim to extractTouches, and note remote rows refused before transport.
@devsuitup
devsuitup merged commit 3298328 into main Nov 29, 2026
10 checks passed
@devsuitup
devsuitup deleted the docs/1355-touched-files branch November 29, 2026 08:04
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