feat!: restructure QURL type — add AccessToken type#13
Conversation
…kens BREAKING CHANGE: Per-QURL fields (one_time_use, max_sessions, access_policy, qurl_link) removed from QURL dataclass. These were phantom fields — the API never populated them (always False/None at runtime). - Add AccessToken dataclass for per-token details - Add qurl_count and access_tokens fields to QURL - parse_qurl() maps API "qurls" array to access_tokens - Export AccessToken from package - Major version bump to 1.0.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR Review: feat!: restructure QURL type — add AccessToken typeOverall this is a clean, well-scoped breaking change. The type separation between Resource and Token makes the SDK model match the API much better. A few items to consider: Bug: falsy
|
…case DE review fixes: 1. Test mock used "access_tokens" (SDK name) instead of "qurls" (API wire format) — the qurls→access_tokens mapping was never exercised 2. parse_qurl used `or` for falsy check — empty list [] from API would be treated as falsy and fall through. Now uses explicit `in` check 3. Revert manual version bump to 0.1.0 — Release Please handles versioning from conventional commit prefix (feat!) 4. Add test_get_without_tokens — verifies access_tokens is None when API returns no qurls array Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR Review: feat!: restructure QURL type — add AccessToken typeOverall this is a clean, well-motivated breaking change. The PR description is thorough and the test coverage is solid. A few items worth addressing: Bug: falsy check on
|
CR feedback:
1. _parse_access_token: `if data.get("access_policy"):` would drop an
empty dict `{}` from the API. Changed to `is not None` check.
2. Add test_get_token_with_access_policy: exercises the access_policy
parsing branch inside _parse_access_token, and doubles as a sparse
token test verifying all defaults (one_time_use=False, max_sessions=0,
label=None, etc.)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR Review: feat!: restructure QURL type — add AccessToken typeOverall this is a clean, well-structured breaking change. The separation of Resource vs. Token concerns is the right call. A few items to consider: Code Quality
Potential Issues
Test Coverage
SecurityNo concerns — no user input flows into the parsing logic unsanitized. PerformanceNo concerns — the parsing is O(n) in the number of tokens, which is appropriate. SummaryLooks good to merge. The breaking change is well-justified (removing phantom fields) and the new |
Summary
Major version bump (0.1.0 → 1.0.0) to fix the identity confusion between Resources and QURLs in the SDK types.
AccessTokendataclass for per-token details (qurl_id,one_time_use,max_sessions,session_duration,access_policy,use_count)QURL:one_time_use(alwaysFalse),max_sessions(alwaysNone),access_policy(alwaysNone),qurl_link(only onCreateOutput)qurl_countandaccess_tokenstoQURL— populated by the enriched API responses from qurl-service PR #261parse_qurl()maps the API'squrlsarray toaccess_tokensfor clarityAccessTokenfrom packageBREAKING CHANGE: Code referencing
qurl.one_time_use,qurl.max_sessions,qurl.access_policy, orqurl.qurl_linkwill break. However, these were phantom fields — the API never populated them.Depends on: layervai/qurl-service#261 (deploy first)
Test plan
pytest tests/test_client.py— 57/57 tests passmypy --strict— passes🤖 Generated with Claude Code