Skip to content

Add failing tests for #309#332

Draft
jamesdlevine wants to merge 1 commit intopromptdriven:mainfrom
jamesdlevine:fix/issue-309
Draft

Add failing tests for #309#332
jamesdlevine wants to merge 1 commit intopromptdriven:mainfrom
jamesdlevine:fix/issue-309

Conversation

@jamesdlevine
Copy link
Contributor

Summary

Adds failing tests that detect the bug reported in #309.

Test Files

  • Unit test: tests/test_get_jwt_token.py (TestDeviceFlowSlowDown class - 5 tests)
  • E2E test: tests/test_e2e_issue_309_oauth_rate_limit.py (3 tests)

What This PR Contains

  • Failing unit tests that reproduce the reported bug
  • Failing E2E tests that verify the bug at integration level
  • Tests are verified to fail on current code and will pass once the bug is fixed

Root Cause

Three bugs in pdd/get_jwt_token.py:304-311:

  1. HTTP 429 crashes before JSON parsing (line 304): raise_for_status() is called before response.json()
  2. KeyError on slow_down (line 311): Code accesses data[interval] which does not exist in GitHubs slow_down response
  3. Interval not accumulated: Per GitHubs Device Flow spec, clients must add 5 seconds after each slow_down

Next Steps

  1. Implement the fix at pdd/get_jwt_token.py:304-311
  2. Verify the unit tests pass
  3. Verify the E2E tests pass
  4. Run full test suite
  5. Mark PR as ready for review

Fixes #309


Generated by PDD agentic bug workflow

…iven#309)

This adds unit tests and E2E tests that detect the bug where HTTP 429
responses with {"error": "slow_down"} crash the OAuth device code flow.

Root cause:
- response.raise_for_status() is called before response.json() at line 304
- slow_down handler reads data["interval"] which doesn't exist (line 311)

Per GitHub's OAuth spec, clients should add 5 seconds to the polling
interval on slow_down, not read it from the response.

Tests verify:
- HTTP 429 with slow_down doesn't crash
- Interval increments by 5s on slow_down
- Multiple slow_downs accumulate properly
- authorization_pending uses original interval

Fixes promptdriven#309

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jiaminc-cmu pushed a commit that referenced this pull request Jan 24, 2026
Add new `pdd test <github_issue_url>` agentic workflow that automates
UI test creation through a 9-step process:

1. Duplicate check
2. Documentation research
3. Requirements clarification
4. Frontend detection
5. Test plan creation
6. Test generation
7. Test execution
8. Fix/iterate cycle
9. PR submission

New prompts:
- agentic_test_python.prompt - CLI entry point
- agentic_test_orchestrator_python.prompt - 9-step workflow orchestrator
- 9 LLM step prompts for each workflow phase

Modified:
- cli_python.prompt - Add re-export for agentic_test_main
- README.md - Document new pdd test agentic command
- docs/TUTORIALS.md - Add usage tutorial

The existing `pdd test` command remains backward compatible.
The --manual flag preserves original behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth login fails with 429 rate limit error when exchanging device code for OAuth token

1 participant