Skip to content

Run-dir hashing / provenance — content-addressable identity (additive contract extension) #64

Description

@jack-champagne

Foundational additive extension to the run-dir contract, extracted from the workflow-frames spec (spec-20260623-173632-amicode-workflow-frames §5, armonissima — design-open, pending armonissima PR #18). Extracts only the concrete hashing/provenance piece — NOT the entity/phase model, which stays Aaron's open fork.

Why early (not Phase 3)

Content-addressable identity is foundational: the catalog keys on it (#47/#48), the comparison UX groups by it (#51), and it's the training substrate for learned defaults (the flywheel). Retrofitting identity onto a contract after runs exist is painful — so land it as an early additive extension in the Phase-1 window, not a Phase-3 afterthought. (Not a plan §1.x task — a foundational item surfaced by the workflow-frames spec.)

What (additive to the frozen run-dir contract; coexists with time-ids)

SHA-256 (node:crypto + Julia SHA for the round-trip validator):

  • system_hash — Hamiltonian + lab params + calibration θ (identity of the physical problem; calibration-drift trigger)
  • formulation_hash — objective + constraints + parameterization + duration/knots + integrator + pinned globals (the problem statement; reformulation trigger)
  • spec_hash = hash(system_hash, formulation_hash, warm_start_hash) — full run identity; dedup ("already solved?")
  • pulse_hash — canonical control-array bytes (fixed dtype/shape/endianness, NOT the JLD2/HDF5 wrapper) — the content-addressable catalog key
  • device runs: data_hash, wigner_hash
  • provenance edge per run: prior run_id + typed reason (calibration-drift | reformulation:<why> | scale-up)

Contract impact: run.toml gains system/formulation/warm_start/spec hashes; result.toml gains pulse_hash (+ data/wigner on device). SchemaPackage versioned bump. Time-ids stay for ordering; hashes add content-addressing.

The key cut — System ÷ Formulation

The optimization input has two independently-varying halves: the physical System (QILC mutates it mechanically) vs the Formulation (researcher/agent mutates it by judgment). Hashing them separately yields two comparison axes — fix-formulation-vary-system = robustness; fix-system-vary-formulation = the reformulation study. This is what makes #51's sweep families mechanical.

Caveat (correctness-blocking)

Float pulse bytes need a defined canonical layout or you get spurious hash mismatches; spec params hash via canonical JSON (sorted keys, normalized numbers). (spec §5 / Q7 — needs nailing before this is trustworthy.)

Links

Needs Aaron's sign-off on canonicalization + whether it lands as SchemaPackage vNext.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions