Repository navigation
Plugin API: expose a workspace lifecycle marker so plugins can detect archive + restore that happened while they were down #7729
tabulius-ux
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
A plugin that ties permissions to a workspace cannot detect that the workspace was archived and restored while the plugin process was down (crash,
reloadPlugin, disable/enable, daemon restart).workspace.archivedis delivered fire-and-forget to running plugin processes only. It is not replayed after the plugin restarts (server/bootstrap.jsemits from the registry mutation subscriber;plugins/runtime.jsemitsends to loaded plugins only).failedand is not restarted (handleChildClose), so the gap can last until the user reloads it.paseo.workspaces.listcarry noupdatedAt,archivedAt,createdAtor generation field. The registry record hasupdatedAtandarchivedAt, but the descriptor builder insession.jsdoes not expose them. A restored workspace looks the same to the plugin as the original one.A workspace that is archived and stays archived is fine: the plugin sees it missing on its next full
workspaces.listread. Only archive followed by restore, both unobserved, cannot be detected.Reproduction (0.12.0)
failed.reloadPlugin.workspaces.listshows W exactly as before step 2. The plugin has no way to tell that W went through an archive, so the old grant still applies to it.I reproduced this end to end with my Devices plugin on a 0.12.0 host: a workspace archived while the plugin was down was correctly detected, but the archived-and-restored one was not.
Request
Expose a monotonic lifecycle marker on each
workspaces.listentry, for examplelifecycleGeneration(incremented on archive/restore), or the lastarchivedAt/restoredAt. A plugin can store the value with its grant and treat a changed value as a new workspace. Exposing the existing registryarchivedAt/updatedAton the descriptor would also work, as long as a restore leaves a trace.An alternative is to replay or summarize missed
workspace.archivedevents to a plugin when it starts, but a field on the list entry is simpler and has no delivery guarantees to maintain.Impact
Low. For Devices, the user has to restore the workspace and also renew device consent before the old assignment applies again. Still, any plugin that keys state or permissions to workspace IDs has this blind spot.
Related: #7698 (plugins do not see
archivingAtduring another session's archive). That is a separate, already-reported bug about in-progress state. Fixing it would not cover this case, becausearchivingAtleaves no trace after a restore.All reactions