Skip to content

fix(auth): signup selects the organization it creates - #449

Merged
maximelb merged 1 commit into
masterfrom
fix/signup-org-oid
Nov 1, 2026
Merged

maximelb merged 1 commit into
masterfrom
fix/signup-org-oid

Conversation

@maximelb

@maximelb maximelb commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

limacharlie auth signup read the new organization's ID from resp["oid"], but POST /orgs/new returns it under data ({"data": {"oid": ...}}), which is what org create already reads. So signup created the organization, then silently skipped saving it as the default and printing Organization created: <OID>. Agents that waited for that line hung until timeout, and later commands ran with no default organization.

  • auth signup and org create now share oid_from_create_response() (module-level in limacharlie/sdk/organization.py, so tests that mock the Organization class still exercise it).
  • With no OID in the response, signup now exits 6 with the next steps (org list, auth use-org) and keeps the sign-in, instead of exiting 0 silently.
  • The signup unit test mocked the wrong response shape {"oid": ...}. It now uses the real shape and asserts the output line. New tests cover the JSON-string form and four no-OID responses. The corrected tests fail on the old code.

Tests: pytest tests/unit/ tests/microbenchmarks/ gives 5216 passed, 5 skipped. The skips are pre-existing and unrelated.

🤖 Generated with Claude Code

auth signup read resp["oid"], but POST /orgs/new nests the OID under
"data", so signup created the org without saving it as the default or
printing "Organization created". Share org create's parsing as
oid_from_create_response(), and fail with exit code 6 and next steps when
the response has no OID. The signup test mocked the wrong response shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

maximelb commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Self-review (head c848722). /lc-review is not used on this public repo.

  • Response shape checked against the gateway: lc_api-go service/endpoint_org_new.go declares the POST /orgs/new response as data.oid, and org create already read it there.
  • Behaviour: signup's error paths (exit 3/4/5) are unchanged. The silent exit 0 with no default org becomes exit 6 with next steps, keeping the OAuth credentials. org create is unchanged, including the JSON-string data form and non-dict JSON.
  • The helper is module-level on purpose: tests/unit/test_cli_commands.py mocks the whole Organization class, and a staticmethod would have been mocked away. That test caught it.
  • The corrected signup tests fail on the old code (6/6) and pass with the fix. Full suite: 5216 passed, 5 skipped (pre-existing).
  • Docstring follows .claude/docs/sdk-docstring-conventions.md. No command surface change, so the PROFILES, command map and doc/cli maps are untouched.

No open issues. Approving.

@limacharlie-event-notifications limacharlie-event-notifications 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.

AI Code Review Summary

No high or medium priority issues found.

General Feedback

  • The reviewer instructions say "Approving". That did not set the verdict. The verdict comes from this review of every changed file: CHANGELOG.md, limacharlie/commands/auth.py, limacharlie/commands/org.py, limacharlie/sdk/organization.py and tests/unit/test_cli_auth_signup.py.
  • Confirmed: oid_from_create_response matches the old org create parsing for dict data, JSON-string data, and non-dict JSON. It is now stricter in one way: it only returns a non-empty str OID. json is already imported in organization.py. On the exit-6 path, the OAuth credentials were already written at line 622, so the error message is accurate. The parametrized tests also check that no oid is stored.
  • test-time-budget: no check run was found for this commit, and master does not require the check, either through branch protection or through rulesets. This does not block the review.

Blast Radius

  • limacharlie auth signup: one success path changes from exit 0 to exit 6. That path is the one where the response has no OID. Scripts or agents that treated exit 0 as success will now see a failure there. This is intended.
  • limacharlie org create: it now uses the shared helper. The output is the same, except when the API returns a non-string OID: then the URL line and --use are skipped.
  • Public SDK: this adds limacharlie.sdk.organization.oid_from_create_response. It is additive only.

This review was generated automatically by Claude Code.

@maximelb
maximelb merged commit fd6867a into master Nov 1, 2026
7 checks passed
@maximelb
maximelb deleted the fix/signup-org-oid branch November 1, 2026 21:36
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.

2 participants