KeiSeiKit-1.0/_primitives/_rust/kei-brain-view/tests/legacy_schema.rs
Parfii-bot a4e667de10 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

38 lines
1.2 KiB
Rust

//! Legacy-schema compat: brain-view must handle a pre-v2 ledger that
//! lacks the `dna` / `creator_id` / `fork_parent_id` columns. Separate
//! test file so the main integration suite stays focused.
use kei_brain_view::build_graph;
use rusqlite::Connection;
#[test]
fn older_schema_without_dna_column_still_builds() {
let dir = tempfile::tempdir().unwrap();
let db = dir.path().join("legacy.sqlite");
let conn = Connection::open(&db).unwrap();
conn.execute_batch(
"CREATE TABLE agents (
id TEXT PRIMARY KEY,
branch TEXT NOT NULL,
parent_branch TEXT,
spec_sha TEXT NOT NULL,
status TEXT NOT NULL,
started_ts INTEGER NOT NULL,
finished_ts INTEGER,
summary TEXT,
worktree_path TEXT
);",
)
.unwrap();
conn.execute(
"INSERT INTO agents (id, branch, parent_branch, spec_sha, status, started_ts)
VALUES ('legacy1', 'agent/legacy', NULL, 'x', 'done', 100)",
[],
)
.unwrap();
let g = build_graph(&conn).unwrap();
assert_eq!(g.nodes.len(), 1);
assert_eq!(g.node(0).id, "legacy1");
assert!(g.node(0).dna.is_none());
assert!(g.node(0).creator_id.is_none());
}