Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tests/compass/test_spec_verbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import copy
import importlib.util
import sys

import pytest

Expand Down Expand Up @@ -565,7 +566,10 @@ def test_a_transfer_keeps_the_source_stack_out_of_this_machines_pin():
checked = validate(combination)
assert not checked.ok
assert checked.refusals[0].rule is Rule.PINNED_STACK
assert checked.refusals[0].what.startswith("'tier2' (machine ")
assert checked.refusals[0].what.startswith(
"'tier2' (machine 'mi355x-8gpu-2node', transferred-from:mi300x-8gpu, "
"by a person on 2026-09-18) carried "
)
assert checked.refusals[0].what.endswith(
"carried constants over from 'mi300x-8gpu', measured against rocm "
"'7.0.2', into a spec pinned to rocm '7.2.4'"
Comment on lines +569 to 575

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N1 (non-blocking): the startswith and the endswith do not cover the whole refusal; the middle is free.

Principle 8: "Every claim carries its measurement. A number without a source is a defect." The PR body and the commit message both say that, with this endswith, the two checks "overlap and cover the whole refusal". They share the word carried , but nothing makes them share the same occurrence. Any text between the needle's carried and the tail's carried constants over from passes both.

Measured on node 18 (reviewer's harness plus one mutant, GAPm): validate.py:398 becomes f"{fragment.stanza()} carried {merged.fragments[-1].stanza()} carried constants over from ". The line count is kept at 452. The refusal then reads 'tier2' (machine …, transferred-from:mi300x-8gpu, by a person on 2026-09-18) carried 'links' (machine …, probed, by a person on 2026-09-18) carried constants over from 'mi300x-8gpu', measured against ….

  • Tip a9c7aed9d: 1309 passed, 6 skipped.
  • Head c26a3a507: 1307 passed, 6 skipped: green. Both checks pass.

So this test does not hold the whole text; it holds the two ends.

Fix (also the ponytail shrink:, 8 lines → 5). The refusal is fully determined by this test's own fixtures, so a single equality holds all of it, the way the first_hand control at L613 already does:

    assert checked.refusals[0].what == (
        "'tier2' (machine 'mi355x-8gpu-2node', transferred-from:mi300x-8gpu, "
        "by a person on 2026-09-18) carried constants over from 'mi300x-8gpu', "
        "measured against rocm '7.0.2', into a spec pinned to rocm '7.2.4'"
    )

Measured on node 18. I applied this and N2's needle to a copy of the head:

  • ruff check and format --check both give rc 0;
  • the file goes from 2100 lines to 2096;
  • both tests pass;
  • GAPm goes red, as do CA2mL and CA2L.

Non-blocking. The brief's named mutant CA2mL is red at the head, and the gap is a new mutant outside #361.

The false sentence is in the PR body and in c26a3a507's message. Under the no-amend rule, the message stays. So if this is fixed here, the fix commit's message should say the earlier sentence was wrong, and the PR body should be corrected. If it is not fixed here, file the gap as an issue.

Expand Down Expand Up @@ -598,7 +602,10 @@ def test_a_saved_transfer_merged_again_names_the_merge_that_dropped_its_pin():
rest = fragments()[:2] + [fragment("links", LINKS)]
(refused,) = validate(merge([saved] + rest)).refusals
assert refused.rule is Rule.PINNED_STACK
assert refused.what.startswith("'t.yaml' (machine ")
assert refused.what.startswith(
"'t.yaml' (machine 'mi355x-8gpu-2node', transferred-from:mi300x-8gpu, "
"by a person on 2026-09-18) carried constants over from "
)
assert "over from 'mi300x-8gpu', and its provenance names the" in refused.what
assert "fragments an earlier merge built it from" in refused.what
Comment on lines +605 to 610

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N2 (non-blocking): the same gap here, between the needle's over from and the in check's over from.

Principle 8, "Every claim carries its measurement", as in N1. This needle now ends carried constants over from , and the next line looks for over from 'mi300x-8gpu', and its provenance names the anywhere in the string. Nothing ties those two over froms to the same occurrence.

Measured on node 18 (mutant GAPs): validate.py:368 becomes f"{fragment.stanza()} carried constants over from {merged.fragments[-1].stanza()} over from ". The line count is kept at 452. The refusal reads 't.yaml' (…) carried constants over from 'links' (machine …, probed, …) over from 'mi300x-8gpu', and its provenance names the ….

  • Tip a9c7aed9d: 1309 passed, 6 skipped.
  • Head c26a3a507: 1307 passed, 6 skipped: green.

This test does not claim to cover the whole refusal, so no sentence is false here, and the named mutant CA2L is red. It is recorded so the next reader does not count this test as holding the middle.

The cheapest close is one contiguous needle through to the end of the first clause. Both in lines (L609–610) are then subsumed, so the change is net −1 line:

    assert refused.what.startswith(
        "'t.yaml' (machine 'mi355x-8gpu-2node', transferred-from:mi300x-8gpu, "
        "by a person on 2026-09-18) carried constants over from 'mi300x-8gpu', "
        "and its provenance names the fragments an earlier merge built it from"
    )

The text is the refusal's own, as printed at the head. Measured with N1's change on a copy of the head:

  • ruff is clean;
  • both tests pass;
  • GAPs goes red (1 failed, …merged_again_names_the_merge_that_dropped_its_pin), and CA2L stays red.

Or leave it as it is and file the gap.

bare = fragment("tier2", TIER2, method="transferred-from:mi300x-8gpu")
Expand Down Expand Up @@ -2008,6 +2015,7 @@ def reimported_validate(name):
)
module = importlib.util.module_from_spec(loaded)
loaded.loader.exec_module(module)
assert loaded.name not in sys.modules

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R1-3 is held, and it holds for the right reason. One optional shrink: follows.

Principle 8, "Every claim carries its measurement." "Does not register it" is the docstring's claim, and this line is its measurement.

What loaded.name is. It is f"atom.compass.spec.{name}": atom.compass.spec.validate_with_a_table_no_probe_is_named_for and atom.compass.spec.validate_with_every_width_filled. The name is synthetic, and nothing in ATOM registers it. That does not make the check vacuous. It is the spec.name the importlib recipe (module_from_spec, then sys.modules[spec.name] = module) would register under, so it is the key a regression in this helper would use.

Measured on node 18:

  • REGown (sys.modules[loaded.name] = module after exec_module): 1309 passed at the tip. At the head it gives 2 failed (test_a_width_table_no_probe_is_named_for_is_refused_and_not_an_import_error and test_a_probe_given_the_width_that_has_none_empties_the_probe_tables), both at assert 'atom.compass.spec.validate_with_…' not in {…}, this line.
  • A probe that snapshots sys.modules around one reimported_validate("probe_instance") call finds no new keys, at the tip and at the head. So the assertion is not passing because the helper registers under some other key.

What it does not see. A registration under any other key, for example the bare name, passes. This is mutant REGbare: 1307 passed at the head: green. I would not ask for that to be closed: nothing plausible registers under the bare name.

shrink: assert module not in sys.modules.values() covers every key, so it also subsumes the canonical-name check on L2019 (REG). The two lines become one. The probe confirms it reads False for an unregistered instance at both trees. This is optional.

assert importlib.import_module("atom.compass.spec.validate") is not module
return module

Expand Down