cmux-next: error journal reads the build's acpmux home and flushes on a DemandTimer (drops #21981's allowlist entries)

Merged
TE
16d ago
+13-23

#21981 cleared the error journal's two guard reds with allowlist entries: a state-roots baseline row for the literal ~/.acpmux/daemon.log, and concurrency-allow/wakeup-allow comments on the flush sleep. This replaces both with the fixes the guards ask for.

  • State root: the app's own acpmux log now comes from environment.build.acpmuxHome(userHome:), the home AcpmuxEnvironment starts the daemon in. That is still ~/.acpmux for NIGHTLY, and now the right ~/.acpmux/builds/<key> for every other build, which the literal missed. The baseline row is gone.
  • Flush delay: ErrorJournal batches writes on a DemandTimer (scheduleIfIdle, so new records don't push the deadline back; flush() cancels it), not a raw Task + clock.sleep. Same timing, and the injected clock still drives it. The allow comments on it are gone. The 300 s harvest loop keeps its reviewed wakeup-allow, since that one really is a periodic cadence.
  • ci-target-graph.json regenerated for the new CmuxNextWakeups dependency. It was also missing CmuxNextTerminalGeometry on the base.
  • Crash safety (base red since this PR opened): the journal's eight try! NSRegularExpression literals now use try?, as FeedSecretScrubber does. The parser and normalizer skip a pattern that fails to compile. The redactor fails closed: if any of its rules is missing, it returns <redacted>, so a secret never passes through unredacted. check-crash-safety passes.

Evidence: the first commit removes only the allowlist entries, and check-state-roots.sh and check-concurrency.sh both fail on it. The second commit makes them pass. ci-target-graph.py --check is fresh, and check-app-size.sh --base shows no CmuxNextApp source growth. swift test --filter CmuxNextErrorJournalTests ran on cosmic-gray with this same ErrorJournal change and passed 18 of 18. The app-side line compiles in CI.

Changelog: none

๐Ÿค– Generated with Claude Code

(Adopted by the orphan sweep 2026-10-21: base merged in at 7a07d90. The try! part is on base already via #22630, so this merge took base's ErrorNormalizer, ErrorRedactor and LogLineParser; what remains is the build-home acpmux log and the DemandTimer flush. ci-target-graph.json is left to the base autofix since #22238.)

No capture: no UI change (error journal internals).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Replaces #21981's allowlist carve-outs for the error journal with real fixes, so the state-roots and concurrency guards pass without exceptions.

  • The app's own acpmux log now comes from environment.build.acpmuxHome(userHome:) โ€” still ~/.acpmux for NIGHTLY, the correct ~/.acpmux/builds/<key> for every other build โ€” and its state-roots baseline row is dropped.
  • ErrorJournal batches writes on a DemandTimer (scheduleIfIdle, so new records don't push the deadline back; flush() cancels it) instead of a raw Task + clock.sleep, with the same timing and injected clock.
  • Adds the CmuxNextWakeups dependency and regenerates ci-target-graph.json and schemas/defaults/cmux-next.json via PR autofix.
  • Merges keep the base's chiefAcpmuxLog handling (#22900) and the try! โ†’ try? work (#22630); a recent merge picks up base compile fix #23286.

No UI change.