Repository navigation
test(auth): pin a clean sign_in_method_not_allowed on every CLI sign-in path - #146
Conversation
…in path ## Summary PLAN_015's sign-in policy never refuses a CLI path by design (the emailed code is the locked magic_link method, the device flow inherits the web session's method, an API key is not a sign-in method). This pins the defensive behaviour if a door ever answers `403 sign_in_method_not_allowed`: the server's message, a clean exit, no traceback, no credential written. ## Change Log - tests/sign_in_policy_refusal_test.py: email request and verify, device start and poll, an API-key command (`dailybot me`, exit 4) - AGENTS.md test map ## Risks - None: tests only Co-Authored-By: Claude Opus 5.5 <[email protected]>
AI review for
|
There was a problem hiding this comment.
Code review — 0 finding(s): 0 critical · 0 warning · 0 info
Check: ✅ passing — strictness block-on-critical: highest severity none ≤ critical threshold
No findings posted inline.
Summary
Verdict
Looks good — focused defensive pin of 403 sign_in_method_not_allowed rendering; nothing blocking.
Narrative
Tests-only PR (+87/−0). Five CliRunner cases cover the real doors that could ever surface this code:
- email request-code and verify-code (
SystemExit(1), serverdetail, no credentials) - device start and device poll (
SystemExit(1), same contract) - an already-authenticated API-key command (
dailybot me→EXIT_PERMISSION_DENIED/ 4 viaexit_for_api_error)
HTTP is mocked at dailybot_cli.api_client.httpx.* (Rule 7). Config is isolated by the suite autouse fixture; ambient key/token env is cleared. _assert_clean correctly requires a deliberate SystemExit, no Traceback in output, and the server detail text. Device poll reuses fixture_response("device_start_200") and patches sleep the same way as device_login_test.py.
I verified against production handlers: email paths print e.detail then SystemExit(1); device start/poll use _terminal_message(code) or error.detail then SystemExit(1); me goes through exit_for_api_error (403 → exit 4, unknown code falls back to detail). sign_in_method_not_allowed is intentionally not in ERROR_CODE_MESSAGES — these tests pin the unknown-code fallback, which matches PLAN_015’s “never refuses a CLI path by design” stance. The five new tests pass locally.
AGENTS.md test-map entry is accurate and correctly placed.
No production behaviour change; release impact is the usual auto-release PATCH on merge.
Release decision
Recommendation: approve
Check status: ✅ passing — strictness
block-on-critical, highest severity in effectnone: highest severitynone≤ critical threshold.This line is written by the reviewer runtime after the gate ran and matches the check conclusion and the tracking comment. Any recommendation above is the model's advisory opinion, not the gate.
Summary
Pins that a
403 sign_in_method_not_allowedrenders cleanly on every CLI sign-in path: the server's message, a clean exit code, no traceback and no credential written. Tests only; no behaviour change.PLAN_015 (auth wave 2) never refuses a CLI path by design:
magic_linkmethod.This guards the defensive behaviour in case a door ever answers the refusal anyway.
Changes
tests/sign_in_policy_refusal_test.pycovers:dailybot me(exit 4).AGENTS.md: test map entry.Test plan
Automated
pytest -q tests/sign_in_policy_refusal_test.py: 5 pass.pytest -q,ruff check dailybot_cli testsandmypy dailybot_cli: all clean (4,247 passed).Regression
SystemExitand noTracebackappears.Risks
Low risk: tests only, so no shipped behaviour changes. Merging cuts a 3.29.1 patch through auto-release, as every merged PR does. Rollback: revert the PR.
🤖 Generated with Claude Code