2.5 KiB
2.5 KiB
Phase 1 Evidence: Schema and Compatibility Foundation
Scope Completed
- Added Flyway migration
V011__add_session_run_isolation.sql. - Added
chat_sessionanddiagnosis_runtables. - Added nullable
run_idcolumns and indexes toagent_stepandtool_invocation. - Backfilled compatibility runs from existing
diagnosis_sessionrows. - Backfilled existing step/tool rows where a matching
diagnosis_session.session_idexists. - Added
ChatSession,DiagnosisRun,ChatSessionRepository, andDiagnosisRunRepository. - Added run-scoped query/count methods to
AgentStepRepositoryandToolInvocationRepository. - Added
DiagnosisRunRepositoryTest.
Verification
Maven
mvn -q "-Dtest=DiagnosisRunRepositoryTest" test
Result: passed.
mvn -q "-Dtest=DiagnosisSessionRepositoryTest,AgentStepRepositoryTest,ToolInvocationRepositoryTest,DiagnosisRunRepositoryTest" test
Result: passed.
Database Inspection
Checked with scripts/query_mysql.py.
SELECT installed_rank, version, description, success
FROM flyway_schema_history
ORDER BY installed_rank DESC
LIMIT 5;
Relevant result:
version = 011
description = add session run isolation
success = 1
SELECT COUNT(*) AS chat_sessions FROM chat_session;
Result:
chat_sessions = 83
SELECT COUNT(*) AS diagnosis_runs,
SUM(CASE WHEN run_id IS NULL THEN 1 ELSE 0 END) AS null_run_ids
FROM diagnosis_run;
Result:
diagnosis_runs = 83
null_run_ids = 0
SELECT (SELECT COUNT(*) FROM agent_step WHERE run_id IS NULL) AS agent_step_null_run_id,
(SELECT COUNT(*) FROM tool_invocation WHERE run_id IS NULL) AS tool_invocation_null_run_id;
Result:
agent_step_null_run_id = 0
tool_invocation_null_run_id = 1
The one remaining null tool_invocation.run_id is historical orphan data:
id = 3
session_id = f9d2290d
tool_name = lookup_knowledge
created_at = 2026-06-26 14:17:35
It has no matching diagnosis_session, so V011 cannot safely infer a compatibility run. This matches the OpenSpec wording "when possible" for historical backfill.
Logs
logs/application.log shows Hibernate using the new run_id fields in agent_step and tool_invocation inserts/selects during the repository verification.
Notes
- Phase 1 intentionally does not switch Chat, Trace, Feedback, or AIOps write paths.
- New columns remain nullable until later phases switch new writes and verify coverage.