Skip to content

Commit b903ac0

Browse files
LEANDERANTONYclaude
andcommitted
fix(tests): repair 3 CI failures from the export-entitlement gate (b82e772)
CI has been red since the export-gate batch; all 3 failures trace to b82e772 and were missed when the test_backend_workspace.py fallout was fixed: - resume_builder_export_unknown_session / _400_real_message: the route enforces the export entitlement BEFORE hydrating the session (ADR-027 — a blocked request must have no side effects). docx / classic_ats from an anon (free) caller now correctly returns the canonical 429 entitlement response, so these scenarios never reached the unknown-session 400 path they exist to verify. Switched the payloads to the free-entitled combo (pdf + professional_neutral) so the request clears the gate and hits the 400-with-friendly-message path. Intent of the tests is preserved; behaviour under test is unchanged. - test_backend_http_exceptions_use_friendly_detail: the audit allowlist pins the InvalidFeedbackError str(error) site in backend/routers/workspace.py by line number; b82e772 added auth/gate branches above it, drifting it 651 -> 686 (the comment already documents this exact recurring drift: 617->629->639->650 ->651). Bumped to 686 per the documented procedure. Test-only changes; no production code touched. The 2 export scenarios + the audit pass; surrounding slice green (16 passed). Full suite couldn't be run to completion locally (network-bound tests hang offline) but CI deterministically reported exactly these 3 failures / 653 passed, so this should land 656/0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b992b9a commit b903ac0

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

tests/test_error_handling_scenarios.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,18 @@ def _scenario_resume_builder_message_unknown_session():
106106

107107

108108
def _scenario_resume_builder_export_unknown_session():
109+
# Must use the free-entitled combo (pdf + professional_neutral):
110+
# the route enforces the export entitlement BEFORE hydrating the
111+
# session (ADR-027 — a blocked request has no side effects), so
112+
# docx / classic_ats from an anon (free) caller now correctly
113+
# returns the canonical 429 entitlement response, never reaching
114+
# the unknown-session 400 path this scenario exists to verify.
109115
response = client.post(
110116
"/api/workspace/resume-builder/export",
111117
json={
112118
"session_id": "wrong-id",
113-
"export_format": "docx",
114-
"theme": "classic_ats",
119+
"export_format": "pdf",
120+
"theme": "professional_neutral",
115121
},
116122
)
117123
assert response.status_code == 400
@@ -254,12 +260,15 @@ def _scenario_resume_builder_export_returns_400_with_real_message():
254260
user-typed string (not a leaked exception). Even when the lint
255261
catches the same shape statically, the runtime sees what the
256262
actual response body looks like."""
263+
# Free-entitled combo so the request clears the export-entitlement
264+
# gate (ADR-027, enforced pre-hydrate) and actually reaches the
265+
# unknown-session 400 path whose message shape this asserts.
257266
response = client.post(
258267
"/api/workspace/resume-builder/export",
259268
json={
260269
"session_id": "definitely-not-real",
261-
"export_format": "docx",
262-
"theme": "classic_ats",
270+
"export_format": "pdf",
271+
"theme": "professional_neutral",
263272
},
264273
)
265274
assert response.status_code == 400

tests/test_error_messages.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,11 @@ def _audit_python_file(path: Path) -> list[dict]:
223223
# debug a bad payload; there's no internal state in the string.
224224
# Line drifts each time the feedback / transcribe route grows a
225225
# new auth-handling branch above this InvalidFeedbackError site.
226-
# 617 → 629 → 639 → 650 → 651. Update when CI flags a new line
227-
# number. Latest drift: observability commit captured the result
228-
# variable instead of returning record_feedback() inline so the
229-
# capture_event call could fire AFTER the write succeeds; that
230-
# added one line above the InvalidFeedbackError branch.
231-
(_os_for_paths.path.join("backend", "routers", "workspace.py"), 651),
226+
# 617 → 629 → 639 → 650 → 651 → 686. Update when CI flags a new
227+
# line number. Latest drift: the b82e772 export-entitlement commit
228+
# added auth/gate branches above the feedback route, pushing the
229+
# InvalidFeedbackError `str(error)` site from 651 to 686.
230+
(_os_for_paths.path.join("backend", "routers", "workspace.py"), 686),
232231
}
233232

234233

0 commit comments

Comments
 (0)