Skip to content

Commit 599cf6a

Browse files
chore(cleanup): sweep migration-removal leftovers
Delete the code orphaned by the removal commits: the session-temporal repair paged audit drivers (the trigger-backed invariants themselves survive), the memory cutover's canonical-label helper, the migrate registry's unread field, and the vector-generation test helpers, taking workspace dead-code warnings from twelve to zero. Regenerate the dashboard contracts schema, whose stale legacy_backfill_complete requirement failed the blocking contracts:check step. Close the serving-path doc's 150K publication open issue as superseded, rewrite its forward-migration wording, and mark the plan doc's memory-cutover section superseded. Drop an unreferenced build-support draft and ignore the .superpowers session-notes directory. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 551b78b commit 599cf6a

15 files changed

Lines changed: 58 additions & 349 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ __pycache__/
2626
# transient Playwright/axe verification output (screenshots and findings).
2727
# Shipped-state baselines live in dashboard/audit-baselines/ and stay tracked.
2828
dashboard/.*-axe/
29+
.superpowers/

crates/tracedecay-global-db/src/schema_contract/invariants.rs

Lines changed: 1 addition & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ pub(super) const AUDIT_PAGE_ROWS: i64 = 128;
5656
/// limit while avoiding tens of thousands of SQL-channel round trips on a
5757
/// production-sized store.
5858
pub(super) const OBSERVATION_AUDIT_PAGE_ROWS: i64 = 48;
59-
const SESSION_TEMPORAL_REPAIR_AUDITS: &[&str] = &[
60-
"session temporal receipts or cursor keys are mutable",
61-
"session cursor key rotation state is invalid",
62-
"session refresh operation state is invalid",
63-
"session temporal generation state is invalid",
64-
"session temporal authority ownership is invalid",
65-
];
66-
pub const SESSION_TEMPORAL_REPAIR_AUDIT_PAGE_ROWS: i64 = 256;
6759

6860
pub async fn authority_invariant_triggers_intact(
6961
conn: &impl QueryExecutor,
@@ -527,222 +519,16 @@ pub async fn validate_authority_rows_exhaustive(
527519
validate_invariant_rows(conn).await
528520
}
529521

530-
pub async fn validate_session_temporal_repair_authority_audit(
531-
conn: &impl QueryExecutor,
532-
audit_index: usize,
533-
) -> tracedecay_runtime_core::errors::Result<()> {
534-
let invariant = INVARIANTS
535-
.iter()
536-
.filter(|invariant| SESSION_TEMPORAL_REPAIR_AUDITS.contains(&invariant.violation))
537-
.nth(audit_index)
538-
.ok_or_else(|| {
539-
global_db_operation_message(
540-
OPERATION,
541-
format!("unknown session temporal repair authority audit {audit_index}"),
542-
)
543-
})?;
544-
if let Some(query) = invariant.audit_query
545-
&& query_has_rows(conn, query).await?
546-
{
547-
return Err(global_db_operation_message(OPERATION, invariant.violation));
548-
}
549-
Ok(())
550-
}
551-
552-
#[cfg(test)]
553-
pub async fn validate_session_temporal_effect_authority_page(
554-
conn: &impl QueryExecutor,
555-
after_rowid: i64,
556-
) -> tracedecay_runtime_core::errors::Result<(i64, bool)> {
557-
validate_session_temporal_effect_authority_page_with_limit(
558-
conn,
559-
after_rowid,
560-
SESSION_TEMPORAL_REPAIR_AUDIT_PAGE_ROWS,
561-
)
562-
.await
563-
}
564-
565-
pub async fn validate_session_temporal_effect_authority_page_with_limit(
566-
conn: &impl QueryExecutor,
567-
after_rowid: i64,
568-
page_rows: i64,
569-
) -> tracedecay_runtime_core::errors::Result<(i64, bool)> {
570-
debug_assert!(page_rows > 0);
571-
let mut rows = conn
572-
.query(
573-
"SELECT effect.rowid, observation.observation_id IS NULL
574-
FROM session_temporal_observation_effects AS effect
575-
LEFT JOIN observations AS observation
576-
ON observation.observation_id = effect.observation_id
577-
AND observation.sequence = effect.observation_sequence
578-
AND observation.receipt_id = effect.receipt_id
579-
WHERE effect.rowid > ?1
580-
ORDER BY effect.rowid
581-
LIMIT ?2",
582-
params![after_rowid, page_rows],
583-
)
584-
.await
585-
.map_err(|error| global_db_operation_error(OPERATION, error))?;
586-
let mut last_rowid = after_rowid;
587-
let mut count = 0_i64;
588-
while let Some(row) = rows
589-
.next()
590-
.await
591-
.map_err(|error| global_db_operation_error(OPERATION, error))?
592-
{
593-
last_rowid = row
594-
.get(0)
595-
.map_err(|error| global_db_operation_error(OPERATION, error))?;
596-
let invalid = row
597-
.get::<i64>(1)
598-
.map_err(|error| global_db_operation_error(OPERATION, error))?
599-
!= 0;
600-
if invalid {
601-
return Err(global_db_operation_message(
602-
OPERATION,
603-
SESSION_TEMPORAL_REPAIR_AUDITS[0],
604-
));
605-
}
606-
count += 1;
607-
}
608-
Ok((last_rowid, count < page_rows))
609-
}
610-
611-
pub async fn validate_session_temporal_receipt_authority_page_with_limit(
612-
conn: &impl QueryExecutor,
613-
after_rowid: i64,
614-
page_rows: i64,
615-
) -> tracedecay_runtime_core::errors::Result<(i64, bool)> {
616-
debug_assert!(page_rows > 0);
617-
let mut rows = conn
618-
.query(
619-
"SELECT receipt.rowid,
620-
generation.session_id IS NULL
621-
OR (
622-
receipt.batch_ordinal > 0
623-
AND NOT EXISTS (
624-
SELECT 1
625-
FROM session_temporal_projection_receipts AS previous
626-
WHERE previous.session_id = receipt.session_id
627-
AND previous.generation = receipt.generation
628-
AND previous.batch_ordinal = receipt.batch_ordinal - 1
629-
AND previous.source_through <= receipt.source_through
630-
AND previous.projection_through <= receipt.projection_through
631-
)
632-
)
633-
FROM session_temporal_projection_receipts AS receipt
634-
LEFT JOIN session_temporal_generations AS generation
635-
ON generation.session_id = receipt.session_id
636-
AND generation.generation = receipt.generation
637-
AND generation.frozen_watermarks_json = receipt.frozen_watermarks_json
638-
WHERE receipt.rowid > ?1
639-
ORDER BY receipt.rowid
640-
LIMIT ?2",
641-
params![after_rowid, page_rows],
642-
)
643-
.await
644-
.map_err(|error| global_db_operation_error(OPERATION, error))?;
645-
let mut last_rowid = after_rowid;
646-
let mut count = 0_i64;
647-
while let Some(row) = rows
648-
.next()
649-
.await
650-
.map_err(|error| global_db_operation_error(OPERATION, error))?
651-
{
652-
last_rowid = row
653-
.get(0)
654-
.map_err(|error| global_db_operation_error(OPERATION, error))?;
655-
let invalid = row
656-
.get::<i64>(1)
657-
.map_err(|error| global_db_operation_error(OPERATION, error))?
658-
!= 0;
659-
if invalid {
660-
return Err(global_db_operation_message(
661-
OPERATION,
662-
SESSION_TEMPORAL_REPAIR_AUDITS[0],
663-
));
664-
}
665-
count += 1;
666-
}
667-
Ok((last_rowid, count < page_rows))
668-
}
669-
670522
#[cfg(test)]
671523
mod tests {
672524
use tempfile::TempDir;
673525

674526
use super::{
675527
FOREIGN_KEY_AUDIT_PROGRESS, foreign_key_violation_exists_read_only,
676-
foreign_key_violation_exists_resumable, validate_session_temporal_effect_authority_page,
677-
validate_session_temporal_effect_authority_page_with_limit,
528+
foreign_key_violation_exists_resumable,
678529
};
679530
use tracedecay_runtime_core::db::engine::TestConnection;
680531

681-
#[tokio::test]
682-
async fn session_temporal_effect_audit_checkpoints_bounded_pages() {
683-
let directory = TempDir::new().unwrap();
684-
let database_path = directory.path().join("sessions.db");
685-
let mut connection = rusqlite::Connection::open(&database_path).unwrap();
686-
connection
687-
.execute_batch(
688-
"CREATE TABLE observations (
689-
observation_id TEXT NOT NULL,
690-
sequence INTEGER NOT NULL,
691-
receipt_id TEXT NOT NULL,
692-
PRIMARY KEY(observation_id, sequence, receipt_id)
693-
);
694-
CREATE TABLE session_temporal_observation_effects (
695-
observation_id TEXT NOT NULL,
696-
observation_sequence INTEGER NOT NULL,
697-
receipt_id TEXT NOT NULL
698-
);",
699-
)
700-
.unwrap();
701-
let transaction = connection.transaction().unwrap();
702-
for ordinal in 1..=257 {
703-
let observation_id = format!("observation-{ordinal}");
704-
let receipt_id = format!("receipt-{ordinal}");
705-
transaction
706-
.execute(
707-
"INSERT INTO observations(observation_id, sequence, receipt_id)
708-
VALUES (?1, ?2, ?3)",
709-
rusqlite::params![observation_id, ordinal, receipt_id],
710-
)
711-
.unwrap();
712-
transaction
713-
.execute(
714-
"INSERT INTO session_temporal_observation_effects(
715-
observation_id, observation_sequence, receipt_id
716-
) VALUES (?1, ?2, ?3)",
717-
rusqlite::params![observation_id, ordinal, receipt_id],
718-
)
719-
.unwrap();
720-
}
721-
transaction.commit().unwrap();
722-
drop(connection);
723-
let connection = TestConnection::open(&database_path);
724-
725-
let (first_cursor, first_complete) =
726-
validate_session_temporal_effect_authority_page(&connection, 0)
727-
.await
728-
.unwrap();
729-
assert_eq!(first_cursor, 256);
730-
assert!(!first_complete);
731-
let (second_cursor, second_complete) =
732-
validate_session_temporal_effect_authority_page(&connection, first_cursor)
733-
.await
734-
.unwrap();
735-
assert_eq!(second_cursor, 257);
736-
assert!(second_complete);
737-
738-
let (adaptive_cursor, adaptive_complete) =
739-
validate_session_temporal_effect_authority_page_with_limit(&connection, 0, 512)
740-
.await
741-
.unwrap();
742-
assert_eq!(adaptive_cursor, 257);
743-
assert!(adaptive_complete);
744-
}
745-
746532
#[tokio::test]
747533
async fn foreign_key_audit_finds_violations_by_child_table() {
748534
let directory = TempDir::new().unwrap();

crates/tracedecay-global-db/src/schema_contract/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ fn normalize_trigger_sql(sql: &str) -> String {
1212
}
1313

1414
pub(super) use invariants::{
15-
SESSION_TEMPORAL_REPAIR_AUDIT_PAGE_ROWS, authority_invariant_triggers_intact,
16-
restore_immutability_after_canonical_repair, suspend_immutability_for_canonical_repair,
17-
suspend_session_invariants_for_schema_upgrade, validate_authority_rows_exhaustive,
18-
validate_session_temporal_effect_authority_page_with_limit,
19-
validate_session_temporal_receipt_authority_page_with_limit,
20-
validate_session_temporal_repair_authority_audit,
15+
authority_invariant_triggers_intact, restore_immutability_after_canonical_repair,
16+
suspend_immutability_for_canonical_repair, suspend_session_invariants_for_schema_upgrade,
17+
validate_authority_rows_exhaustive,
2118
};
2219
pub use invariants::{
2320
ensure_authority_audit_checkpoint_schema, ensure_authority_invariant_schema,

crates/tracedecay-migrate/SEAMS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ follow `global_db` (seam 1) rather than needing a design of their own.
166166

167167
## 7. `test-transport` is not forwarded to the kernel
168168

169-
`memory_cutover.rs:56` and `:62` call
169+
`memory_cutover.rs:50` and `:56` call
170170
`storage::set_durable_atomic_write_fault_for_test`, which
171171
`tracedecay-runtime-core` gates behind `#[cfg(any(test, feature =
172172
"test-transport"))]`. This crate's `test-transport` feature currently forwards

crates/tracedecay-migrate/src/registry.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ pub struct RegistryReconstructionDiffReport {
112112
/// The command crate can request exact registry/session operations without
113113
/// receiving database handles or reopening owned paths.
114114
pub struct MigrationRegistryRuntime {
115-
registry:
116-
crate::root_seam::daemon::store_runtime::session_registry::DaemonSessionRuntimeRegistryV1,
117115
profile_database: std::sync::Arc<RegisteredGlobalDb>,
118116
}
119117

@@ -162,10 +160,7 @@ impl MigrationRegistryRuntime {
162160
)
163161
.await?;
164162
let profile_database = registry.profile_database().await?;
165-
Ok(Self {
166-
registry,
167-
profile_database,
168-
})
163+
Ok(Self { profile_database })
169164
}
170165

171166
pub async fn registered_project_paths(

crates/tracedecay-runtime-core/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,4 @@ unexpected_cfgs = { level = "warn", check-cfg = [
8989
# Gates the one db::coverage test that drives a real graph query; the
9090
# `GraphQueryManager` it needs lives above this kernel.
9191
"cfg(tracedecay_graph_query_tests)",
92-
# Gates the two store::memory cutover tests that drive `MemoryApplication`,
93-
# which also lives above this kernel.
94-
"cfg(tracedecay_memory_application_tests)",
9592
] }

crates/tracedecay-runtime-core/SEAMS.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,19 @@ refuse a lock while a branch-admin mutation is unfinished.
188188

189189
### 6. Test coverage parked behind cfgs
190190

191-
Two `cfg` flags were added (declared in the crate's `[lints.rust]
192-
unexpected_cfgs` check-cfg list) because the types they need live above the
193-
kernel. Nothing sets them, so these tests do not run anywhere right now:
191+
One `cfg` flag was added (declared in the crate's `[lints.rust]
192+
unexpected_cfgs` check-cfg list) because the types it needs live above the
193+
kernel. Nothing sets it, so this test does not run anywhere right now:
194194

195195
- `tracedecay_graph_query_tests``db/coverage.rs`
196196
`temp_table_lifecycle_uses_the_database_writer` needs
197197
`graph::queries::GraphQueryManager`.
198-
- `tracedecay_memory_application_tests``store/memory/memory_cutover_test.rs`
199-
`cutover_preserves_legacy_usage_telemetry_and_search_ranking` and
200-
`dashboard_vector_points_report_v1_entity_link_connections` need
201-
`application::memory::MemoryApplication` / `MemoryOperationContext`.
202198

203-
Both should be re-homed into the crate that owns the missing type.
199+
It should be re-homed into the crate that owns the missing type.
200+
201+
(A second flag, `tracedecay_memory_application_tests`, gated
202+
`store/memory/memory_cutover_test.rs`; that file went away with the
203+
legacy-memory cutover removal, and the flag with it.)
204204

205205
### 7. Visibility promotion is now the kernel's public surface
206206

crates/tracedecay-runtime-core/src/memory/types.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,6 @@ impl MemoryCategory {
2828
}
2929
}
3030

31-
/// Strict inverse of [`MemoryCategory::as_str`].
32-
///
33-
/// Unlike the [`FromStr`] implementation this accepts only the exact
34-
/// canonical labels: no aliases, no case folding, no separator rewriting.
35-
/// Durable projections that round-trip a stored label must use this so a
36-
/// non-canonical spelling stays a parse failure rather than becoming a
37-
/// silently reinterpreted category.
38-
pub(crate) fn from_canonical_label(value: &str) -> Option<Self> {
39-
match value {
40-
"general" => Some(Self::General),
41-
"user_pref" => Some(Self::UserPref),
42-
"project" => Some(Self::Project),
43-
"tool" => Some(Self::Tool),
44-
"decision" => Some(Self::Decision),
45-
"code_area" => Some(Self::CodeArea),
46-
_ => None,
47-
}
48-
}
49-
5031
pub fn from_proposal_label(value: &str) -> Result<Self, ParseMemoryCategoryError> {
5132
if let Ok(category) = value.parse::<Self>() {
5233
return Ok(category);

crates/tracedecay-usecases/src/semantic_runtime/production.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,6 @@ mod tests {
25882588
VectorWatermark,
25892589
};
25902590

2591-
use tracedecay_runtime_core::db::{DatabaseAuthority, TestDatabaseRuntimeMode};
25922591
use tracedecay_semantic::{
25932592
DaemonSemanticRuntimeHandleV1, FastEmbedSemanticGenerationRequestV1,
25942593
PreparedSemanticRuntimeCommitV1, SemanticGenerationPointerV1,

0 commit comments

Comments
 (0)