- Delineate engine integration boundary: live-quiz provides structural traceability without semantic registry awareness. - Explicitly state that engine performs no registry queries, identity resolution, or longitudinal history management. - Update architecture diagram to show feedback path from quiz-evaluator through tutor into Learner History. - Mandate deterministic objective mapping for evaluators in data contracts and architecture specifications. - Phrase attempt schema validation normatively in ADR-0007 while keeping exact schema layout open. - Update ADR-0009 reference skills to depend on an abstract external registry and longitudinal history capability. - Preserve Socratic debrief protocol, exposure vs. mastery distinctions, and external open design questions.
3.3 KiB
ADR-0007: Atomic Versioned JSON Export Contract
- Status: Accepted
- Date: 2026-11-10
Context
When live-quiz concludes, it must hand off the assessment evidence to caller workflows (agents, evaluators, or future learning platforms). We needed a durable, forward-compatible integration boundary that does not expose internal SQLite database implementation details.
Decision
Establish attempt.json as a standardized, versioned JSON contract published via an atomic file-replacement pattern:
-
Atomic Publication Pipeline:
- The final attempt data is serialized to JSON conforming to the versioned attempt schema contract (
attempt.schema.json). - Written to a temporary file (
.attempt.json.tmp) within the target directory. - Validated for structural correctness and flushed/fsynced to persistent storage.
- Atomically renamed to the final destination path (
attempt.json). - Failure Guarantee: If publication fails at any stage (e.g. disk full, permissions error), the temporary SQLite journal is retained, and the process exits with an error status.
- The final attempt data is serialized to JSON conforming to the versioned attempt schema contract (
-
Reattempt vs. Recovery Semantics:
- Recovery (
live-quiz recover): Resumes an interrupted attempt, preserving the existingattempt_idand journal state. - Reattempt (
live-quiz start): Launches a fresh execution against the same immutable assessment definition, generating a distinct newattempt_id.
- Recovery (
-
Contract Attributes & Canonical Objective Traceability: Every exported attempt contains explicit provenance:
schema_versionattempt_idassessment_id&assessment_version(withquestionnaire_hash)workspacelocatorstatus(COMPLETED,CLOSED_EARLY,TIMED_OUT)timing(active duration seconds, wall-clock duration seconds, pause intervals)responsesarray preserving mappings to associated canonical objective references carried in the questionnaire.
Structural vs. Semantic Validation Invariant: The exported payload must conform structurally to the versioned attempt schema contract (
attempt.schema.json). However, the engine maintains zero semantic awareness of external registries: it does not validate, resolve, or query objective identifiers against external catalogs, preserving them verbatim for downstream evaluation. The exact schema layout for preserving question-to-objective response traceability remains open until the JSON schema contracts are formally authored.
Alternatives Considered
- Direct SQLite Database Querying by Evaluators / Future LMS: Rejected. Exposing internal database tables couples external consumers to
live-quizschema migrations. - Direct In-Place File Overwriting: Rejected. If a process crash occurs during file write, the destination file is left partially written and corrupted.
Consequences
- Positive: Complete data durability; forward compatibility with any future LMS or evaluator; safe atomic handoff to agent callers.
- Negative / Trade-offs: Requires an atomic rename step and validation pass prior to session journal cleanup.