refactor(harness): route workflow persistence through repositories
This commit is contained in:
@@ -84,3 +84,20 @@ def build_solved_record(session_dir, manifest, promoted_tables) -> VectorRecord:
|
||||
sql=sql_file.read_text().strip(),
|
||||
tables=sorted(promoted_tables or set()),
|
||||
)
|
||||
|
||||
|
||||
def build_solved_snapshot(snapshot, promoted_tables) -> VectorRecord:
|
||||
from tht.memory import question_context
|
||||
from tht.phase import effective_decisions
|
||||
|
||||
sql = snapshot.artifacts.get("sql_final")
|
||||
if sql is None:
|
||||
raise SolvedIndexError("sql_final.sql assente")
|
||||
decisions = effective_decisions(snapshot)
|
||||
if not any(d.type == "sql_approved" for d in decisions):
|
||||
raise SolvedIndexError("decisione sql_approved assente")
|
||||
return solved_question_record(
|
||||
session_id=snapshot.manifest.id,
|
||||
question=question_context(decisions, snapshot.manifest),
|
||||
sql=sql.strip(), tables=sorted(promoted_tables or set()),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user