11//! Store durability classification for the upgrade/migration path.
22//!
3- //! Diagnosed failure: `cargo dogfood` on a real 91GB profile failed because
4- //! the post-update health pass tried to mount and repair a 15GB
5- //! `sessions.db`, which triggered a full-table rewrite of the `observations`
6- //! table mid-migration. That rewrite was interrupted, the mount failed, and
7- //! because the health pass's `--strict` gate treated *every* warning as
8- //! fatal, the whole upgrade failed -- recording
9- //! `outcome=forward-recovery-required` and disabling the daemon.
3+ //! A large profile update tried to mount and repair a 15GB `sessions.db`,
4+ //! triggering a full-table rewrite of the `observations` table mid-migration.
5+ //! The rewrite was interrupted and the mount failed, even though the store's
6+ //! bulk transcript and evidence data could be safely retried later.
107//!
118//! The root cause: the upgrade path treated every store as equally precious.
129//! It is not. This module gives the migration path a typed vocabulary for
@@ -58,19 +55,6 @@ pub enum StoreDurabilityClass {
5855 Recoverable ,
5956}
6057
61- impl StoreDurabilityClass {
62- /// Whether a failure to migrate/mount/repair data of this class is
63- /// worth failing a `--strict` upgrade over. Only [`Self::Durable`] data
64- /// qualifies -- it is the only class this model treats as irreplaceable.
65- ///
66- /// Every other class may be handled best-effort: skipped, retried later,
67- /// or (for [`Self::Derived`]) dropped and rebuilt outright, without
68- /// operator intervention.
69- pub const fn may_block_upgrade ( self ) -> bool {
70- matches ! ( self , Self :: Durable )
71- }
72- }
73-
7458/// Mirrors [`tracedecay_store::StoreShardScopeV1`]'s cases without carrying
7559/// its identifiers, so a caller can classify "the kind of store this is"
7660/// without constructing a real project/repository/worktree id first.
@@ -257,13 +241,6 @@ mod tests {
257241 T :: try_from ( value. to_owned ( ) ) . unwrap ( )
258242 }
259243
260- #[ test]
261- fn only_durable_may_block_an_upgrade ( ) {
262- assert ! ( StoreDurabilityClass :: Durable . may_block_upgrade( ) ) ;
263- assert ! ( !StoreDurabilityClass :: Derived . may_block_upgrade( ) ) ;
264- assert ! ( !StoreDurabilityClass :: Recoverable . may_block_upgrade( ) ) ;
265- }
266-
267244 #[ test]
268245 fn profile_and_profile_memory_and_project_are_durable ( ) {
269246 assert_eq ! (
@@ -290,9 +267,6 @@ mod tests {
290267 shard_kind_durability_class( StoreShardKind :: ProjectSessions ) ,
291268 StoreDurabilityClass :: Recoverable
292269 ) ;
293- // The diagnosed bug: mounting/migrating a sessions store must never
294- // be able to block a strict upgrade.
295- assert ! ( !shard_kind_durability_class( StoreShardKind :: ProjectSessions ) . may_block_upgrade( ) ) ;
296270 }
297271
298272 #[ test]
0 commit comments