test_acceptance_identity.py

tests/test_acceptance_identity.py

What produced a number, recorded beside it.

test_a_dated_model_is_not_recorded_as_floating

None test_acceptance_identity.test_a_dated_model_is_not_recorded_as_floating(Path tmp_path, monkeypatch)

A dated model must not be recorded as floating.

tests/test_acceptance_identity.py:444

Show on the map →

Called by none

Calls cmd_generate

Checks

  • assert cli.cmd_generate(args) == 0
  • assert "models_floating" not in window, f"a dated id was reported as floating: {window}"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_a_dated_model_is_not_recorded_as_floating → cmd_generate → tool_identity → _substrate → compiled_languages
Source · 42 lines
def test_a_dated_model_is_not_recorded_as_floating(tmp_path: Path, monkeypatch) -> None:
    """ABSENT RATHER THAN EMPTY. A run where nothing floated carries no `models_floating` key at
    all, so "nothing floated" and "nobody checked" cannot read alike — and a reader who finds the
    key knows it means something.

    @brief Dated models are not flagged.
    @return None.
    @version 1
    """
    import json

    from acceptance import __main__ as cli
    from acceptance import execute

    FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"
    monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)
    ## FIXTURE, NOT BEHAVIOUR: `generate` now refuses a modified clew tree, and this test runs
    ## in a working checkout. The tree check is covered by tests/test_tool_tree_refusal.py.
    monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)
    monkeypatch.setattr(
        cli,
        "run_cell",
        lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, ok=True),
    )
    out = tmp_path / "answers"
    args = cli.argparse.Namespace(
        rubric=FREERTOS,
        models=["claude-sonnet-4-5-20250929"],
        replicates=1,
        seed=7,
        repo=tmp_path / "repo",
        out=out,
        mcp_config=None,
        timeout=60,
        resume=False,
    )

    assert cli.cmd_generate(args) == 0
    window = json.loads((out / "run.json").read_text())["windows"][-1]
    assert "models_floating" not in window, f"a dated id was reported as floating: {window}"

Activity · 12 steps
lines 453–453import jsonlines 455–455from acceptance import __main__ as clilines 456–456from acceptance import executelines 458–458FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"lines 459–459monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)lines 462–462monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)lines 463–467monkeypatch.setattr( cli, "run_cell", lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, ok=True), )lines 468–468out = tmp_path / "answers"lines 469–479args = cli.argparse.Namespace( rubric=FREERTOS, models=["claude-sonnet-4-5-20250929"], replicates=1, seed=7, repo=tmp_path / "repo", out=out, mcp_config=None, timeout=60, resume=False, )lines 481–481assert cli.cmd_generate(args) == 0lines 482–482window = json.loads((out / "run.json").read_text())["windows"][-1]lines 483–483assert "models_floating" not in window, f"a dated id was reported as floating: {window}"

test_a_field_that_could_not_be_read_is_dropped_rather_than_blanked

None test_acceptance_identity.test_a_field_that_could_not_be_read_is_dropped_rather_than_blanked()

An unreadable field is absent, never empty.

tests/test_acceptance_identity.py:60

Show on the map →

Called by none

Calls tool_identity

Checks

  • assert "clew_commit" not in blank, "a sha that could not be read is not the empty sha"
  • assert "clew_dirty" not in blank, "and nothing may claim the tree was clean"
  • assert blank["clew_version"]
  • assert blank["substrate_languages"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_a_field_that_could_not_be_read_is_dropped_rather_than_blanked → tool_identity → _substrate → compiled_languages
Source · 18 lines
def test_a_field_that_could_not_be_read_is_dropped_rather_than_blanked() -> None:
    """ "NOBODY MEASURED" AND "NOTHING THERE" MUST NOT READ ALIKE. An empty string or an empty
    list in a published record reads as a finding; the key's absence reads as a gap. This is the
    same rule `clew/mcp_server/emptiness.py` enforces on the served scope.

    @brief Unreadable fields are omitted.
    @return None.
    @version 1
    """
    blank = identity.tool_identity(repo=Path("/nonexistent-tree-for-this-test"))
    assert "clew_commit" not in blank, "a sha that could not be read is not the empty sha"
    assert "clew_dirty" not in blank, "and nothing may claim the tree was clean"
    ## The fields that do not come from git are still there — a missing checkout is not a
    ## missing install.
    assert blank["clew_version"]
    assert blank["substrate_languages"]

Activity · 5 steps
lines 69–69blank = identity.tool_identity(repo=Path("/nonexistent-tree-for-this-test"))lines 70–70assert "clew_commit" not in blank, "a sha that could not be read is not the empty sha"lines 71–71assert "clew_dirty" not in blank, "and nothing may claim the tree was clean"lines 74–74assert blank["clew_version"]lines 75–75assert blank["substrate_languages"]

test_a_floating_model_is_accepted_and_recorded_as_floating

None test_acceptance_identity.test_a_floating_model_is_accepted_and_recorded_as_floating(Path tmp_path, monkeypatch)

A floating canonical model must be accepted and named in the window record.

tests/test_acceptance_identity.py:389

Show on the map →

Called by none

Calls cmd_generate

Checks

  • assert cli.cmd_generate(args) == 0, "a current-family model was refused; the harness is blocked"
  • assert window["models_floating"] == ["claude-haiku-5-5"], (f"the run accepted a floating id without recording it: {window}" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_a_floating_model_is_accepted_and_recorded_as_floating → cmd_generate → tool_identity → _substrate → compiled_languages
Source · 49 lines
def test_a_floating_model_is_accepted_and_recorded_as_floating(tmp_path: Path, monkeypatch) -> None:
    """**ACCEPTANCE WITHOUT DISCLOSURE WOULD REPRODUCE THE ORIGINAL DEFECT.** 1.1.0 answered with
    a floating id and recorded nothing about it. A date requirement then rejected every
    current-family model and blocked the harness, so the ruling is that the grid tracks the models
    and the run says which ids can move.

    Both halves asserted together: the run must SUCCEED on `claude-haiku-5-5` and must NAME it as
    floating. A change that accepted it silently passes the first assertion alone.

    @brief Floating models are accepted and disclosed.
    @return None.
    @version 1
    """
    import json

    from acceptance import __main__ as cli
    from acceptance import execute

    FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"
    monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)
    ## FIXTURE, NOT BEHAVIOUR: `generate` now refuses a modified clew tree, and this test runs
    ## in a working checkout. The tree check is covered by tests/test_tool_tree_refusal.py.
    monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)
    monkeypatch.setattr(
        cli,
        "run_cell",
        lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, ok=True),
    )
    out = tmp_path / "answers"
    args = cli.argparse.Namespace(
        rubric=FREERTOS,
        models=["claude-haiku-5-5"],
        replicates=1,
        seed=7,
        repo=tmp_path / "repo",
        out=out,
        mcp_config=None,
        timeout=60,
        resume=False,
    )

    assert cli.cmd_generate(args) == 0, "a current-family model was refused; the harness is blocked"

    window = json.loads((out / "run.json").read_text())["windows"][-1]
    assert window["models_floating"] == ["claude-haiku-5-5"], (
        f"the run accepted a floating id without recording it: {window}"
    )

Activity · 12 steps
lines 402–402import jsonlines 404–404from acceptance import __main__ as clilines 405–405from acceptance import executelines 407–407FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"lines 408–408monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)lines 411–411monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)lines 412–416monkeypatch.setattr( cli, "run_cell", lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, ok=True), )lines 417–417out = tmp_path / "answers"lines 418–428args = cli.argparse.Namespace( rubric=FREERTOS, models=["claude-haiku-5-5"], replicates=1, seed=7, repo=tmp_path / "repo", out=out, mcp_config=None, timeout=60, resume=False, )lines 430–430assert cli.cmd_generate(args) == 0, "a current-family model was refused; the harness is blocked"lines 432–432window = json.loads((out / "run.json").read_text())["windows"][-1]lines 433–435assert window["models_floating"] == ["claude-haiku-5-5"], ( f"the run accepted a floating id without recording it: {window}" )

test_a_stale_editable_install_does_not_silently_misstate_the_version

None test_acceptance_identity.test_a_stale_editable_install_does_not_silently_misstate_the_version(tmp_path, monkeypatch)

The recorded version is the checkout's, and a stale install is disclosed not hidden.

tests/test_acceptance_identity.py:491

Show on the map →

Called by none

Calls tool_identity

Checks

  • assert out["clew_version"] == "9.9.9"
  • assert out["clew_version_installed"] == "1.1.0"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_a_stale_editable_install_does_not_silently_misstate_the_version → tool_identity → _substrate → compiled_languages
Source · 25 lines
def test_a_stale_editable_install_does_not_silently_misstate_the_version(
    tmp_path, monkeypatch
) -> None:
    """FOUND ON A REAL PRE-FLIGHT, NOT IMAGINED. `pip install -e .` writes the version into
    `.dist-info` ONCE; bumping `pyproject.toml` afterwards does not rewrite it. Three
    `provision.json` files for the 1.2.0 grid therefore stamped `clew_version: 1.1.0` onto a
    1.1.3 tree, and nothing said so — a wrong measurement presented as a fact, which is worse
    than an absent one.

    THE CHECKOUT WINS, because the pyproject in the tree describes the code that will run; the
    installed metadata describes an install event that is over. The stale value is KEPT under
    its own key rather than dropped, since "the operator's environment disagrees with the tree"
    is itself evidence a reader of a published number wants.

    @brief The checkout's version is recorded, and disagreement is disclosed.
    @return None.
    @version 1
    """
    (tmp_path / "pyproject.toml").write_text('[project]\nname = "clew-trace"\nversion = "9.9.9"\n')
    monkeypatch.setattr(identity, "_installed_version", lambda: "1.1.0")
    out = identity.tool_identity(tmp_path)
    assert out["clew_version"] == "9.9.9"
    assert out["clew_version_installed"] == "1.1.0"

Activity · 5 steps
lines 509–509(tmp_path / "pyproject.toml").write_text('[project]\nname = "clew-trace"\nversion = "9.9.9"\n')lines 510–510monkeypatch.setattr(identity, "_installed_version", lambda: "1.1.0")lines 511–511out = identity.tool_identity(tmp_path)lines 512–512assert out["clew_version"] == "9.9.9"lines 513–513assert out["clew_version_installed"] == "1.1.0"

test_agreement_records_one_version_and_no_disagreement_key

None test_acceptance_identity.test_agreement_records_one_version_and_no_disagreement_key(tmp_path, monkeypatch)

When install and checkout agree, no disagreement key is invented.

tests/test_acceptance_identity.py:521

Show on the map →

Called by none

Calls tool_identity

Checks

  • assert out["clew_version"] == "9.9.9"
  • assert "clew_version_installed" not in out

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_agreement_records_one_version_and_no_disagreement_key → tool_identity → _substrate → compiled_languages
Source · 13 lines
def test_agreement_records_one_version_and_no_disagreement_key(tmp_path, monkeypatch) -> None:
    """A FIELD THAT DOES NOT APPLY IS ABSENT. `clew_version_installed` present and equal would
    read as a flag raised on every record, which is how a real flag stops being noticed.

    @brief No spurious disagreement field.
    @return None.
    @version 1
    """
    (tmp_path / "pyproject.toml").write_text('[project]\nname = "clew-trace"\nversion = "9.9.9"\n')
    monkeypatch.setattr(identity, "_installed_version", lambda: "9.9.9")
    out = identity.tool_identity(tmp_path)
    assert out["clew_version"] == "9.9.9"
    assert "clew_version_installed" not in out

1 more lines, not shown

Activity · 5 steps
lines 529–529(tmp_path / "pyproject.toml").write_text('[project]\nname = "clew-trace"\nversion = "9.9.9"\n')lines 530–530monkeypatch.setattr(identity, "_installed_version", lambda: "9.9.9")lines 531–531out = identity.tool_identity(tmp_path)lines 532–532assert out["clew_version"] == "9.9.9"lines 533–533assert "clew_version_installed" not in out

test_each_generate_appends_a_window_rather_than_overwriting

None test_acceptance_identity.test_each_generate_appends_a_window_rather_than_overwriting(Path tmp_path, monkeypatch)

Each generate must append a window record rather than overwrite the previous one.

tests/test_acceptance_identity.py:320

Show on the map →

Called by none

Calls cmd_generate

Checks

  • assert len(first) == 1, f"the first generate recorded {len(first)} window(s)"
  • assert [w["ordinal"] for w in windows] == [1, 2], (f"windows did not accumulate in order; got {[w.get('ordinal') for w in windows]}" )
  • assert windows[0] == first[0], "the first window's record was rewritten by the second"
  • assert "clew_build_version" in windows[1], (f"a window carries no tool identity, so it cannot be attributed: {windows[1]}" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_each_generate_appends_a_window_rather_than_overwriting → cmd_generate → tool_identity → _substrate → compiled_languages
Source · 63 lines
def test_each_generate_appends_a_window_rather_than_overwriting(
    tmp_path: Path, monkeypatch
) -> None:
    """**THE 1.1.0 GRID CANNOT SAY HOW MANY SITTINGS BUILT IT.** `resumed` recorded which stems
    came from before — the right fact — but every `generate` REWROTE `run.json`, so after three
    capacity windows the record described only the last one. A grid assembled over several windows
    must not read as one pass.

    TWO WINDOWS ARE RUN AND BOTH ARE ASSERTED PRESENT, in order, with the first one's identity
    still intact. Asserting only `len(windows) == 2` would pass an implementation that appended a
    fresh pair each time, and asserting only the last would pass the overwrite this fixes.

    @brief Windows accumulate across generate invocations.
    @return None.
    @version 1
    """
    import json

    from acceptance import __main__ as cli
    from acceptance import execute

    FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"
    monkeypatch.setattr(
        cli,
        "run_cell",
        lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, True),
    )
    monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)
    ## FIXTURE, NOT BEHAVIOUR: `generate` now refuses a modified clew tree, and this test runs
    ## in a working checkout. The tree check is covered by tests/test_tool_tree_refusal.py.
    monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)
    out = tmp_path / "answers"

    def once(resume: bool) -> None:
        cli.cmd_generate(
            cli.argparse.Namespace(
                rubric=FREERTOS,
                models=["claude-sonnet-4-5-20250929"],
                replicates=1,
                seed=7,
                repo=tmp_path / "repo",
                out=out,
                mcp_config=None,
                timeout=60,
                resume=resume,
            )
        )

    once(resume=False)
    first = json.loads((out / "run.json").read_text())["windows"]
    once(resume=True)
    windows = json.loads((out / "run.json").read_text())["windows"]

    assert len(first) == 1, f"the first generate recorded {len(first)} window(s)"
    assert [w["ordinal"] for w in windows] == [1, 2], (
        f"windows did not accumulate in order; got {[w.get('ordinal') for w in windows]}"
    )
    assert windows[0] == first[0], "the first window's record was rewritten by the second"
    assert "clew_build_version" in windows[1], (
        f"a window carries no tool identity, so it cannot be attributed: {windows[1]}"
    )

Activity · 17 steps
lines 336–336import jsonlines 338–338from acceptance import __main__ as clilines 339–339from acceptance import executelines 341–341FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"lines 342–346monkeypatch.setattr( cli, "run_cell", lambda cell, *_a, **_k: execute.CellResult(cell.stem(), cell.arm, cell.model, True), )lines 347–347monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)lines 350–350monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)lines 351–351out = tmp_path / "answers"lines 353–366def once(resume: bool) -> None: cli.cmd_generate( cli.argparse.Namespace( rubric=FREERTOS, models=["claude-sonnet-4-5-20250929"], replicates=1, seed=7, repo=tmp_path / "repo", out=out, mcp_config=None, timeout=60, resume=resume, ) )lines 368–368once(resume=False)lines 369–369first = json.loads((out / "run.json").read_text())["windows"]lines 370–370once(resume=True)lines 371–371windows = json.loads((out / "run.json").read_text())["windows"]lines 373–373assert len(first) == 1, f"the first generate recorded {len(first)} window(s)"lines 374–376assert [w["ordinal"] for w in windows] == [1, 2], ( f"windows did not accumulate in order; got {[w.get('ordinal') for w in windows]}" )lines 377–377assert windows[0] == first[0], "the first window's record was rewritten by the second"lines 378–380assert "clew_build_version" in windows[1], ( f"a window carries no tool identity, so it cannot be attributed: {windows[1]}" )

test_generate_refuses_a_shortcut_answering_model

None test_acceptance_identity.test_generate_refuses_a_shortcut_answering_model(Path tmp_path, monkeypatch)

generate must refuse an answering model that is a client-resolved shortcut.

tests/test_acceptance_identity.py:267

Show on the map →

Called by none

Calls cmd_generate

Checks

  • assert cli.cmd_generate(args) == 1, "a client-resolved shortcut was accepted"
  • assert not spent, f"cells were spent before the refusal: {spent}"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_generate_refuses_a_shortcut_answering_model → cmd_generate → tool_identity → _substrate → compiled_languages
Source · 47 lines
def test_generate_refuses_a_shortcut_answering_model(tmp_path: Path, monkeypatch) -> None:
    """**THIS IS THE 1.1.0 GAP, NARROWED BY A LATER RULING.** The judge was checked from the first
    release and the model being GRADED was never asked, so the published grid was judged by
    `claude-sonnet-4-5-20250929` and answered by `claude-haiku-5-5` with nothing recording it.

    v2: the fixture is `sonnet`, not `claude-haiku-5-5`. A first fix demanded a DATED id and
    thereby rejected every current-family model, blocking the harness; the owner ruled that the
    grid should move with the models and that the requirement is faithful recording, not
    immutability. A client-resolved shortcut is still refused, because the client maps it through
    configuration this harness never records.

    It refuses BEFORE any cell runs: `run_cell` is replaced with something that records being
    called, and the assertion is that it never was. A check that refused after spending the grid
    would pass a test that only looked at the exit code.

    @brief An alias answering model is refused before spending anything.
    @return None.
    @version 1
    """
    import json  # noqa: F401

    from acceptance import __main__ as cli

    FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"
    spent: list[str] = []
    monkeypatch.setattr(cli, "run_cell", lambda cell, *_a, **_k: spent.append(cell.stem()))
    monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)
    ## FIXTURE, NOT BEHAVIOUR: `generate` now refuses a modified clew tree, and this test runs
    ## in a working checkout. The tree check is covered by tests/test_tool_tree_refusal.py.
    monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)
    out = tmp_path / "answers"
    args = cli.argparse.Namespace(
        rubric=FREERTOS,
        models=["sonnet"],
        replicates=1,
        seed=7,
        repo=tmp_path / "repo",
        out=out,
        mcp_config=None,
        timeout=60,
        resume=False,
    )

    assert cli.cmd_generate(args) == 1, "a client-resolved shortcut was accepted"
    assert not spent, f"cells were spent before the refusal: {spent}"

Activity · 11 steps
lines 286–286import jsonlines 288–288from acceptance import __main__ as clilines 290–290FREERTOS = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"lines 291–291spent: list[str] = []lines 292–292monkeypatch.setattr(cli, "run_cell", lambda cell, *_a, **_k: spent.append(cell.stem()))lines 293–293monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)lines 296–296monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)lines 297–297out = tmp_path / "answers"lines 298–308args = cli.argparse.Namespace( rubric=FREERTOS, models=["sonnet"], replicates=1, seed=7, repo=tmp_path / "repo", out=out, mcp_config=None, timeout=60, resume=False, )lines 310–310assert cli.cmd_generate(args) == 1, "a client-resolved shortcut was accepted"lines 311–311assert not spent, f"cells were spent before the refusal: {spent}"

test_identity_records_the_clew_and_substrate_under_test

None test_acceptance_identity.test_identity_records_the_clew_and_substrate_under_test()

The identity names the tool, not only what was asked of it.

tests/test_acceptance_identity.py:22

Show on the map →

Called by none

Calls tool_identity

Checks

  • assert got["clew_version"]
  • assert len(got["clew_commit"]) == 40, "a short sha is ambiguous across a fork"
  • assert isinstance(got["clew_dirty"], bool), "a measurement, present even when False"
  • assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)
  • assert got["substrate_version"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_identity_records_the_clew_and_substrate_under_test → tool_identity → _substrate → compiled_languages
Source · 17 lines
def test_identity_records_the_clew_and_substrate_under_test() -> None:
    """`run.json` recorded target, commit, rubric version and digest, seed, models and
    replicates — every input except the one thing the grid is a measurement OF. A reader could
    not tell a score produced by 1.1.0 from one produced by 1.0.39.

    @brief The identity carries clew and substrate.
    @return None.
    @version 1
    """
    got = identity.tool_identity()
    assert got["clew_version"]
    assert len(got["clew_commit"]) == 40, "a short sha is ambiguous across a fork"
    assert isinstance(got["clew_dirty"], bool), "a measurement, present even when False"
    assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)
    assert got["substrate_version"]

Activity · 6 steps
lines 31–31got = identity.tool_identity()lines 32–32assert got["clew_version"]lines 33–33assert len(got["clew_commit"]) == 40, "a short sha is ambiguous across a fork"lines 34–34assert isinstance(got["clew_dirty"], bool), "a measurement, present even when False"lines 35–35assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)lines 36–36assert got["substrate_version"]

test_provision_writes_a_record_naming_the_build

None test_acceptance_identity.test_provision_writes_a_record_naming_the_build(Path tmp_path)

A provisioned target leaves a record naming the build, not just the pin.

tests/test_acceptance_identity.py:81

Checks

  • assert got["commit"] == rubric.commit
  • assert got["build_version"] == "8"
  • assert "substrate_languages" in got
  • assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_provision_writes_a_record_naming_the_build → write_provision_record → tool_identity → _substrate → compiled_languages
Source · 32 lines
def test_provision_writes_a_record_naming_the_build(tmp_path: Path) -> None:
    """`build_version` WAS READ AND ONLY PRINTED. It survived a run only if the operator
    redirected stdout, and the database that carries it is gitignored on purpose. So the one
    number describing the index under test reached no committed file.

    @brief provision.json carries the build.
    @return None.
    @version 1
    """
    import json

    from acceptance import provision
    from acceptance.grader.rubric import load

    rubric = load(
        Path(__file__).resolve().parent.parent / "acceptance/targets/mbedtls/questions.yaml"
    )
    out = tmp_path / "provision.json"
    provision.write_provision_record(
        rubric,
        tmp_path / "clew.db",
        {"build_version": "8", "tool.substrate_version": "0.11.2"},
        out,
    )
    got = json.loads(out.read_text())
    assert got["commit"] == rubric.commit
    assert got["build_version"] == "8"
    ## THE FIELD A VERSION STRING CANNOT SUBSTITUTE FOR.
    assert "substrate_languages" in got
    assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)

Activity · 11 steps
lines 90–90import jsonlines 92–92from acceptance import provisionlines 93–93from acceptance.grader.rubric import loadlines 95–97rubric = load( Path(__file__).resolve().parent.parent / "acceptance/targets/mbedtls/questions.yaml" )lines 98–98out = tmp_path / "provision.json"lines 99–104provision.write_provision_record( rubric, tmp_path / "clew.db", {"build_version": "8", "tool.substrate_version": "0.11.2"}, out, )lines 105–105got = json.loads(out.read_text())lines 106–106assert got["commit"] == rubric.commitlines 107–107assert got["build_version"] == "8"lines 109–109assert "substrate_languages" in gotlines 110–110assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)

test_run_json_carries_the_tool_identity

None test_acceptance_identity.test_run_json_carries_the_tool_identity(Path tmp_path, monkeypatch)

The run record names the tool as well as the inputs.

tests/test_acceptance_identity.py:116

Show on the map →

Called by none

Calls cmd_generate

Checks

  • assert cli.cmd_generate(args) == 0
  • assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)
  • assert "substrate_languages" in got

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_run_json_carries_the_tool_identity → cmd_generate → tool_identity → _substrate → compiled_languages
Source · 47 lines
def test_run_json_carries_the_tool_identity(tmp_path: Path, monkeypatch) -> None:
    """A reader holding only `answers/` must still be able to attribute the numbers. Provisioning
    records the same fields, but its file sits beside a gitignored database and a run assembled
    over several windows may be re-provisioned between them.

    @brief run.json carries clew.
    @return None.
    @version 1
    """
    import json

    from acceptance import __main__ as cli
    from acceptance import execute

    monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)
    ## FIXTURE, NOT BEHAVIOUR: `generate` now refuses a modified clew tree, and this test runs
    ## in a working checkout. The tree check is covered by tests/test_tool_tree_refusal.py.
    monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)
    monkeypatch.setattr(
        cli,
        "run_cell",
        lambda cell, *_a, **_k: execute.CellResult(
            cell.stem(), cell.arm, cell.model, True, tool_calls=1
        ),
    )
    rubric = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"
    out = tmp_path / "answers"
    args = cli.argparse.Namespace(
        rubric=rubric,
        ## FIXTURE, NOT BEHAVIOUR. This said `m` (resp. `sonnet`) until `--models` began
        ## refusing an alias. What this test guards is unchanged; only the example string
        ## had to become a real pinned id to reach the code under test.
        models=["claude-sonnet-4-5-20250929"],
        replicates=1,
        seed=7,
        repo=tmp_path,
        out=out,
        mcp_config=None,
        timeout=60,
        resume=False,
    )
    assert cli.cmd_generate(args) == 0
    got = json.loads((out / "run.json").read_text())
    assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)
    assert "substrate_languages" in got

Activity · 13 steps
lines 125–125import jsonlines 127–127from acceptance import __main__ as clilines 128–128from acceptance import executelines 130–130monkeypatch.setattr(cli, "check_revision", lambda *_a, **_k: None)lines 133–133monkeypatch.setattr(cli, "check_tool_tree", lambda *_a, **_k: None)lines 134–140monkeypatch.setattr( cli, "run_cell", lambda cell, *_a, **_k: execute.CellResult( cell.stem(), cell.arm, cell.model, True, tool_calls=1 ), )lines 141–141rubric = Path(__file__).resolve().parent.parent / "acceptance/targets/freertos/questions.yaml"lines 142–142out = tmp_path / "answers"lines 143–156args = cli.argparse.Namespace( rubric=rubric, ## FIXTURE, NOT BEHAVIOUR. This said `m` (resp. `sonnet`) until `--models` began ## refusing an alias. What this test guards is unchanged; only the example string ## had to become a real pinned id to reach the code under test. models=["claude-sonnet-4-5-20250929"], replicates=1, seed=7, repo=tmp_path, out=out, mcp_config=None, timeout=60, resume=False, )lines 157–157assert cli.cmd_generate(args) == 0lines 158–158got = json.loads((out / "run.json").read_text())lines 159–159assert got["clew_build_version"] == str(identity.CLEW_BUILD_VERSION)lines 160–160assert "substrate_languages" in got

test_the_substrate_language_set_is_recorded_not_just_its_version

None test_acceptance_identity.test_the_substrate_language_set_is_recorded_not_just_its_version()

The language set is what distinguishes the fork, so it is recorded as a set.

tests/test_acceptance_identity.py:42

Show on the map →

Called by none

Calls tool_identity

Checks

  • assert langs == sorted(langs), "recorded sorted, so two runs diff rather than reorder"
  • assert "c" in langs and "python" in langs

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-PIPE-012inferredtest_the_substrate_language_set_is_recorded_not_just_its_version → tool_identity → _substrate → compiled_languages
Source · 15 lines
def test_the_substrate_language_set_is_recorded_not_just_its_version() -> None:
    """THE VERSION STRING CANNOT SETTLE THIS. The fork carrying 1.1.0's five grammars reports
    `0.11.2`, byte-identical to the published wheel, because the pull request carries no bump —
    which is the whole reason `clew.substrate` exists. A run record holding only the version
    cannot say which wheel answered, so it holds the compiled-in keys.

    @brief Languages are recorded.
    @return None.
    @version 1
    """
    langs = identity.tool_identity()["substrate_languages"]
    assert langs == sorted(langs), "recorded sorted, so two runs diff rather than reorder"
    assert "c" in langs and "python" in langs

Activity · 3 steps
lines 52–52langs = identity.tool_identity()["substrate_languages"]lines 53–53assert langs == sorted(langs), "recorded sorted, so two runs diff rather than reorder"lines 54–54assert "c" in langs and "python" in langs