ReviewOS

also looking at this

stacks/drone

test: retain execution lifetime failure observations

#62
Draft chris wants to merge codex/execution-lifetime-observations into main
10 files +174 -64

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

docs/public-safety-execution.mdmodified+2-1
Changes to docs/public-safety-execution.md
@@ -118,7 +118,8 @@ elapsed deadlines, stream capacity, cleanup and durable COMMIT with a withheld
118118response. The existing workspace browser scenarios remain required regressions.
119119
120120The native lifetime fixture emits bounded phase observations around setup,
121authority reads, retention waits and cleanup. Its parent records the observed
121authority reads, retention waits and cleanup. Parent-start and child-runtime
122records identify their Bun versions and executable paths independently. Its parent records the observed
122123exit code and signal separately from whether its own watchdog fired or cleanup
123124requested a kill. The settled `exited` status is distinct from the raw
124125`exitCode` property, which can remain null after a signal. Elapsed time includes process work and output handling, not
tests/fixtures/public-safety-access/execution-lifetime.tsmodified+1-0
Changes to tests/fixtures/public-safety-access/execution-lifetime.ts
@@ -4,6 +4,7 @@ import { setupExecutionLifetime } from './execution-lifetime-setup'
44const mode = Bun.argv[2]
55assert(mode === 'completed' || mode === 'canceled' || mode === 'quarantine')
66const began = performance.now()
7console.log(JSON.stringify({ oracle: 'lifetime-fixture-runtime', mode, bunVersion: Bun.version, executable: process.execPath, platform: process.platform, arch: process.arch }))
78let observations = 0
89async function observe<T>(phase: string, work: () => Promise<T>): Promise<T> {
910 const emit = (outcome: 'began' | 'settled' | 'rejected') => {
tests/unit/public-safety-execution-lifetime.test.tsmodified+1-1
Changes to tests/unit/public-safety-execution-lifetime.test.ts
@@ -27,7 +27,7 @@ for (const mode of ['completed', 'canceled', 'quarantine']) test(`native executi
2727 console.error('LIFETIME_FIXTURE_DEADLINE', JSON.stringify({ mode, pid: running.pid, timeoutMs: 90000, elapsedMs: performance.now() - began, requestedSignal: 'SIGKILL' }))
2828 }, 90000)
2929 try {
30 console.log(JSON.stringify({ oracle: 'lifetime-fixture-start', mode, pid: running.pid, timeoutMs: 90000 }))
30 console.log(JSON.stringify({ oracle: 'lifetime-fixture-start', mode, pid: running.pid, timeoutMs: 90000, parentBunVersion: Bun.version, childExecutable: process.execPath }))
3131 const [code, stdout, stderr] = await Promise.all([exited, new Response(running.stdout).text(), new Response(running.stderr).text()])
3232 // eslint-disable-next-line no-console
3333 for (const line of stdout.split('\n')) if (line.startsWith('{"oracle":')) console.log(line)