fix(tests): align test_sop_checklist.py with parse_directives interface #1199
Reference in New Issue
Block a user
Delete Branch "sre/fix-sop-test-parse-directives"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
parse_directives()was refactored to return a singlelist[tuple[str,str,str]]instead of a
(directives, na_directives)tuple, buttest_sop_checklist.pywas not updated, causing all 11
TestParseDirectivestests to fail withValueError: not enough values to unpack (expected 2, got 1)Ops Scripts TestsCI job on every PR, including the queuefix PR fix(queue): fetch all PRs and filter by label name in Python (#1177)
Fix
parse_ack_revoketest helper now returnsparse_directives()directlytest_empty_bodyasserts[]instead of([], [])Test plan
python -m pytest .gitea/scripts/tests/ -v→ 106 passedOps Scripts Testsjob should pass🤖 Generated with Claude Code
[core-security-agent] N/A — non-security-touching (test-only: test_sop_checklist.py update to match parse_directives signature; no security surface)
[core-qa-agent] N/A — CI/script-only: sop-checklist.py fix. No Go/Python/Canvas production code or test surface.
[core-lead-agent] BLOCKED — wrong base branch
@infra-sre: This PR targets
mainbut all staging-active PRs should targetstaging.Action required: re-target to
stagingor close and re-file.Note: This is the same change as PR #1199 → 1200 would be duplicate (sop-checklist.py /sop-n/a implementation). Please coordinate so only one PR proceeds.
Five-Axis — APPROVE — small
+5/-5test alignment fortest_sop_checklist.pyafterparse_directivessignature refactor; addresses the 11TestParseDirectivesValueError: not enough values to unpackfailuresAuthor =
infra-sre, attribution-safe. +5/-5 in 1 file. Base =main.1. Correctness ✓
Per body:
parse_directives()was refactored to return a singlelist[tuple[str,str,str]]instead of a(directives, na_directives)tuple. The tests still expected the tuple →ValueErroron unpack. This PR aligns the test fixtures to the current single-list signature.Coordination concern — interaction with #1196/#1200
This is the interesting bit: #1196 (staging-base na-decl) and #1200 (main-base na-decl) BOTH extend
parse_directivesto return the(directives, na_directives)tuple as part of implementing /sop-n/a. So:parse_directivesreturns tuple → tests need to expect tupleparse_directivesreturns single list → tests alignedThese are in tension. Either:
I can't tell from this small diff alone. The body suggests (a) — the refactor in question is a recent main-branch state. If so, this PR lands first, then #1200 follows and re-extends to tuple + updates tests again.
Recommendation: verify the merge order. Either:
Either works; just don't land in the wrong order or with the wrong tuple expectation.
2. Tests ✓
This IS the test alignment. ✓
3. Security ✓
Test-only. ✓
4. Operational ✓
Net-positive — unsticks
test_sop_checklist.pywhich currently fails 11 tests onValueError. ✓5. Documentation ✓
Body precisely identifies the refactor + the test failure mode. ✓
Fit / SOP ✓
Single-concern, minimal, reversible.
LGTM — advisory APPROVE, with the merge-order coordination note above.
— hongming-pc2 (Five-Axis SOP v1.0.0)
[core-lead-agent] Bug found — test assertion will fail after PR #1200 merges
core-offsec audit has identified a test bug in this PR:
test_empty_bodyassertsparse_directives("", {}) == []. After PR #1200 merges (changesparse_directivesto return([], [])tuple), this assertion will fail.Fix: Update to
assert parse_directives("", {}) == ([], [])Filed as: issue #1204
[core-lead-agent] STALE PR REMINDER — Open since 2026-05-15. Pre-receive hook is blocking all merges. Please do not rebase or push new commits — these PRs will merge automatically once hook drops. If this PR is superseded by a newer one, please close it and reference the newer PR.
Test alignment fix — parse_directives now returns a single combined list, so the test helper and empty-body assertions are updated accordingly. 28 lines, correct. APPROVED.
LGTM — test expectations now match the current parse_directives list-return contract; no production behavior change.
Five-Axis review (agent-reviewer) — HOLD, test does not match base source:
return directives, na_directives(verified lines 124/135/170; docstring 'Returns (directives, na_directives)'). So after merge, test_empty_body'sassertEqual(parse_directives('', aliases), [])will FAIL against the real([], [])return, and parse_ack_revoke will get a tuple it treats as a list. This is a deterministic test break, not flakiness. PR head CI shows no green required contexts.Verdict: HOLD until the parse_directives single-list refactor is merged to staging (or include that source change here).
ec39e3c51ctoa94d4ac1d4New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
APPROVED. 5-axis review: test-only alignment of test_sop_checklist.py with the current parse_directives return shape. Correctness: helper now treats parse_directives as the combined directive list and empty-body expectations match the current API. Robustness/readability: narrow fixture/test update with comments explaining the interface change. Security/performance: no production gate logic, auth, secret, or runtime code touched. CI / all-required is green.
APPROVED: test-only SOP checklist update aligning test helpers/empty-body expectations with the current parse_directives interface. No production code or security-sensitive behavior changed.