Skip to content

test: prevent fixture maintenance races during scaffold drift - #1941

Merged
gerchowl merged 2 commits into
devfrom
bugfix/1939-drift-test-maintenance-race
Oct 27, 2026
Merged

gerchowl merged 2 commits into
devfrom
bugfix/1939-drift-test-maintenance-race

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixture commits can launch detached Git maintenance that removes loose objects while the scaffold-drift step clones the repository. Disable automatic maintenance in test fixture repositories before commits so those readers see stable objects.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • Add one shared disable_git_auto_maintenance helper in tests/conftest.py, configuring repository-local maintenance.auto=false and gc.auto=0; document the race and prior art Placeholder-scan tests race against git housekeeping in .git/objects #1815.
  • Apply it to the drift, scaffold-file walk, floating-tag remote, host-install and flake-consumer fixture repositories before commits.
  • Assert both settings in the real drift fixture, preserving the clean-then-drift behavior test. No retries or sleeps.

Changelog Entry

No changelog needed: test-only changes with no user-visible impact, per CLAUDE.md's rule for test commits.

Testing

  • Tests pass locally (targeted suites; full suite delegated to CI)
  • Manual testing performed (describe below)

Manual Testing Details

  • RED: uv run --with pytest-xdist pytest tests/test_scaffold_drift.py -k test_nix_drift_reports_clean_then_drift -n 4 --basetemp=$HOME/.cache/devkit-pytest/1939 exited 1: both cases failed on the missing maintenance setting. Committed before implementation.
  • GREEN: uv run --with pytest-xdist pytest tests/test_scaffold_drift.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1939 passed three times, 48 tests each, exit 0 each.
  • Related suites: uv run --with pytest-xdist pytest tests/test_scaffold_files.py tests/test_floating_tag_move.py tests/test_install_direnv_host.py --basetemp=$HOME/.cache/devkit-pytest/1939 (22 passed, exit 0; serial verification). The initial -n 4 run exited 1 (21 passed, 1 failed): the host-install cleanup assertion observed another worker's active devkit-scaffold.* scratch directory. No unrelated test changes made.
  • Commands run inside nix develop; flake evaluation/build and container suites left to CI as required.
  • CI watched to completion: all 16 checks passed on 14ff14725718864ee5933c9f4aade153fead0fc2, including the aggregate Test Summary gate. gh pr checks 1941 --watch exited 0.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (helper docstring; no consumer documentation change)
  • I have updated CHANGELOG.md in the [Unreleased] section (not applicable; explained above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published (none required)

Additional Notes

This test-only change unblocks #1937. Production code is unchanged.

Refs: #1939

@gerchowl
gerchowl merged commit 5de5d39 into dev Oct 27, 2026
16 checks passed
@gerchowl
gerchowl deleted the bugfix/1939-drift-test-maintenance-race branch October 27, 2026 09:24
gerchowl added a commit that referenced this pull request Oct 27, 2026
## Description

Extend GitHub App provisioning to store organization secrets with
selected-repository visibility, expose a Nix flake app, and report the
correct terminal state after a rejected callback.

## Type of Change

- [x] `feat` -- New feature
- [x] `fix` -- Bug fix
- [x] `docs` -- Documentation only
- [x] `test` -- Adding or updating tests
- [x] `build` -- Build system or dependency changes

### Modifiers

- [ ] Breaking change (`!`)

## Changes Made

- Normalize comma-separated repository names before provisioning and
reject `--repos` without `--org-secret`.
- Add `--org-secret --repos` with organization-owner validation and
mutual exclusion with `--no-secrets`; credentials stay on stdin and
subprocess output stays captured.
- Expose `nix run .#app-provision` through the existing vig-utils
package.
- Preserve callback replay protection while showing “This provisioning
run has ended” after rejection or failure.
- Document selected-repository secrets, the flake entry point, and a
SHA-pinned workflow recipe that masks the App token and appends to
existing `NIX_CONFIG`.

## Changelog Entry

### Added

- **GitHub App organization secrets and Nix entry point**
([#1915](#1915))
- Store App credentials as organization secrets with selected-repository
visibility using `--org-secret --repos`
- Run provisioning through `nix run .#app-provision` and document masked
App tokens appended to existing Nix configuration
- Show a terminal-state page for callbacks after a rejected or failed
provisioning attempt

## Testing

Round 2: regression tests first produced 3 failures and 1 pass (exit 1),
then the full provisioning suite passed (59 tests, exit 0): `uv run
--with pytest-xdist pytest
packages/vig-utils/tests/test_gh_app_provision.py -n 4
--basetemp=$HOME/.cache/devkit-pytest/1915-r2`.

- RED: focused provisioning tests failed on existing repository argv and
incorrect replay page (exit 1); validation tests failed on unrecognized
flags (exit 1); flake app eval failed on missing attribute (exit 1).
Committed tests before implementation.
- GREEN: `uv run --with pytest-xdist pytest
packages/vig-utils/tests/test_gh_app_provision.py
tests/test_flake_checks.py::test_app_provision_app_points_at_console_script
-n 4 --basetemp=$HOME/.cache/devkit-pytest/1915` — 56 passed, exit 0.
- After extracting credential argument wiring: provisioning suite — 55
passed, exit 0.
- [x] Manual testing performed

### Manual Testing Details

`nix run .#app-provision -- --dry-run --name example-bot --owner example
--repo example/repo --org-secret --repos repo,other` printed the
manifest and exited 0. No live App or secrets were created. Full
Nix/container suites remain CI checks.

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] My changes generate no new warnings or errors
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published

## Additional Notes

Rebased onto dev after #1941 merged the fixture maintenance fix for
#1939. Final CI passed on rebased head
`e7b975eb54d7f54ce418d638c0e028ac3985b073`, including Test Summary,
Project Tests and flake gates.

Secret writes remain sequential and may partially succeed; the existing
exclusive recovery PEM behavior applies to both storage modes.
Organization plan/policy and installation requirements are documented.
App token Nix configuration overrides earlier `access-tokens` directives
while preserving other settings.

Refs: #1915
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