fix(test): stop a config test writing into the source tree #603

Merged
hexajon merged 1 commit from fix/test-writes-into-source-tree into main 2026-09-23 14:57:45 +00:00
Owner

Summary

The intermittent internal/gitexec failure in the gate had a real cause. TestGetCredentialsWithSource_AmbientDegradesToNotConfigured made and then removed a directory under internal/config. The gitexec contract test walks internal/ in the same parallel go test ./..., and a directory removed mid-walk failed that walk. I found the writer with scripts/watch-tree-writes.py, a new script that logs files that appear or vanish under internal/ and cmd/ during a run. After this change, a full gate run logs no writes into the tree.

The test now keeps its config in a real temp directory and moves TMPDIR to a sibling, so the guard still sees the config as outside temp. It also runs outside any git repo. Before, the origin rung and host corroboration blocked the token even with the guard call removed, so the test never proved the guard. With that call removed, the test now fails.

The gate now keeps a failed leg's full log and prints its FAIL lines with context. Before, it showed only the last 25 lines and deleted the log, which hid this failure.

## Summary The intermittent `internal/gitexec` failure in the gate had a real cause. `TestGetCredentialsWithSource_AmbientDegradesToNotConfigured` made and then removed a directory under `internal/config`. The gitexec contract test walks `internal/` in the same parallel `go test ./...`, and a directory removed mid-walk failed that walk. I found the writer with `scripts/watch-tree-writes.py`, a new script that logs files that appear or vanish under `internal/` and `cmd/` during a run. After this change, a full gate run logs no writes into the tree. The test now keeps its config in a real temp directory and moves `TMPDIR` to a sibling, so the guard still sees the config as outside temp. It also runs outside any git repo. Before, the origin rung and host corroboration blocked the token even with the guard call removed, so the test never proved the guard. With that call removed, the test now fails. The gate now keeps a failed leg's full log and prints its FAIL lines with context. Before, it showed only the last 25 lines and deleted the log, which hid this failure.
fix(test): stop a config test writing into the source tree
All checks were successful
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 1m9s
drift / forgejo-smoke (pull_request) Has been skipped
ci / mcp-conformance (pull_request) Successful in 4m16s
ci / mcp-conformance (push) Successful in 1m49s
drift / govulncheck (push) Has been skipped
drift / surface-diff (push) Successful in -7s
drift / forgejo-smoke (push) Has been skipped
ci / gate (push) Successful in 12m29s
ci / gate (pull_request) Successful in 18m57s
5e144e8a43
TestGetCredentialsWithSource_AmbientDegradesToNotConfigured made and then
removed a directory under internal/config. The gitexec contract test walks
internal/ during the same parallel go test ./..., and a directory removed
mid-walk failed that walk. This was the intermittent gitexec failure in the
gate.

The test now keeps its config in a real temp directory and moves TMPDIR to
a sibling, so the guard still sees the config as outside temp. It also runs
outside any git repo. Before, the origin rung and host corroboration blocked
the token even with the guard removed, so the test never proved the guard.
With the guard removed it now fails.

The gate now keeps a failed leg's full log and prints its FAIL lines with
context. Before, it showed the last 25 lines and deleted the log, which hid
this failure. scripts/watch-tree-writes.py logs files that appear or vanish
under internal/ and cmd/ during a run.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!603
No description provided.