Skip to content

Keep the hooks file to plain uses of $, and call the mod beta - #7

Merged
j127 merged 2 commits into
mainfrom
claude/sessionpad-mod-865578
Oct 29, 2026
Merged

j127 merged 2 commits into
mainfrom
claude/sessionpad-mod-865578

Conversation

@j127

@j127 j127 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

The plugin directory's second validation (of main at ab5868f) found 3 blocking findings, all of one kind: uses of $ in hooks/register.ts it couldn't read. It listed lines 301, 337 and 358, and said there were 7 more it didn't list. This PR fixes that kind of finding throughout the file, and changes the READMEs from "alpha" to "beta".

The rule, as the findings show it

In a file that declares hooks:

  • the directory reads $ handed to another file's function only from a hook's own body;
  • a function in that file may use $ only in plain $.noun.method(...) calls, and may hand $, alone, only to another function in the same file.

The flagged lines were helpers handing $ on to other files:

  • pruneOld from schedulePrune;
  • touchSeen from keepSeen;
  • showOffer from refreshOffer, although that one takes $ alone.

registerCommands handing $ to takenCommands (same file, $ alone) passed, as did every hook body that hands $ to another file.

What changes

  • Moved out of the hooks file, unchanged, each with its comments, and each now called from a hook's body:
    • schedulePrune to prune.ts;
    • keepSeen and its timer to store.ts;
    • refreshOffer to settings.ts, taking whether summary lines are off as an argument, so the module variable added in the last PR goes;
    • showWorkspace to workspace.ts;
    • the turn-end hook's timer, as finishTurnLater, to turns.ts.
  • Three calls written as plain statements: a $ call inside a ternary (/pad), one inside parentheses (/clear's timeline carry), and one nested in another call (notes_read).
  • dollar_check reads each line with its comments taken off, allows a generic call such as get<T>(, and fails if grep itself fails, as the last review suggested. Its comment says what it doesn't catch.
  • READMEs: "beta software" rather than "alpha", without the sentence about little use beyond the author's.

No behaviour changes. The suite is 360 tests, all passing.

Review

A reviewer subagent with fresh context read dc96e08 and found it ready to merge. It confirmed:

  • each moved function is unchanged;
  • there are no import cycles;
  • every $ handed to a function in the hooks file is in a hook's body, or alone to a function in the same file.

Because the directory's seven unlisted findings are only guessed at, its points are taken in 2bd3b63:

  • forgetPaneEdits($).catch(...), which hands $ on as the receiver of a chained call, becomes a try block;
  • plain $ calls inside parentheses, an object or another call's argument each get a line of their own;
  • finishTurnLater keeps its inline comment beside touchSeen;
  • an import is in order;
  • dollar_check also catches a bare $.noun read, and says what it doesn't see.

Before merging

  • A reviewer with fresh context reads the diff (above), and its points are taken.
  • CI green.
  • The owner's OK to merge into main, then a re-validation in the portal.

The directory's second validation flagged the helpers left in the hooks
file that hand $ on to another file's function: schedulePrune,
keepSeen, refreshOffer, and by the same rule showWorkspace and the
timer in the turn-end hook. In a file that declares hooks it reads $
handed to another file's function only from a hook's own body; a
function there may use $ only in plain $.noun.method(...) calls and hand
it, alone, to another function in the same file. So:

- schedulePrune moves to prune.ts, keepSeen and its timer to store.ts,
  refreshOffer to settings.ts (taking whether summaries are off), and
  showWorkspace to workspace.ts; the turn-end timer becomes
  finishTurnLater in turns.ts. Each is called from a hook's body, and
  each comment moved with its code.
- Three calls that passed $ inside a ternary, parentheses or another
  call are written as plain statements.
- dollar_check reads each line with its comments taken off, allows a
  generic call such as get<T>(, and fails if grep itself fails.

The READMEs call sessionpad beta software rather than alpha.
@j127
j127 marked this pull request as ready for review October 29, 2026 20:40
From the review: forgetPaneEdits($).catch(...) handed $ on as the
receiver of a chained call, the shape the directory may not read, so it
becomes a try block. Plain $ calls that sat inside parentheses, an
object or another call's argument (the session id after /clear, the
clear's time, and the turn's id and time) now each get a line of their
own. finishTurnLater keeps its inline comment beside touchSeen; the
./store import is in order; dollar_check also catches a bare $.noun
read, and says what it doesn't see.
@j127
j127 merged commit e658483 into main Oct 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant