Skip to content

merge(schemas): configure agents by reference, record treatments - #86

Merged
LittleCoinCoin merged 130 commits into
mainfrom
feat/treatment-record
Dec 4, 2026
Merged

LittleCoinCoin merged 130 commits into
mainfrom
feat/treatment-record

Conversation

@LittleCoinCoin

@LittleCoinCoin LittleCoinCoin commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Why

The skill under test entered an experiment through its own section ([treatment]), its own setting (request.treatment), its own typed root in every cell, and its own build-context prefix (treatment:). Instruction files, hooks and the next kind of configuration would each have needed the same four exceptions. Worse, a run's manifest kept only a list of factor paths, so analyze rebuilt which leaves a factor owned from path prefixes, and a factor whose level was a whole table could not be told apart from its parts.

What changes

  • One form for configuration under test. A reference {source, path?, tag?, commit?} is written in [fixed] or as the levels of a factor at the path it configures (skills.<name>, instructions.global.<harness>, instructions.workspace). The resolver pins each distinct reference once per plan, the harness driver says where it lands (HarnessDriver::layout), and the image build, the ground-truth refusal and the staging read that one extraction. isolation.build.context and isolation.build.requirements take ref:<config path>/<subpath>.
  • A treatment record. run-manifest/2 records, per run, treatment[] {factor, owns, level}. analyze reads levels and ownership from it, so comparability, blocking and the report no longer infer them from paths.
  • Import rules. [treatment] becomes [[reference]] {path, pointer, resolved?}. An imported reference has a tag and no commit.
  • A gentle break. [treatment], request.treatment and treatment:<path> are refused with config.treatment_form_retired, and the message shows the reference that replaces them. A run-manifest/1 store is refused with format.schema_tag_mismatch, naming the manifest and saying to re-import or rerun; nothing is migrated.
  • Removed: TreatmentRef, TreatmentSpec, SkillTree, HarnessDriver::skills, treatment_identity@1, the typed root treatment, request.treatment, RunManifest.factors and varying_paths on the reading side, and every per-cell re-archive of a skill tree.

Before and after

# before
[[factors]]
path = "request.treatment"
levels = [
  { name = "htn-creator", tag = "htn-creator@0.2.7", source = "../../../../../" },
  { name = "htn-creator", tag = "htn-creator@0.2.8", source = "../../../../../" },
]
[fixed]
"isolation.build.context" = "treatment:.claude/skills/htn-creator/scripts"
[treatment]
name = "htn-creator"
tag = "htn-creator@0.2.7"
source = "../../../../../"
# after
[[factors]]
path = "skills.htn-creator"
levels = [
  { source = "../../../../../", path = ".claude/skills/htn-creator", tag = "htn-creator@0.2.7" },
  { source = "../../../../../", path = ".claude/skills/htn-creator", tag = "htn-creator@0.2.8" },
]
[fixed]
"isolation.build.context" = "ref:skills.htn-creator/scripts"

The import rules change the same way: [treatment] with pointer and resolved becomes [[reference]] with path = "skills.htn-creator" and the same two keys. A plug-in fragment's treatment:<path> requirement becomes ref:skills.<name>/<path>.

The hard parts

  • The seam between pin, layout, writer and reader had to hold for a factor of references, which the planner pins after the resolver has run; the resolver now runs once per tuple of reference levels over one pin store.
  • A reference factor owns the value leaves that map one to one onto its levels (such as resolved_skill_version on an import), so an imported store and its native rerun declare the same factors.
  • A run-manifest/1 store has to be refused with its code. The store's manifest read turned every parse error into text, and its Format arm holds neither the tag error nor the path, so the read now checks the schema field first (RunManifest::check_schema_tag) and a new StoreError::SchemaTag arm answers with the tag error's own code.
  • The golden corpus oracle was keyed by cell digests of the old form; it is regenerated, and the rates it holds are unchanged.

Not covered

  • candler resolve prints the first tuple of reference levels only.
  • A ref: entry found only in a plug-in fragment explains nothing when two levels differ.
  • A reference with no commit is compared by tag.
  • A rule's resolved leaf is owned by the rule alone.
  • Reference tables in plug-in fragments at skills.*, and scp-style git@host:x sources, are not handled; sources are local directories only.

Observations

  • Resolving the migrated consumer experiment with the built binary pins htn-creator@0.2.7 to its commit and resolves the layered build image from ref:skills.htn-creator/scripts.
  • The migrated consumer's own guards for its agent environment and skill requirements pass on the reference form.
  • The golden design keeps its 6 version comparisons by model and 3 model comparisons by version, with the same signs; the 240-run corpus re-imports to the same rates per cell.
  • Old stores are not migrated by design; the refusal names the way out.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

LittleCoinCoin and others added 30 commits December 3, 2026 15:05
`analyze --experiment` refuses a treatment A/B that Candler itself ran.
A probe on main shows three of five factor shapes break, and the cause
is not one reader: the run manifest keeps only factor paths, so every
analysis reader rebuilds ownership and levels by its own path rule.

The reports record the probe, the concepts as the experiment file
defines them, the readers that rebuild them, what a scrapped path-based
fix got wrong, and two open questions for a planning session: what the
record must keep, and what "treatment" names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A run manifest records only factor paths, so analysis readers rebuild
ownership from prefixes and three of five factor shapes break. This
roadmap replaces the skill special case with one reference form at the
configuration paths a harness driver can lay out, pins each reference
once, and records each run's treatment as {factor, owns, level} under
run-manifest/2. Twelve leaves over seven depths, expand then contract:
the old form keeps working through named shims until manifest_v2 lands
the one break and its compile migration. Every leaf writes an
architecture report before code and names what it reuses and removes;
the coordinator gates each depth on consolidation across leaves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The campaign may spend up to $100, against an estimate of about $70.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inventory names each site in Candler, its plug-in interface and the
htn-eval-clean consumer that spells the old treatment form or the
path-only factor record, with the leaf that ticks it. It is transient:
integration deletes it with every row ticked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six end-to-end rows run through the binary and are red on the base for
the reason each states: a skill factor under --experiment, a table
level, a factor below a held table, a fixed leaf beside a factor, two
factors where one prefixes the other, and a study with no skill. They
are ignored until the record readers land. The undeclared-leaf refusal
holds in guard_comparability, and its twin is red and ignored. Two
confirm rows show the existing shapes still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Inventory and guards are done. The inventory found files no leaf owned:
tests and fixtures in the old form, the contract pages, whose guard reads
schemas, traits and codes, and the generated Python models. Conventions
now say who changes each. G6 moves to guard_comparability.rs, because
compare.rs has no test module, and the readers filters follow. The
integration leaf checks the contract pages for drift instead of
regenerating them, and leaf worktrees are removed with git worktree
remove, since scripts/worktree.py remove waits for origin/main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
State configuration by reference as the design: add Terms and Configuration
by reference, remove the treatment section and its prefix, and move the class
table and the harness layout to the reference form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe the run manifest, the verdict (I6 to I8), blocks, comparisons, the
importer, evaluators and the error model over the treatment record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The architecture document now states the design every later leaf
implements. Terms are defined once. A reference {source, path?, tag?,
commit?} at a configuration path a driver can lay out replaces the
skill checkout, and is pinned and extracted once per plan. The run
manifest records each run's treatment as {factor, owns, level} under
run-manifest/2. I7 reads that record. The README names the agent's
configuration as what is under test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A field-path segment cannot hold `-`, so `skills.htn-creator` was no
path. The segment now admits it, a loosening the version note records.
A reference is told from a plain value by the path catalogue and the
value's kind, never by its keys, so no schemas code refuses one at a
path that takes none: such a table flattens, or stays a hook table, and
the reader of that path refuses it. The design says so, and gate 1 of
the leaf follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The design named TABLE_VALUED_PATHS and a field-path segment without
`-`. The depth 2 leaf renamed the catalogue HELD_WHOLE_PATHS, because two
of its rows are not tables, and widened the segment. The design now says
both, and manifest_v2's breaking footer records that the old constant
left the public API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A skill name such as htn-creator is a segment of skills.<name>. The
segment grammar loosens from [a-z][a-z0-9_]* to [a-z][a-z0-9_-]*; every
schema that carries a field path changes by its pattern and description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A table at skills.<name>, instructions.workspace and
instructions.global.<harness> reads as a reference and is one leaf for
ownership. The path catalogue gains a per-row marker for it; no key
makes a table a reference, and an inline text stays valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RefEntry parses ref:<config path>/<subpath>; ReferencePin is what a
cell holds in place of a reference, with no source. Both are read by
the depth 3 resolver. The commit also formats the previous one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HELD_WHOLE_PATHS and its row types are crate-private; takes_reference
is the public question. One predicate now answers both whether a path
takes a reference and whether it is held whole, at exactly one segment
below skills. The agent_config doc no longer links a private item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An experiment file may now hold a reference {source, path?, tag?,
commit?} at skills.<name>, instructions.workspace and
instructions.global.<harness>. The path catalogue, renamed
HELD_WHOLE_PATHS and kept inside the crate, says which paths take one,
and a reference is held whole there, so a factor of references owns one
leaf. A ref:<config path>/<subpath> build entry names a file inside a
reference, and ReferencePin {path, digest, commit?, tag?} is the pin a
resolver will write, with no source. A field-path segment now admits
`-`, so skills.htn-creator is a path; import package names still refuse
it. All of it sits beside the old treatment form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LittleCoinCoin and others added 22 commits December 4, 2026 11:49
leaf_values splits held tables into their leaves, built on leaves_of and
value_at_leaf, so the verdict can judge a factor by the leaves it owns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resolver runs once for each tuple of reference-factor levels, over
one pin store, so a factor-level reference is pinned by reference_pin@1
and named in sources[] like a fixed one, and a ref: build entry reads
its extraction. A cell takes its resolution by Cell.levels.

JobSpec.resolution becomes resolutions and JobSpec.references, the
planner pre-pass and ReferencePins are gone; an old spec is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each row names the symbol or line on the tip that shows its site migrated
or gone; the rows the retired-names sweep proves gone cite the sweep. No
row is left for an owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
class_verdict reads the arms treatment records: a differing leaf is
accepted when a factor that owns it has different levels in the two
arms. The reference explanation of locks, image and inputs needs an owned
reference that differs and a ref: build entry that reads it. The path
prefix machinery (covers, declared_covers, REFERENCE_ROOTS) is gone.

This commit and the next one build together: report.rs moves with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two-factor gate the retired kt_two_levels_end_to_end left open:
two instruction files by two models run through the binary, and each
run treatment names its level of both factors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its parent holds every row ticked, and the campaign no longer reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
level_of, factors_between and check_factors read the record: a factor
is its entry, its level the values at its owned leaves, and a class
whose runs record different factors or leaves is refused as
analysis.treatment_records_disagree. analyze --experiment compares
treatment_of(cell) with the stored records. Reference levels order by
tag, commit, digest. factor_broader_than_variation is lifted. G1 to G5
and G7 are in the reference form and un-ignored; G10 is new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The golden corpus guard needs the corpus, so no earlier leaf ran it. Its
oracle keyed the 12 cells by digests of the old form (a typed `treatment`
root), and its import used rules that name no skill, so the cells lost the
skill. The generator now writes the skill as the value `{tag}` at
`skills.<name>`, as the import's `[[reference]]` rule stores it; the guard
imports with that rule added to the mini rules; the declared factor is
`skills.htn-creator`.

Only the cell hexes and the factor label move: the rates by cell, the
status counts and the 6 and 3 comparisons with 3 and 4 blocks are equal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reference factor also owns each inputs.<kind> leaf whose list of that
kind entries maps one to one onto its levels, by the path rule of the
readers flatten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The live context vectors record the hash of a stored manifest, and the
writers leaf changed what an import records in it (the treatment record
and its owned leaves). The two recorded hashes and the digests that
follow from them are regenerated with gen_live_context.py; `--check`
passes. The full workspace run found it, since no scoped run reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An input entry is the leaf inputs.<kind> in the verdict, so a factor
that owns it is matched as for a value leaf; an unowned one is still
refused as inputs. same_declaration is pub(crate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A native run's manifest takes its treatment record from the experiment
file's treatment_of, and a forced resume keeps the stored record. The
resolver runs once per tuple of reference-factor levels over one pin
store, so a factor-level reference is pinned before its readers: its
own source is in sources[] and a ref: build entry builds from it. A
reference shared by several tuples is still extracted once.
JobSpec.references and the per-plan pre-pass are gone; a job spec
holds one resolution per tuple, and the older spec is refused.

The import records one factor per varying leaf. A reference factor
also owns the leaves that map one to one onto its levels, input
entries included, and no two factors own the same leaf. A reference
factor crossed with model levels is planned, run and recorded level
by level through the binary.

Not covered: candler resolve prints only the first tuple's values,
and a leaf an import rule names as resolved is owned by the rule
alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records what the closing leaf deleted, the golden numbers against the
base, the gates, the consumer branch and what is left for the leaves
that own it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A comparison is now judged by what each factor owns: every leaf that
differs between two arms must lie in the owns of a declared factor
whose level differs, a held table is compared leaf by leaf, and an
input entry is matched against owns as any value is. The image, inputs
and environments are explained only when an owned reference differs
and a ref: build entry reads it. Blocks, levels, the factors between
two arms and the factor check read the stored record instead of path
prefixes; records of one class that disagree are refused with
analysis.treatment_records_disagree, and the old prefix code is
lifted. analyze --experiment compares the file's treatment with the
stored records and reports a level that only one side holds, a tag
that only one side names, and a commit that does not match.

The guard rows for a skill factor, a table-valued factor, a factor
below a held table, a fixed leaf under a factor, two nested factors
and a study with no skill now pass through the binary, the imported
mini corpus is comparable, and the golden design keeps its signs.

Not covered: a run-manifest/1 store is refused with its path but not
yet with format.schema_tag_mismatch; a ref: entry found only in a
plug-in fragment explains nothing; a reference with no commit is
compared by tag alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workspace docs build with -D warnings again: the layout module
links HarnessDriver::layout through the driver module, and the
reference pin step links takes_reference in candler-schemas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Writers and readers are merged, each after one verifier pass and a
coordinator rerun on its tip. Their Removes are corrected for names
that were already gone at the base. The integration leaf now ticks
the inventory itself, since no leaf did, and owns the one production
change left: the store hands the schema tag error of a run-manifest/1
record to analyze typed, so G10 is refused with its code. It also
carries the campaign's not-covered list into its report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A run-manifest/1 store is now refused with format.schema_tag_mismatch,
naming the manifest and the way out: the store checks a manifest's
schema tag before parsing it, through a new StoreError::SchemaTag arm
that answers with the tag error's own code. The transient confirm rows,
the inventory and the old form's remains in tests are gone, and the
retired-names sweep prints nothing.

The golden oracle is keyed by the reference form's cell digests, with
the same rates per cell, and the import's live context vectors record
the manifest bytes the import writes now. The workspace docs build with
-D warnings.

Not covered: candler resolve prints only the first tuple's values; a
ref: entry found only in a plug-in fragment explains nothing; a
reference with no commit is compared by tag; a leaf an import rule
names as resolved is owned by the rule alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The integration leaf is done: the depth 7 gate, its coordinator checks,
the not-covered list carried to the PR and the spend through depth 7
are recorded in the campaign README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A path that takes a reference also takes inline text, and the walk
counted any value there as a reference. A factor of inline workspace
texts was then a reference factor, so candler resolve ran the resolver,
and every preflight check, once per level. Only a table is a
reference now, as a member of instructions.global already was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The harness controls still built their cell with the typed root
treatment and a source for it, so building the control manifest
refused: its source named no value and lay under no typed root. The
tests that still passed the root, which the cell reader ignores, drop
it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The planner refused a value at a skill path that was no table through
the reference walk, which now yields tables only, so text, a number or
a list at skills.<name> was dropped instead of refused. The planner
checks such a value itself before walking the references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LittleCoinCoin

Copy link
Copy Markdown
Member Author

A resume of a factor with several reference levels fails as candler.internal

On dafc0eb3: plan an experiment whose factor has two reference levels, store both of its cells, then plan the same file again in the same store. The second plan is refused:

code=candler.internal
the stored cells sha256:8af5b19a… and sha256:8af5b19a… both answer one cell of the experiment

The reproduction uses the TEXTS factor of guard_reference_plan (instructions.global.claude-code at a.md and at b.md). The full test is under the fold below. No guard on this branch resumes a factor with several reference levels, which is why the suite stays green.

Cause

masked in crates/candler-core/src/runner/plan.rs replaces each whole ReferencePin (path, digest, commit, tag) with the string "pin", so that a moved pin stays a re-checked fact. answers compares those masked values. Two levels that differ only by their reference therefore compare equal, and every stored cell answers every fresh cell. In match_stored, a stored cell with two hits falls into the let [index] = found.as_slice() else branch, which builds StoredCellAmbiguous { first: digest.clone(), second: digest } from one cell. Its code is candler.internal.

The same defect exists on main with the [treatment] root, where the treatment never takes part in answers. The htn-creator-eval probe P2 found it there: a store of tags a and b, then a plan of tags a and c. A fix for main exists but is not pushed, because this PR retires everything it compares. The fix belongs here instead, in terms of references.

What the fix on main did, carried over

  1. answers keeps the reference's identity and masks only what is a fact. On main, the identity was name and tag, plus the commit when no tag pins one. The commit a tag pins was the re-checked fact. For a pin, the analogue would be to keep path and tag, keep commit when tag is absent, and mask digest (and the tag-pinned commit).
  2. A stored cell's own pin wins across the whole past experiment. When a stored cell answers a fresh cell whose pin equals its own, that fresh cell is held by it alone, and no other stored cell of that experiment answers it. Applying this only within one stored cell's hits leaves two holes:
    • one stored tag on two commits, planned with only the second commit, is refused as candler.internal;
    • the same store planned with the first commit and a third one is refused with no way through, where fact_changed (accepted by --force) is the right answer.
  3. The [index] branch gets its own code. On main this is PlanError::StoredCellAnswersMany → runner.stored_cell_answers_many (side experiment). It names the stored cell and the fresh cells it answers, and says "give each level its own tag, or run this experiment in a store of its own". With it, no message names one digest twice.
  4. runner.stored_cell_unknown says what to do: "declare every cell of the past experiment, or run this experiment in a store of its own".
  5. The guard covers seven rows, each with a mutation that turns it red. In reference terms:
    1. the P2 probe gives stored_cell_unknown, naming the cell of b;
    2. a resume in its own store replays every cell;
    3. one tag on two commits, where each level finds its own cell;
    4. a moved tag that two fresh levels share gives stored_cell_answers_many;
    5. the second of two stored levels planned alone gives stored_cell_unknown, naming the first;
    6. the first commit and a third one give fact_changed, which --force accepts;
    7. levels without a tag, where the commit is the identity.

Open design question

Which fields of a ReferencePin are the cell's identity, and which are a fact to re-check? The fix on main took the tag, plus the commit when there is no tag. A reference outside git has only path and digest. Edited content there could be read as another cell or as a moved fact, and the masking has to pick one.

Reproduction (appended to crates/candler-core/tests/it/guard_reference_plan.rs)
/// PROBE (not for commit): a two-level reference factor, stored, then planned again in its own
/// store. Prints the outcome of the resume.
#[tokio::test]
async fn probe_resume_of_two_reference_levels() {
    use candler_core::store::run::{Existing, RunWriter};
    use candler_schemas::execution::RunManifest;
    let dir = references_dir();
    let file = file_of("", TEXTS);
    let store = pin_store();
    let (_root, state, lock) = fresh_store();
    let facts = Facts::base();
    let mut ctx = plan_ctx(&state, &lock, &facts);
    ctx.driver = Some(Arc::new(ClaudeCodeDriver::new()));
    let held = resolve_references(&file, dir.path(), &store, &resolution(&facts), None)
        .await
        .expect("the references resolve");
    let first = plan_runs(&ctx, &file, Levels::from(held.as_slice()).with_store(&store), Force::No, PlanMode::Check)
        .expect("a first plan");
    assert_eq!(first.fresh.len(), 2);
    for (digest, cell) in &first.fresh {
        let comparable = serde_json::to_value(cell).expect("JSON");
        let mut paths: Vec<String> = vec!["harness".into()];
        if !cell.inputs().is_empty() { paths.push("inputs".into()); }
        if !cell.environments().is_empty() { paths.push("environments".into()); }
        paths.extend(cell.values().iter().map(|v| v.path().to_string()));
        paths.sort();
        let sources: Vec<serde_json::Value> = paths.iter().map(|p| json!({"path": p, "source": {"kind": "experiment_file"}})).collect();
        let manifest: RunManifest = serde_json::from_value(json!({
            "schema": "run-manifest/2",
            "run": {"cell": digest.to_string(), "replicate": 1, "attempt": 1},
            "experiment": first.experiment.to_string(),
            "treatment": serde_json::to_value(first.treatments.get(digest).expect("a record")).expect("JSON"),
            "comparable": comparable,
            "sources": sources,
            "secrets": [{"name": "API_KEY", "present": true}],
            "measured": [], "deviations": [], "integrity": {"kind": "valid"},
        })).expect("a manifest");
        RunWriter::create(&state, &manifest, Existing::Refuse).expect("create").done().expect("seal");
    }
    let again = plan_runs(&ctx, &file, Levels::from(held.as_slice()).with_store(&store), Force::No, PlanMode::Check);
    match again {
        Ok(out) => eprintln!("PROBE-RESUME: Ok plans={} sealed={}", out.plans.len(), out.sealed.len()),
        Err(error) => eprintln!("PROBE-RESUME: Err code={} message={error}", error.code()),
    }
}

Run with cargo nextest run -p candler-core -E 'test(/probe_resume_of_two_reference_levels/)' --no-capture; it prints PROBE-RESUME: Err code=candler.internal ….

A stored cell answered a fresh cell by comparing their values with
each reference pin replaced by one placeholder. In an experiment whose
cells differ only by a reference, every stored cell answered every
fresh cell, and a resume of that experiment in its own store was
refused as candler.internal, naming one stored cell twice.

A pin is now compared by its identity: its path and tag, and its
commit when no tag names one. The digest, and the commit a tag names,
stay re-checked facts (runner.fact_changed, accepted by --force), so a
moved tag, or edited content in a source that is no git checkout, is a
changed fact and not another cell. A stored cell that answers a fresh
cell holding its own pins holds that cell alone across its past
experiment. A stored cell still left answering several fresh cells is
refused with the new PlanError::StoredCellAnswersMany, code
runner.stored_cell_answers_many, side experiment; PlanError is
non_exhaustive, so the variant is additive.

The runner.stored_cell_unknown row now says what to do, and the
architecture states which stored cell a resume replays.

The guard resumes the two-text factor the htn-creator-eval report
reproduced, and covers eight rows with crafted pins: the probe of tags
a and b planned as a and c, its resume, one tag on two commits, the
second of those planned alone, a moved commit with and without
--force, a moved tag two fresh levels share, untagged commits, and
edited content without git. Masking an untagged commit, or preferring
a stored cell's own pin only among its own hits, turns it red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LittleCoinCoin
LittleCoinCoin merged commit ff60548 into main Dec 4, 2026
8 checks passed
@LittleCoinCoin
LittleCoinCoin deleted the feat/treatment-record branch December 4, 2026 04:13
LittleCoinCoin added a commit that referenced this pull request Dec 4, 2026
## Why

The configuration-by-reference campaign landed in #86 with every leaf
task done, but the roadmap's folder nodes still read planned or in
progress, so the campaign looked open.

## Changes

- The six folder nodes under `__roadmap__/treatment-record/` now read
done. The change was made with `dirtree-rdm update`, and every README
passes `dirtree-rdm validate`.

## Not covered

- No code or design change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant