Move host-update database backup and restore behind the State Store contract #1918

Open
opened 2026-11-12 15:47:45 +00:00 by sam · 0 comments
Owner

During a host update, archied backs up the task database, reads its schema version and restores it on rollback by importing the State Store's composition root (internal/app/statestore: RunRecovery and SchemaVersion, called from internal/app/archied/update_host.go). That breaks the rule that services reach each other only through their contracts, and it means archied opens the State Store's database itself.

Wanted: archied gets the backup, the restore and the schema version through the State Store's gRPC contract, or through a State Store subcommand it runs. It no longer links internal/app/statestore.

Points to settle:

  • A restore has to work while the State Store is stopped, so a plain RPC to the running service may not be enough. A subcommand of archie-state-store that archied runs may be the simpler boundary.
  • The update transaction's rollback path depends on this, so it needs to keep working when the State Store won't start on the new release.

Done when go list -deps ./internal/app/archied doesn't include internal/app/statestore, a host update still takes a backup before migrating, and rollback still restores it. Then remove the exception note from the services section of AGENTS.md.

During a host update, archied backs up the task database, reads its schema version and restores it on rollback by importing the State Store's composition root (internal/app/statestore: RunRecovery and SchemaVersion, called from internal/app/archied/update_host.go). That breaks the rule that services reach each other only through their contracts, and it means archied opens the State Store's database itself. Wanted: archied gets the backup, the restore and the schema version through the State Store's gRPC contract, or through a State Store subcommand it runs. It no longer links internal/app/statestore. Points to settle: - A restore has to work while the State Store is stopped, so a plain RPC to the running service may not be enough. A subcommand of archie-state-store that archied runs may be the simpler boundary. - The update transaction's rollback path depends on this, so it needs to keep working when the State Store won't start on the new release. Done when go list -deps ./internal/app/archied doesn't include internal/app/statestore, a host update still takes a backup before migrating, and rollback still restores it. Then remove the exception note from the services section of AGENTS.md.
sam added the lowtask labels 2026-11-12 15:48:02 +00:00
sam added the deferred label 2026-11-15 17:26:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1918