Skip to content

ops(001): acceptance groups keep a disk floor between specs - #510

Merged
bartekus merged 2 commits into
mainfrom
ops/acceptance-disk-floor
Nov 5, 2026
Merged

bartekus merged 2 commits into
mainfrom
ops/acceptance-disk-floor

Conversation

@bartekus

@bartekus bartekus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

The acceptance groups keep a disk floor between specs (spec 001's delivery tooling, build only).

The integrations-base group ran out of disk in the merge queue with 41 GB free after verify.yml's cleanup (#483's queue runs, 2026-11-04: librustev_contract-*.rlib: No space left on device, at 030 after seven specs passed). Its thirteen specs build different features and test targets into one target directory that only grows.

  • scripts/acceptance/verify.py prints free disk before each spec. Below 20 GiB (ACCEPTANCE_DISK_FLOOR_GIB) it drops target/{debug,release}/incremental; if still below, it runs cargo clean. Each step is logged with the space it freed.
  • Commands, groups and results are unchanged. A clean costs a dependency rebuild in that job only.
  • Tests in scripts/acceptance/test_verify.py: above the floor nothing is touched, incremental artifacts go first, a clean follows only if still below, and every spec checks the floor first. The workflow already runs these tests (Test acceptance partition controls).
  • Spec 001 gets a dated build-only record entry, as the coupling check requires.

Complements #506 (dependencies without debug data) and #507 (msrv cleanup and disk records). No workflow file changes, so no review exception is needed.

Checks run locally: python3 -m unittest discover -s scripts/acceptance -p 'test_*.py' (14 passed); make gate.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the three changed files for bugs, security issues, and governance consistency.

scripts/acceptance/verify.py

  • free_bytes walks up via path.parent until an existing ancestor is found; on Linux the root always exists, so no infinite loop.
  • subprocess.run(["cargo", "clean"], ...) uses a list argument (no shell), so no command injection. cwd=ROOT is a module-level constant, not user-supplied.
  • FLOOR = int(os.environ.get("ACCEPTANCE_DISK_FLOOR_GIB", "20")) * 2**30 is evaluated at import time; a non-integer value would raise ValueError on import. Acceptable for a build script.
  • ensure_disk() always returns "clean" after cargo clean regardless of whether it freed enough space -- this is intentional best-effort behavior and consistent with the docstring.
  • The return value of ensure_disk() in run_group is discarded, which is fine since the function already logs what it did.

scripts/acceptance/test_verify.py

  • Decorator order on test_failed_spec_fails_group_and_stops: innermost decorator (subprocess.run) maps to first positional arg (run), outermost (ensure_disk) maps to _disk -- correct Python mock ordering.
  • test_still_below_the_floor_cleans_the_target patches free_bytes to always return 1 and verifies cargo clean is called -- logic is sound.
  • test_above_the_floor_touches_nothing calls ensure_disk(floor=0); since any non-negative free value satisfies >= 0, it returns "none" immediately -- correctly exercises the no-op branch.

specs/001-boundaries-and-authority/spec.md

The revision note is correctly framed as "build only, no claim of this spec changes" and follows the existing pattern of waiver/change annotations in this section. The changed path scripts/acceptance/verify.py is not in the managed-file list (.github/workflows/statecraft-*.yml, scripts/statecraft/*, .statecraft/setup/*, .github/CODEOWNERS) and does not fall under the owner-exception requirement.

No concrete defects found.

{"head": "5981ce742176936102b1f789c92970270698581c", "verdict": "no-findings", "findings": []}

Subject: 3ab57f8...5981ce7, diff digest 62abf428f8bc47531303f15163465565a2a4c1e34583013031a5d6b2c6c47246, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@bartekus
bartekus force-pushed the ops/acceptance-disk-floor branch from 5981ce7 to 52c2960 Compare November 4, 2026 23:28
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the three changed files for bugs, security issues, and governance inconsistencies.

scripts/acceptance/verify.py

  • FLOOR is computed at module import time from ACCEPTANCE_DISK_FLOOR_GIB. If the env var contains a non-integer string, int(...) raises uncaught ValueError at import, killing the whole harness. This is a minor robustness gap in a CI script, but acceptable for internal tooling.
  • free_bytes walks to path.parent until it finds an existing directory. Since / always exists, there is no infinite loop risk.
  • After cargo clean, ensure_disk returns "clean" unconditionally without rechecking free space; this is acceptable since the return value is only used for logging and the cleanup already ran.
  • subprocess.run(["cargo", "clean"], ..., check=False) silently swallows cargo failures. If clean fails and disk remains full, subsequent spec runs will likely fail on their own, so the trade-off is reasonable for CI resilience.
  • The ensure_disk() return value is discarded in run_group; all diagnostic output goes via print. This is intentional and consistent with the design.

scripts/acceptance/test_verify.py

  • Decorator order on test_failed_spec_fails_group_and_stops is correct: @patch.object(verify.subprocess, "run") is innermost → run parameter; @patch.object(verify, "ensure_disk", ...) is next → _disk parameter.
  • test_above_the_floor_touches_nothing calls real free_bytes with floor=0; any filesystem with ≥ 1 byte free satisfies free >= 0, so the test is reliable in practice.
  • test_incremental_artifacts_go_first correctly lets shutil.rmtree execute on the real temp directory (only free_bytes is mocked), then checks the directory is gone — this is a sound integration-style assertion.
  • test_still_below_the_floor_cleans_the_target does not set a return value on the run mock; since ensure_disk uses check=False and ignores the return, MagicMock() default is harmless.
  • test_every_spec_checks_the_floor_first verifies disk.call_count == 2 for a two-spec group with all-success mocked subprocess — consistent with the loop calling ensure_disk() once per iteration.

specs/001-boundaries-and-authority/spec.md

The added entry explicitly labels itself "build only, no claim of this spec changes" and is placed in what appears to be an operational/changelog section. The script changes do not alter any Rustev crate's behavior, boundaries, or authority logic, so this characterization is consistent with governance principle III (spec-first development applies to behavior changes). No contradiction with the constitution or contract is introduced.

No concrete defects found.

{"head": "52c29606d86ef4e5f2f1b5e74cf219af898a83a3", "verdict": "no-findings", "findings": []}

Subject: a3c1eab...52c2960, diff digest f1c2a4bec89f9f3fe01346ca0ad597ba2896defd7d94ddd3d4acae9bc2163aa5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 5, 2026
Before each spec the acceptance partition records free disk and, below
20 GiB, drops incremental artifacts and then the whole target directory.
integrations-base ran out of disk with 41 GB free after the workflow's
cleanup: its thirteen specs build into one growing target directory.
@bartekus
bartekus force-pushed the ops/acceptance-disk-floor branch from 52c2960 to 986b8f4 Compare November 5, 2026 05:34
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

AI review (findings)

Looking at the three changed files in this PR: a disk-floor guard added to scripts/acceptance/verify.py and its tests, plus a dated log entry in the spec.

verify.py – ensure_disk

The last step in ensure_disk runs cargo clean with check=False and then unconditionally returns "clean":

subprocess.run(["cargo", "clean"], cwd=ROOT, check=False)
print(f"acceptance disk: {free_bytes(target) / 2**30:.1f} GiB free after cargo clean", flush=True)
return "clean"

If cargo clean exits non-zero (e.g. cargo not on PATH in a constrained CI image, or a permissions error), the error is silently swallowed. The function returns "clean" as if disk was reclaimed, while no space was actually freed. The post-clean free_bytes print will show the still-low value, but the structured return signal — and any caller that relies on it — receives a false success. The test test_still_below_the_floor_cleans_the_target does not cover this failure path.

test_verify.py – test_still_below_the_floor_cleans_the_target

The test asserts run.call_args.args[0] == ["cargo", "clean"] but does not check cwd. The production call is subprocess.run(["cargo", "clean"], cwd=ROOT, ...). A future regression that removes or changes cwd would not be caught.

Spec change

The dated log entry in specs/001-boundaries-and-authority/spec.md is consistent with existing log entries in the file and correctly notes no normative claim changes. No governance issue.

{"head": "986b8f423228df579db79d80d08026eeaac573d0", "verdict": "findings", "findings": [{"path": "scripts/acceptance/verify.py", "line": 88, "summary": "cargo clean runs with check=False and its exit code is ignored; ensure_disk returns \"clean\" even when the clean command fails, falsely signalling that disk space was reclaimed."}, {"path": "scripts/acceptance/test_verify.py", "line": 56, "summary": "test_still_below_the_floor_cleans_the_target asserts the cargo clean command but not its cwd=ROOT argument, so a future regression removing or changing cwd would go undetected."}]}

Subject: 06f2101...986b8f4, diff digest 66a7fb14db8b679b013b61556240809364d5e52b74aea3e24939d7f28e16b81f, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 5, 2026 05:37 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the three changed files for bugs, security problems, and governance inconsistencies.

scripts/acceptance/verify.py

  • free_bytes walks up the path tree with path.parent until it finds an existing directory. On POSIX, Path("/").parent == Path("/"), so if somehow the root were unreachable the loop would not terminate, but this is impossible on any sane filesystem. The function's behaviour after cargo clean deletes the target directory is handled correctly since it walks to an existing ancestor on the same filesystem.
  • FLOOR is computed at module-import time via int(os.environ.get(...)). A non-integer value raises ValueError on import, which is appropriate loud failure for a CI script.
  • subprocess.run(["cargo", "clean"], cwd=ROOT, check=False) uses a list argument (no shell injection), and ROOT is a module-level constant not supplied by user input. Safe.
  • The final free_bytes(target) call in the print after cargo clean correctly handles a deleted target directory by walking to its parent.

scripts/acceptance/test_verify.py

  • test_failed_spec_fails_group_and_stops: decorator order (bottom-up injection) is correct — run receives the subprocess.run mock, _disk receives the ensure_disk mock.
  • test_above_the_floor_touches_nothing uses floor=0 and calls real shutil.disk_usage on the temp directory; since any real free space satisfies >= 0, this always passes.
  • test_incremental_artifacts_go_first: the frees iterator supplies exactly two values matching the two free_bytes calls in ensure_disk before returning "incremental". Correct.
  • test_still_below_the_floor_cleans_the_target: free_bytes is patched to always return 1; run.call_args.kwargs["cwd"] correctly captures the keyword argument.
  • test_every_spec_checks_the_floor_first: verifies ensure_disk is called once per spec (call_count == 2 for two specs). Correct.

specs/001-boundaries-and-authority/spec.md

The added note correctly characterises this as a build/CI-only change with no spec claim modified. The change lives under scripts/acceptance/, not scripts/statecraft/ or .github/workflows/, so it does not trigger the statecraft-review-exception Environment gate.

No concrete defects found.

{"head": "baf83f86324e087a42b13963984d89a6d2cefc6a", "verdict": "no-findings", "findings": []}

Subject: 06f2101...baf83f8, diff digest 813a74a302fb1f9ad06f5dacf5e8d92bd7a63438b8d36ca7d89b2269b9725a9b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 5, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit fce3f5d Nov 5, 2026
20 checks passed
@bartekus
bartekus deleted the ops/acceptance-disk-floor branch November 5, 2026 09:49
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