Commit graph

5 commits

Author SHA1 Message Date
Resham Joshi
151509a1fb
fix(cache-lock): coalesce heartbeat ticks; make time-sensitive tests deterministic (#1559)
* fix(cache-lock): coalesce heartbeat ticks so the fence never waits behind a backlog

Each interval tick queued a full heartbeat in the owner serializer, so an
interval firing faster than a tick completes grew the queue without bound and
verifyStillOwner waited behind all of it. The 1ms-heartbeat fence test hit its
30s timeout on a loaded runner and retried up to 10 times, which is the silent
cache-lock suite hang in CI.

* test(menubar): hold off the helper's SIGTERM until the stand-in app records its status

The relaunch helper signals the app as soon as the CLI child is reaped, which
could land between the stand-in's fopen and fclose and leave an empty status
file. Also wait for the recorder's full line instead of a fixed sleep.

* test: pin day-boundary tests so they pass at any time of day

CLI children that query "today" now run in a fixed-offset zone where it is
about noon on the UTC date (tests/fixtures/noon-tz.ts), so fixtures a little in
the past are always today; the old clamp to UTC midnight put them in the future
for the first minutes of the day and zeroed the counts. The month-scoped budget
and project-filter fixtures get the same treatment (the latter also failed on
days 1-5 of every month), the cursor lookback case derives its start from now
instead of a date that ages out on 1 Oct, and the renderer tests that format a
stamp from a few hours back pin the clock to mid-day. The session drawer date
is formatted in the local zone, so its expectation is too.

* test: derive dated fixtures from the clock so rolling windows never age them out

The six-month --period all window and the sync ledger's six-month prune
dropped fixtures fixed at April-July 2026 from 1 Nov 2026 on. CLI fixtures now
sit 30 days back (utcDaysAgo), the ledger and push tests pin Date to July 2026,
the --to-only range uses yesterday, and the date-picker tests pin mid-month so
two days back is on the calendar they open (they failed on the 1st and 2nd of
every month). The noon-tz helper moves to tests/fixtures/clock.ts.

* test(desktop): give spawned stand-ins room to boot before the silence window

The watchdog and graceful-kill tests used 1-1.5s silence windows, and the
window before a child's first byte includes node's boot. On a loaded machine
the child was signalled before it installed its handler or wrote its byte.
The windows are now 3s and the last-byte test measures from the byte the child
stamps. The killAll and fallback-scheduler tests wait on their condition with
a 15s deadline instead of a 2-3s one.
2026-09-25 05:06:43 +02:00
iamtoruk
6ee71e91c6 fix(cli): scope compare self-corrections to filtered projects, warn on web
compare --project filtered the model rows but scanned every session on the
machine for self-corrections. Scope the scan to the filtered projects'
sessions, and call reportUnmatchedProjectPatterns from web.
2026-09-12 03:49:43 -07:00
iamtoruk
32c81c6f79 test(cli): stop asserting empty stderr, Node 24+ prints a deprecation warning 2026-09-12 03:30:29 -07:00
Mathieu Stanowski
d8dfd72832 fix(cli): judge a pattern against the day cache, and never on screen
Three defects in the unmatched-pattern warning, all reported against a
path that is in fact correct.

`report`, `overview` and `status` judged a pattern against the live parse
plus the day cache, while `sessions`, `models`, `audit`, `compare`,
`optimize`, `yield` and `spend` judged it against the live parse alone.
On a project whose transcripts have expired, `overview --project <path>`
bills it while `sessions --project <path>` called the path wrong. The
check now falls back to the day cache, and only for what the live parse
missed, so the normal path reads no cache at all.

The warning also reached two places that must never see it. An Ink screen
owns the terminal, so it now honours the same `setInteractiveScanUI`
latch the parser checks before printing scan progress: `report --project
/typo` no longer writes over the dashboard. And `serve` routes every
stderr write into the progress-frame emitter, so `runStdioServe` calls
`suppressProjectFilterWarnings()` at startup rather than the module
reading argv, which a leading `--verbose` would have shifted.

SERVE_OPTIONS gains --project/--exclude for the seven commands that just
declared them, as the comment above it requires. Without that a filtered
request falls back to a cold spawn instead of the resident.
2026-09-11 17:29:55 +02:00
Mathieu Stanowski
648fa40ebd feat(cli): warn when a rooted --project/--exclude names no project
A rooted pattern selects one project or nothing, so a typo does not
fail: it reports a total over a set nobody asked for, which reads
exactly like a correct answer. The run now says so on stderr, and the
exit status is untouched.

unmatchedRootedPatterns() tries each pattern on its own against the
UNFILTERED project list, which is what keeps it honest. Judged inside
filterProjectsByName instead, an earlier --project would mask a later
one selecting the same project, and an --exclude would be tested against
what --project had already removed. The message is period-scoped, since
a range-scoped parse is what was checked, and the durable path passes
the carried days' project identities alongside the live parse, so a
pattern naming only an expired-source project stays silent.

Nothing is reported under `serve`. That path routes process.stderr.write
into the progress-frame emitter (runCaptured), so a warning would reach
the desktop app as a scan-progress line.

The tests spawn the real CLI over a seeded corpus of two path siblings:
sessions for the commands that filter at the call site, spend and yield
for the two that take the patterns as arguments and filter inside, so
dropping the argument anywhere fails the suite. They also pin the shapes
that must stay silent: a pattern that selects something, a loose word, a
second --project overlapping the first, and an --exclude naming a
project --project had already removed.
2026-09-11 16:12:31 +02:00