Skip to content

test(auth): pin a clean sign_in_method_not_allowed on every CLI sign-in path - #146

Merged
xergioalex merged 1 commit into
mainfrom
feature__auth_followups
Nov 15, 2026
Merged

xergioalex merged 1 commit into
mainfrom
feature__auth_followups

Conversation

@xergioalex

Copy link
Copy Markdown
Member

Summary

Pins that a 403 sign_in_method_not_allowed renders 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:

  • The emailed code is the locked magic_link method.
  • The device flow inherits the approving web session's method.
  • An API key is not a sign-in method.

This guards the defensive behaviour in case a door ever answers the refusal anyway.

Changes

  • tests/sign_in_policy_refusal_test.py covers:
    • email request-code and verify-code (exit 1);
    • device start and device poll (exit 1);
    • an API-key command, dailybot me (exit 4).
  • AGENTS.md: test map entry.

Test plan

Automated

  • Run pytest -q tests/sign_in_policy_refusal_test.py: 5 pass.
  • Run pytest -q, ruff check dailybot_cli tests and mypy dailybot_cli: all clean (4,247 passed).

Regression

  • Each case asserts the server detail is shown, the exit is a deliberate SystemExit and no Traceback appears.

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

…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]>
@xergioalex xergioalex added the Ready Trigger AI code review label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

AI review for b674573 — ✅ done

View review →

Highest severity: none

Verifier: 0 checked · 0 verified · 0 downgraded · 0 refuted · 0 unverified · 0 skipped — grok-4.5 (economy), 0s

Strictness gate: ✅ highest severity none ≤ critical threshold

0 inline comment(s) attached.

Usage: 999.4k in (88% cached) · 10.0k out · est. $0.57 · 15 turns · 161s

Iteration-Aware Review: gen 1, round 1, policy=first-pass-exhaustive (first_review) — 0 surfaced.

@github-actions github-actions Bot added the pr-reviewed Passed AI code review label Nov 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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), server detail, no credentials)
  • device start and device poll (SystemExit(1), same contract)
  • an already-authenticated API-key command (dailybot me → EXIT_PERMISSION_DENIED / 4 via exit_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 effect none: highest severity none ≤ 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.

@xergioalex xergioalex self-assigned this Nov 15, 2026
@xergioalex
xergioalex merged commit 77f822a into main Nov 15, 2026
12 checks passed
@xergioalex
xergioalex requested a review from marin1321 November 15, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-reviewed Passed AI code review Ready Trigger AI code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant