AIT-263: derive customer/billing org from the active workspace, not /workspaces row[0] - #35
Conversation
…kspaces row[0] customers new + customers list picked the org from the cross-org /workspaces union's row[0], which for a user in 2+ orgs is nondeterministic and 403s when it disagrees with the token's org (backend can() requires path-org==token-org). Extract a shared resolveOrgPublicIdForWorkspace helper (from billing's local version, minus the row[0] fallback), use it in customers new, and scope customers list to the active org. billing refactored onto the shared helper. AIT-263
|
@codex review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCustomer and billing commands now resolve organization identifiers from the active workspace. Customer listing filters by active organization, customer creation targets the active organization, and billing commands share centralized workspace resolution. ChangesActive Workspace Organization Scoping
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30880194cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/customers.ts`:
- Around line 40-45: Validate that activeOrg is resolved after finding the
workspace and before filtering customers; when it is absent, throw the existing
shared ValidationError used by the workspace/organization resolver. Keep the
current customer filter unchanged for valid organizations and ensure unresolved
or malformed organization data cannot produce results.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 9b72bca9-e217-4923-9bb3-3c4e7bb3fcd7
📒 Files selected for processing (5)
src/__tests__/customers.test.tssrc/commands/__tests__/billing.test.tssrc/commands/_helpers.tssrc/commands/billing.tssrc/commands/customers.ts
…pace cannot resolve an org
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 885274af8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…workspaces row[0] (#35) * fix(cli): derive customer/billing org from active workspace, not /workspaces row[0] customers new + customers list picked the org from the cross-org /workspaces union's row[0], which for a user in 2+ orgs is nondeterministic and 403s when it disagrees with the token's org (backend can() requires path-org==token-org). Extract a shared resolveOrgPublicIdForWorkspace helper (from billing's local version, minus the row[0] fallback), use it in customers new, and scope customers list to the active org. billing refactored onto the shared helper. AIT-263 * fix: customers list throws the actionable error when the active workspace cannot resolve an org * test: complete the api/client partial mock with setWorkspaceContext
customers new + customers list picked the org from the cross-org /workspaces union's row[0], which for a user in 2+ orgs is nondeterministic and 403s when it disagrees with the token's org (backend can() requires path-org == token-org). Extracts a shared resolveOrgPublicIdForWorkspace helper (from billing's local version, minus the row[0] fallback), uses it in customers new, scopes customers list to the active org, and refactors billing onto the shared helper.
AIT-263
Summary by CodeRabbit
Bug Fixes
Tests