(session-state): pure domain module, single DOM writer, enforced by lint - #266
Merged
Merged
Conversation
Steps 1-2 of #246. Split public/session-activity.js into state and DOM projection (session-activity-dom.js, the only writer of the four activity classes); add public/session-state.js (createSessionState / renderSessionIcon, dual-loadable, liveness and attached as separate facts) behind applyActivityClasses for local-pty. An eslint no-restricted-syntax rule and a boundary test make a bypass fail instead of relying on discipline.
…ssList bypasses of the activity-class rule
Owner
Author
|
Review pass (adversarial, six axes): local DOM output, remote rows, boundary test, load order, dual-load clean. One finding kept: the lint rule only matched |
This was referenced Sep 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps 1-2 of #246 (migration order in the issue). Steps 3-5 follow in separate PRs.
What
public/session-activity.jsis split: it keeps the Maps/Sets,setActivity,purgeActivityFor, rekey/reconcile; the newpublic/session-activity-dom.jsholdssessionItemEl,applyActivityClassesand four setters that are the only code allowed to write.cli-busy/.needs-attention/.response-ready/.has-busy-agents. The direct writers inapp.js(3) andsidebar.js(4) are routed through them.public/session-state.js: pure, dual-loadable domain module.createSessionState(kind).apply(event).snapshot()withlivenessandattachedas two separate facts (lifecycle decision recorded on the issue), exclusivity of busy / waitingForInput / attention, and the priority order.renderSessionIcon(snapshot)gives classes, glyph and title for one icon slot; only its classes are consumed for now, behindapplyActivityClasses, local-pty only. Local DOM output is unchanged.no-restricted-syntaxineslint.config.js(classList add/remove/toggle with those class names outside the projection file) andtest/session-state-boundary.test.js(nodocument/window/ electron / ipcRenderer in the domain source)..ai/contexts/session-state.md(shape, ports, enforcement, migration status), linked from the contexts README and the orientation table.Two deviations from the issue text, documented in the context note: a
responseReadyfield (the "finished, not yet seen" rung is distinct fromwaitingForInput), and the seen/unseen flag stays caller-supplied (armReady) becauseattachedmeans "has a PTY", not "is the focused tab".Test infra changes: loaders updated for the split files; one source-regex pin (
sidebar-busy-agents-tint.test.js) rewritten against the real module; one pin inrunning-indicators.test.jsupdated to the new call shape.Proof
classList.add('cli-busy')inapp.jsfailsnpx eslint public/app.jswith oneno-restricted-syntaxerror; removed, 0 errors.PRIORITYturns three priority tests red.task check: 1176 + 119 pass, 0 fail, 8 pre-existing skips.