Skip to content

fix(application): persist artifact ancestry before revised typed history #303

Description

@akoita

Parent: #75
Observed by: #302

Outcome

Persist an automatically revised run's artifact ancestry before its latest artifact so a single start/resume call can complete typed-history projection without a foreign-key failure.

Evidence

Observation #302 completed author, critic, revision, and second critic in one call. Its durable snapshot reached awaiting-approval with artifact version 2. saveTypedHistory tried to persist only that latest artifact, but version 1 had never been projected into artifact_versions. The parent artifact exists in the earlier durable run snapshot, while neither parent nor revised artifact exists in typed history. The insert failed with SQLITE_CONSTRAINT_FOREIGNKEY.

Scope

One application persistence-boundary fix. Persist the exact artifact ancestry in parent-first order from existing durable run data. Preserve immutable history, checksums, workspace isolation, and foreign-key enforcement. Do not rerun providers or fabricate missing ancestors.

Acceptance criteria

  • A deterministic automatic two-round run persists both artifacts and returns its human-review snapshot successfully.
  • Repeated projection is idempotent; missing or inconsistent ancestry fails visibly.
  • Existing one-round and multi-run artifact behavior remains supported.
  • Feature-specific implementation/tests respect hotspot limits; the full local gate passes.

Exit

One implementation PR. Recover the preserved #302 run only through validated application contracts, without modifying its earlier snapshots or calling providers. Candidate review, approval, export, and milestone parity remain separate gates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions