Repository navigation
Conversation
…items whose condition holds A ledger item may end with done-when: <condition>[; <condition>], each condition pr-merged owner/repo#n, issue-closed owner/repo#n or path-absent <absolute or ~/ path>, all of which must hold. plan-ledger.mjs parses the clause onto open and deferred items (text in backticks is ignored; a clause it cannot read is an error). check-open-work.mjs prints a done-when group of closeable, pending and error lines without changing its exit code. The new done-when.mjs prints the same and writes nothing; with --apply it closes only closeable lines through close-ledger-line.mjs, guarded by --expect, with the evidence found. A failed lookup, an unknown reference, a pull request named as an issue or the reverse, and a path that cannot be read are errors and never close a line; a path is absent only on ENOENT or ENOTDIR.
… trailing dot, refuse paths a close could be redirected by, and look a reference up once A later field such as recheck: was read as part of a path, so a path-absent clause could check the wrong name and report a line closeable. The clause must now be the item's last field. A trailing period is dropped only after a pull request or issue reference, not from a path. A path with a tab or consecutive spaces is an error, because the close compares collapsed text and the path could change between evaluation and close. A Windows path is an error. github-state.mjs remembers what GitHub said about a reference for the life of the process, so check-open-work.mjs asks once about a reference both its checks name.
…POSIX path tests off it The parser refused every Windows temp path as not absolute, so the done-when tests failed on the Windows runner. A drive path is absolute only on Windows; elsewhere it is still an error. The symlink and trailing-dot tests depend on POSIX file-name behavior and run only there.
… no space after its colon, and expand ~ literally The close compared whitespace-collapsed text, so a path edited between evaluation and close could pass: close-ledger-line.mjs gains --expect-exact, and done-when.mjs uses it. A later field written as recheck:2026-11-01 was read as part of a path; the field guard no longer needs a space after the colon. A home directory containing a dollar sequence was substituted as a replacement pattern; ~ now expands as literal text.
…arenthesized later field A double-backtick span was stripped as two empty spans, which exposed its contents as a clause. Spans are now matched by delimiter length. A later field in parentheses or brackets, such as (recheck: 2026-11-01), was read as part of a path; the field guard now also looks after an opening bracket or comma.
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.
A ledger item can end with
done-when: <condition>[; <condition>], each conditionpr-merged owner/repo#n,issue-closed owner/repo#norpath-absent <absolute or ~/ path>, all of which must hold. Today a finished line stays open until someone notices; this lets a plan say what finishes it, and lets a script close it with the evidence.plan-ledger.mjsexposes the parsed clause asdoneWhenon open and deferred items. The clause must be the item's last field; a clause it cannot read is an error; text in backticks is prose and is ignored. The continuity snapshot does not carry the field.check-open-work.mjsprints a "done-when" group (closeable, pending or error per line). Its exit code and other output are unchanged.done-when.mjs <plan>prints the same and writes nothing. With--applyit closes only closeable lines throughclose-ledger-line.mjs, guarded by--expectso a line edited since is refused, with the evidence it found.github-state.mjsalso reports which references are pull requests and when they finished, and remembers answers for the life of the process, so one run asks GitHub once per reference.Replaces chief-of-staff's
ledger-done-when.ts, which can be deleted once this is pinned.Checked: tests written first (they failed before the code); a local review found four ways a line could close wrongly (a later field read as part of a path, a literal trailing dot dropped, whitespace that bypassed
--expect, Windows paths read as relative) and each now has a test.bun run checkand the full test run pass.