Skip to content

Support project API keys with auto-detection of org/project#40

Open
snopoke wants to merge 2 commits intomainfrom
sk/project-keys
Open

Support project API keys with auto-detection of org/project#40
snopoke wants to merge 2 commits intomainfrom
sk/project-keys

Conversation

@snopoke
Copy link
Collaborator

@snopoke snopoke commented Feb 14, 2026

Summary

  • Add support for project API keys (base64-encoded org/project/key strings) that auto-detect organization and project slugs from the token itself
  • Legacy API keys continue to work but now emit a DeprecationWarning advising users to switch to project keys
  • CLI configure command now prompts for API key first and skips org/project prompts when a project key is detected

Test plan

  • All 105 existing tests pass
  • New test_project_key.py covers _parse_token with valid/invalid inputs, init() with project and legacy keys, Config.from_dict() with project keys, and CLI configure flow
  • Manual test: init(token=base64.b64encode(b"org/project/key").decode()) extracts org/project
  • Manual test: init("org", "project", "legacy-token") emits deprecation warning
  • Manual test: taskbadger configure with both key types

🤖 Generated with Claude Code

Project API keys are base64-encoded strings containing org/project/key.
When detected, org and project slugs are extracted automatically,
simplifying initialization. Legacy keys continue to work but emit a
deprecation warning advising users to switch to project keys.

- Add _parse_token() utility for base64 project key detection
- Update _init() to decode project keys and extract org/project
- Update Config.from_dict() to extract org/project for display/validation
- Update CLI configure command to prompt for API key first and skip
  org/project prompts when a project key is detected
- Add comprehensive tests for project key support
Celery stores the task result before firing the task_success signal.
This means result.get() can return before the success handler runs,
causing the mock context to exit and the second update_task_safe call
to hit the real function instead of the mock.

Add _wait_for_mock_calls() to poll until the expected call count is
reached before exiting the mock context.
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.

1 participant