Repository navigation
Conversation
…_the_forge_calls_github` deterministic The tests come first and fail until the implementation. `agent_build_kit.settings.reload` writes a fresh read of the environment into the one process-wide `settings` object, in place, field by field (`src/agent_build_kit/settings.py:228`). Done when the doctor-with-setting test followed by the failing test passes in one process with no workers (on the base the second fails with `NotFound: POST /api/v3/repos/example/app/pulls`), no… Unit: fix-test-tests-forges-test-github-api-url-py-test-with-no-set-fb2349ad/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start here
Already verified by the pipeline
Review tier:
full— the planned estimate is fullWhy
agent_build_kit.settings.reloadwrites a fresh read of the environment into the one process-widesettingsobject, inplace, field by field (
src/agent_build_kit/settings.py:228). Loading an installation calls it(
Installation.activateandload_config,src/agent_build_kit/installation.py:344and:384), and so doesrun_doctor.monkeypatch.setenvputs the environment back after a test. It does not put back the settings fields… The full reason is in
openspec/changes/fix-test-tests-forges-test-github-api-url-py-test-with-no-set-fb2349ad/proposal.md.What this pull request does
Done when the doctor-with-setting test followed by the failing test passes in one process with no workers (on the base the second fails with
NotFound: POST /api/v3/repos/example/app/pulls), no confirmed test below leaves a settings field changed after it ends, and the changed tests pass under the repeat check.Every test now ends with the process-wide settings it started with, so a test that reloads them from a patched environment no longer leaks its values into later tests on the same worker.
settings_restoredfixture in tests/conftest.py snapshots every field of the shared settings object and the loaded.envpath before each test and writes them back afterwards.ABK_GITHUB_API_URL, the forge test with no setting again calls api.github.com instead of the address the earlier test left behind.tokenfixture in tests/forges/test_github_api_url.py also undoes its monkeypatching and reloads the settings from the environment at teardown, and the module docstring describes that.Based on
main, with nothing unmerged beneath it — ready to merge whenever the checks look right.Unit
fix-test-tests-forges-test-github-api-url-py-test-with-no-set-fb2349ad/1of change fix-test-tests-forges-test-github-api-url-py-test-with-no-set-fb2349ad, task group(s) 1.Spec:
openspec/changes/fix-test-tests-forges-test-github-api-url-py-test-with-no-set-fb2349ad/in the planning repo.Assumptions
This unit assumes nothing unmerged: everything it builds on is already in
main.Verification
This is a unit-test unit: everything it needs is fakes, fixtures or throwaway containers, so GitHub Actions runs the whole of it. No e2e-test run was required.
Left for later
Approved, with these recorded rather than blocking:
settings_restoredautouse in tests/conftest.py, the many per-testreload(None)teardowns across tests/ (for example tests/cli/test_doctor_grafana.py, tests/serve/test_serve_metrics.py, tests/account_settings.py:40) are now redundant. A later cleanup could remove them so there is one place that restores the settings.tokenfixture's newmonkeypatch.undo(); reload(None)teardown does the same job as the new autousesettings_restoredfixture in tests/conftest.py:87. That root fixture is set up beforetokenand torn down after it, so it overwrites whateverreload(None)wrote. The per-file teardown has no effect, and the module docstring (lines 6-8) credits the wrong fixture for the isolation.How this was built
The commit order is checked mechanically; lint, formatting and types pass at the tip.
Opened by the spec-driven pipeline. The build agent never merges. The pipeline merges only
a unit review classified
autoand policy allowed; a person merges any other, after checkingthe stack order above.