fix: seed profile gate for TestIssueLockArtifactWarning (Closes #359) #364

Merged
sysadmin merged 1 commits from fix/issue-359-artifact-warning-test into master 2026-07-07 08:15:19 -05:00
Owner

Summary

Fixes #359: the one failing test on master, tests/test_agent_temp_artifacts.py::TestIssueLockArtifactWarning::test_lock_success_includes_artifact_warning.

Root cause (as diagnosed in the issue): gitea_lock_issue is profile-gated via task_capability_mapgitea.issue.comment. The test never seeded GITEA_ALLOWED_OPERATIONS, so _profile_permission_block fail-closed with profile has no configured allowed operations and the test asserted success on a permission block — the artifact-warning logic never ran.

Changes (test-only, one file):

  • Add a local ISSUE_WRITE_ENV and setUp/tearDown with patch.dict(os.environ, ISSUE_WRITE_ENV, clear=True), mirroring the working pattern in tests/test_mcp_server.py::TestIssueLocking.
  • Complete the mocked git state with the three newer lock-gate fields returned by _clean_master_git_state_for_lock() in test_mcp_server.py, so the lock-worktree base gate cannot regress this test again.
  • The assertion body is unchanged: the test still verifies the artifact warning fires when porcelain contains ?? _emit_payload.py.

Acceptance criteria from #359

  • pytest tests/test_agent_temp_artifacts.py::TestIssueLockArtifactWarning::test_lock_success_includes_artifact_warning passes ✓ (module: 4 passed)
  • Full suite: 1169 passed, 6 skipped, 20 subtests passed, 0 failed in the branch worktree ✓
  • Artifact warning still verified for ?? _emit_payload.py

Closes #359

🤖 Generated with Claude Code

## Summary Fixes #359: the one failing test on `master`, `tests/test_agent_temp_artifacts.py::TestIssueLockArtifactWarning::test_lock_success_includes_artifact_warning`. Root cause (as diagnosed in the issue): `gitea_lock_issue` is profile-gated via `task_capability_map` → `gitea.issue.comment`. The test never seeded `GITEA_ALLOWED_OPERATIONS`, so `_profile_permission_block` fail-closed with `profile has no configured allowed operations` and the test asserted `success` on a permission block — the artifact-warning logic never ran. Changes (test-only, one file): - Add a local `ISSUE_WRITE_ENV` and `setUp`/`tearDown` with `patch.dict(os.environ, ISSUE_WRITE_ENV, clear=True)`, mirroring the working pattern in `tests/test_mcp_server.py::TestIssueLocking`. - Complete the mocked git state with the three newer lock-gate fields returned by `_clean_master_git_state_for_lock()` in `test_mcp_server.py`, so the lock-worktree base gate cannot regress this test again. - The assertion body is unchanged: the test still verifies the artifact warning fires when porcelain contains `?? _emit_payload.py`. ## Acceptance criteria from #359 - `pytest tests/test_agent_temp_artifacts.py::TestIssueLockArtifactWarning::test_lock_success_includes_artifact_warning` passes ✓ (module: 4 passed) - Full suite: `1169 passed, 6 skipped, 20 subtests passed, 0 failed` in the branch worktree ✓ - Artifact warning still verified for `?? _emit_payload.py` ✓ Closes #359 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jcwalker3 added 1 commit 2026-07-07 04:29:29 -05:00
gitea_lock_issue is profile-gated via task_capability_map
(gitea.issue.comment); without GITEA_ALLOWED_OPERATIONS the call
fail-closes before the artifact-warning logic runs, so the test
asserted success on a permission block. Seed the environment in
setUp/tearDown exactly like tests/test_mcp_server.py::TestIssueLocking
and complete the mocked git state with base_equivalent,
inspected_git_root, and base_branch so the newer lock-worktree
base-equivalence gate passes. The test still verifies the artifact
warning fires for '?? _emit_payload.py'. Full suite now passes with
zero failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
sysadmin approved these changes 2026-07-07 08:15:04 -05:00
sysadmin left a comment
Owner

All tests passed successfully (1169 passed, 0 failed). Reviewed the changes in tests/test_agent_temp_artifacts.py. It correctly seeds the GITEA_ALLOWED_OPERATIONS environment variable for TestIssueLockArtifactWarning and mocks the newer git state fields so the test does not fail on permission blocks. This successfully resolves the pre-existing master failure in Issue #359.

All tests passed successfully (1169 passed, 0 failed). Reviewed the changes in `tests/test_agent_temp_artifacts.py`. It correctly seeds the `GITEA_ALLOWED_OPERATIONS` environment variable for `TestIssueLockArtifactWarning` and mocks the newer git state fields so the test does not fail on permission blocks. This successfully resolves the pre-existing master failure in Issue #359.
sysadmin merged commit e017d80256 into master 2026-07-07 08:15:19 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#364