You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An app developer asked how to run custom cleanup before Harper shuts down and guessed it might involve the status API. The actual answer — a 'close' listener on the plugin-API Scope — is technically documented, but not in a way anyone would find:
The entire coverage is one line in the Scope events list in reference/components/plugin-api.md:
'close' — Emitted after scope.close() is called
Gaps
No connection to shutdown. The line reads as if it's about the plugin author calling scope.close() themselves. Nothing says the component loader calls scope.close() when Harper shuts down or restarts — which is the whole reason an app would listen for it.
Wrong doc for the audience. Someone building an application looks in applications.md; it (along with extension-api.md, overview.md, and javascript-environment.md) has zero occurrences of "cleanup", "shutdown", or "teardown". There is no lifecycle / graceful-shutdown section anywhere in the component docs, so searching the docs for the words in the question finds nothing.
Proposal
Add a "Cleanup on shutdown" subsection to plugin-api.md with the snippet above, stating explicitly that Harper calls scope.close() (emitting 'close') on shutdown and on graceful restart.
Cross-link it from applications.md (short "Lifecycle" or "Shutdown cleanup" pointer).
Summary
An app developer asked how to run custom cleanup before Harper shuts down and guessed it might involve the status API. The actual answer — a
'close'listener on the plugin-APIScope— is technically documented, but not in a way anyone would find:Current state
The entire coverage is one line in the
Scopeevents list inreference/components/plugin-api.md:Gaps
scope.close()themselves. Nothing says the component loader callsscope.close()when Harper shuts down or restarts — which is the whole reason an app would listen for it.applications.md; it (along withextension-api.md,overview.md, andjavascript-environment.md) has zero occurrences of "cleanup", "shutdown", or "teardown". There is no lifecycle / graceful-shutdown section anywhere in the component docs, so searching the docs for the words in the question finds nothing.Proposal
plugin-api.mdwith the snippet above, stating explicitly that Harper callsscope.close()(emitting'close') on shutdown and on graceful restart.applications.md(short "Lifecycle" or "Shutdown cleanup" pointer).'close'listeners, so long-running cleanup can be cut off — tracked in Graceful shutdown doesn't await scope 'close' cleanup — app teardown races process.exit harper#1912. Word the docs so they can be simplified once that lands.