Skip to content

DL-024.2: Lifecycle operations in dld-core - #47

Merged
jimutt merged 1 commit into
feat/dld-core-deepeningfrom
feat/dld-core-lifecycle
Aug 27, 2026
Merged

DL-024.2: Lifecycle operations in dld-core#47
jimutt merged 1 commit into
feat/dld-core-deepeningfrom
feat/dld-core-lifecycle

Conversation

@jimutt

@jimutt jimutt commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

DL-024 item 2: lifecycle operations in dld-core — pauseRun, resumeRun, stopRun, completeRun that pair setRunStatus + appendRunEvent. The pairing is the invariant: activeMinutes derives from run-paused/run-resumed markers, and a status change without its event silently corrupts the count.

Why

Pi's loop paused without writing events, so activeMinutes over-counted paused time and maxMinutes fired early. OpenCode paired them inline five times. Both now call the core ops.

What changed

  • Core gains four lifecycle functions with a fail-early guarantee: if the status change fails, no event is appended.
  • Pi's loop.ts completeRun/pauseRun/pauseAtBounds and index.ts's pause/resume/stop command path adopt them.
  • OpenCode's server.ts replaces five inline status+event pairs.
  • Six new core tests pin the pairing and the fail-early behavior.

Stacks on #44.

Test coverage

116 bun tests (6 for lifecycle ops), 305 bats, tsc, tessl lint — all green.

@jimutt
jimutt marked this pull request as ready for review August 27, 2026 12:24
DL-024 item 2. pauseRun, resumeRun, stopRun, completeRun as core
functions that set the status AND append the matching event. The
pairing is the invariant — activeMinutes derives from run-paused /
run-resumed markers, and a status change without its event silently
corrupts the count.

Pi's loop.ts completeRun/pauseRun/pauseAtBounds and index.ts's
pause/resume/stop command path all adopt the core ops. OpenCode's
server.ts replaces five inline status+event pairs with the core ops.

Six new tests in run-api.test.ts pin the pairing: both calls happen,
in order, and the event is skipped when the status change fails.

All suites green: 110 bun, 305 bats, tsc, tessl lint.

Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
Co-Authored-By: Kimi K3 <noreply@pi.dev>
Generated-By: pi 0.84.2
@jimutt
jimutt force-pushed the feat/dld-core-lifecycle branch from 4b65fee to 7c88bb5 Compare August 27, 2026 12:27
@jimutt
jimutt merged commit 49d3007 into v1 Aug 27, 2026
2 checks 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