bun test test/studio-door.test.ts passes but logs ERROR [apps] meter write failed error="RangeError: Cannot use a closed database" (from metered in src/apps/runtime.ts): something still records an app's awake/sleep interval after app.close() closed the database. On a real shutdown that is a lost meter interval; in tests it is red noise that hides real errors.
Done:
[ ] Closing the app closes each environment's open meter interval while the database is open, and anything still scheduled afterwards does not write (it is cancelled at close, not caught and logged).
[ ] A test starts an app, closes the forge, and asserts the interval was closed with an end time and no "meter write failed" was logged; it fails without the change.
[ ] test/studio-door.test.ts runs with no ERROR line.
Files: src/apps/runtime.ts, the app close in src/app.ts only if the order is wrong there, one test.
bun test test/studio-door.test.tspasses but logsERROR [apps] meter write failed error="RangeError: Cannot use a closed database"(frommeteredinsrc/apps/runtime.ts): something still records an app's awake/sleep interval afterapp.close()closed the database. On a real shutdown that is a lost meter interval; in tests it is red noise that hides real errors.Done:
test/studio-door.test.tsruns with no ERROR line.Files:
src/apps/runtime.ts, the app close insrc/app.tsonly if the order is wrong there, one test.