Skip to content

Tests: move seventeen capsule-reading legacy tests to the mirror, expected to fail inside a capsule - #341

Merged
ccozianu merged 1 commit into
mainfrom
ws-maintenance/legacy-xfail-mirror
Nov 5, 2026
Merged

ccozianu merged 1 commit into
mainfrom
ws-maintenance/legacy-xfail-mirror

Conversation

@ccozianu

@ccozianu ccozianu commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

What

Seventeen tests failed in the owner's capsule after the sync with main at cc8f128, and fail the same on a clean checkout of main, so no workstream broke them. Each reads a precondition from outside itself, against Unit Tests rule 2:

  • thirteen inherit the capsule's mounted launcher settings at /etc/devcapsule/home/settings.toml, where a vendor download is accepted, because private_user_directories has no hold on that path (six in test_trust.py, three in test_capability_commands_v2.py, one each in test_capability_minimums.py, test_console_channel.py, test_environment_realization.py, test_project_init.py);
  • three in test_repository_manifest_compatibility.py read this checkout's live .devcapsule/devcapsule.toml;
  • test_replaced_scope_word_is_absent in test_home.py walks an ignored .venv under the sample projects.

The owner's disposition

Mark them expected to fail with the reason TODO: fix the wrong approach to testing, and move them out of the legacy files so the convention gate keeps holding (rule 5 never marks a legacy test expected to fail).

Each test leaves its legacy file verbatim, with a one-line docstring naming its cause, for a mirror file under tests/unit/devcapsule/legacy_refactoring/, one per legacy file because their project fixtures and config and snapshot helpers collide by name. The mirror files import their fixtures and helpers from the legacy modules as the existing mirror files do. The targets are the temporary package devcapsule/legacy_refactoring/: eight modules holding nothing but a docstring saying why they exist; each is deleted when its last test is rewritten against its real unit.

The marker is pytest.mark.xfail(IN_CAPSULE, ...), IN_CAPSULE being the presence of the launch context file. So the tests are expected to fail only inside a capsule, where they inherit its state; on the hosted workflow and on a host they remain the tests they were, and keep whatever safety they gave.

The one change to a body is the path to devcapsule-src in test_replaced_scope_word_is_absent, taken from the mirror file's deeper place.

Verification

In a capsule: nox -s tests green (2807 passed, 17 xfailed, 4 xpassed); the checker at 108 legacy files holding 1447 legacy tests, 30 files following the convention, 0 breaches; nox -s typecheck green. With the capsule condition faked off, the moved tests ran as real tests and only the three that read the owner's uncommitted schema-2 configuration failed.

Records

The maintenance status carries the diagnosis and queues the fix: each test rewritten against its real unit, the private-home fixture first, the targets deleted as they empty. The workstream table row matches.

🤖 Generated with Claude Code

Test coverage, from CI run

Changed lines covered 0% (0 of 8 measured changed lines; 8 uncovered)
Overall devcapsule 88.2% (17,908 of 19,843 statements)

…ected to fail inside a capsule

Seventeen tests failed in the owner's capsule after the sync with main at
cc8f128, and fail the same on a clean checkout of main: thirteen inherit
the capsule's mounted launcher settings, where a vendor download is
accepted; three read this checkout's live .devcapsule configuration; one
walks an ignored directory under the test resources. Each reads a
precondition from outside itself, against Unit Tests rule 2.

The owner's disposition: mark them expected to fail with the reason
"TODO: fix the wrong approach to testing" and move them out of the legacy
files so the convention gate keeps holding. Each test leaves its legacy
file verbatim, with a one-line docstring naming its cause, for a mirror
file under tests/unit/devcapsule/legacy_refactoring/, one per legacy
file; the targets are the temporary package devcapsule/legacy_refactoring,
eight modules holding nothing but the docstring that says why they exist.
The marker holds only inside a capsule, so on the hosted workflow and on
a host these remain the tests they were. The one body change is the path
to devcapsule-src in test_replaced_scope_word_is_absent, taken from the
mirror file's deeper place.

Verified in a capsule: nox -s tests green, the checker at 108 legacy
files holding 1447 legacy tests, 30 files following the convention, 0
breaches; nox -s typecheck green. The fix of each test against its real
unit is queued on the maintenance workstream, the private-home fixture
first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ccozianu
ccozianu merged commit 0cfaae6 into main Nov 5, 2026
5 checks passed
@ccozianu
ccozianu deleted the ws-maintenance/legacy-xfail-mirror branch November 5, 2026 02:03
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