Skip to content

docs(panel-terminal): cut the context down to current behaviour and invariants (#1355) - #1382

Merged
devsuitup merged 3 commits into
mainfrom
docs/1355-panel-terminal
Nov 29, 2026
Merged

devsuitup merged 3 commits into
mainfrom
docs/1355-panel-terminal

Conversation

@devsuitup

@devsuitup devsuitup commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part 12 of #1355: .ai/contexts/panel-terminal.md now states current behaviour and its invariants, with the reason behind each rule kept.

  • Before: 328 lines, 3223 words. After: 272 lines, 2365 words (73 %). The 55 % target was not reached: the remaining text is rules with the reasons the pointers cite, constants, test guidance and ten corrections.
  • Inventory: 104 items (99 from the old file, 5 added facts). 92 TRUE, 10 FALSE (all corrected; the tenth found in review), 2 UNVERIFIABLE (a recorded decision, Chromium's GL context cap).

Corrected (old → new):

  • file-panel.js has "three hooks only" → four (setPanelTerminalShellOnly from renderTabContent was missing).
  • "The renderer never supplies a path" → it passes the owner's projectPath (shell profile), never the working directory.
  • The isPlainTerminal reader list → names the quit inventory (session-exit.js), which reads panelFor and counts shells under panels.
  • The mount/unmount pair as "the equivalent of showSession's restoreTerminalWebgl/suspendTerminalWebgl" → showSession uses the warm set (webglWarmTouch); the shell's context is the pair's.
  • Inline style.height "holds what the last drag asked for" → it holds the clamped display.
  • "The only writer of the desired height is a drag" → initPanelTerminal also sets it from storage.
  • "An odd number of clicks re-opens once the close has settled" → the re-open runs when the initial open-terminal request fulfils, right after a stop that is issued but not awaited, and only if the panel still shows that owner; nothing orders it after the old PTY's exit. A rejected openTerminal runs only its finally: no stop, no re-open, no refusal.
  • "Such a session gets zero terminal.write() calls" → that holds for the PTY data path (handleTerminalData); notePanelTerminalExit writes a hidden shell's exit banner directly.
  • stopPanelShell "both of its callers" → three call sites, the third in openPanelTerminal's closed-while-spawning branch.
  • The grid's ".visible and WebGL sweeps run over openSessions" → the .visible sweep is document-wide.

Added: the projects worker's snapshot copies panelFor; the region opens before the new terminal is measured (cited by public/panel-terminal.js, no text answered it); height default and clamp edge cases; the Shell toggle in tool-bar.js; createSplitter's refusal and destroy().

Every quoted section name other files cite still resolves to a heading or bold phrase that holds the cited content: 16 pointers, 0 failures. That includes the name split across two comment lines in test/build-projects-panel-shell.test.js.

Docs

Agent docs only: .ai/contexts/panel-terminal.md. No user-visible change. no-changelog.

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, no exemption list): 16 pointers, 0 failures. On a copy with two names broken it fails with 3 failures, including the split-line pointer.
  • No test reads this file's text. The three tests that cite it (test/panel-terminal.test.js, test/build-projects-panel-shell.test.js, test/panel-terminal-target.test.js) were run under Node 22 with --test-concurrency=1: 62 pass, 0 fail.

Not verified

  • Chromium's ~16 GL contexts per process is quoted from the loadTerminalWebgl comment. It was not measured.
  • The overflow order and bar placement are taken from tool-bar.md. They were not checked against style.css.
  • That test/projects-worker-equivalence.test.js fails if projectsSnapshot() stops copying panelFor was not checked with a mutation.
  • Nothing was run in the app.

Invariants kept

Section names kept with their content: "Main process", "A panel shell is not a session", "Mount point", "Layout", "Lifecycle — one shell per session", "Spawn races", "The ordering rule", "LRU", "The refusal", "The third splitter", "Not in scope". Heading levels are unchanged.

  1. The cwd is resolved in main with the Changes resolver, so the shell and the Changes list cannot disagree.
  2. Panel shells are local-only, and the refusal wording comes from main.
  3. There are six exclusions of a panel shell from session counting and rows, each with its reason.
  4. Main and the renderer use different exclusion keys, with the reason. The target module requires nothing.
  5. There are three callers of isPanelShellSession, and the quit inventory counts shells as panels.
  6. Mount point.
  7. Both .visible sweeps use :not(.panel-terminal), with the reason. Widening either one makes a test fail.
  8. WebGL is handled on mount and unmount, hideGridView skips a mounted shell, and the reason is the ~16 context cap.
  9. The hidden-write exemption depends on panelMounted.
  10. Tool order and CSS positioning. The region opens before measurement.
  11. Shell-only layout, with its reasons.
  12. Height constants, where the ceiling applies, the display-only clamp and why a drag records its request, with the ratchet reason.
  13. Refit rules.
  14. The stable panel:<owner> id. Re-key moves the panel state, with the known panelFor limit.
  15. Lifecycle table and exit banner wording.
  16. Exit routing before the applyProcessExit branches, with the reason.
  17. destroyPanelTerminalFor accepts either id shape.
  18. Spawn races, click parity and the settled-spawn guard, with their reasons.
  19. The ordering rule and its dependent sites.
  20. The LRU double protection and how the test isolates it.
  21. The refusal keeps the panel open. Tests check panel visibility before the message. The refusal is transient.
  22. The splitter's responsibilities, its callers, and why the two hand-rolled splitters are not migrated.
  23. What is out of scope. The grid sweeps still reach the shell.
  24. Decision (the user, 2026-09-18, (panel): run a shell under the Changes list, in the session's own working directory #300): not a fourth tab, not a split, not one global shell.

…nvariants (#1355)

State current behaviour and its invariants with their reasons; correct nine statements the code no longer matches; drop history and narration. Every quoted section name cited elsewhere still resolves.
@devsuitup devsuitup added the no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived label Nov 29, 2026
The re-open after a mid-spawn close follows the fulfilled open request and an unawaited stop, not the old PTY's exit; a rejected open re-opens nothing. The hidden-write guarantee covers the PTY data path only.
@devsuitup
devsuitup merged commit a0d4382 into main Nov 29, 2026
10 checks passed
@devsuitup
devsuitup deleted the docs/1355-panel-terminal branch November 29, 2026 08:38
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