Skip to content

Name an id-only identity in me and never blank a stored email - #715

Merged
jeremy merged 4 commits into
mainfrom
authux-3c
Sep 14, 2026
Merged

Name an id-only identity in me and never blank a stored email#715
jeremy merged 4 commits into
mainfrom
authux-3c

Conversation

@jeremy

@jeremy jeremy commented Sep 13, 2026

Copy link
Copy Markdown
Member

What

  • basecamp me under an in-house (bc3) token: /authorization.json reports only identity.id, and the summary read <> - 1 Basecamp account(s). It now says identity 28142355 - 1 Basecamp account(s), and when an account is configured it looks the person up there (/{account}/my/profile.json, the same call a login verifies against) and names them: Ada Lovelace <ada@example.com> - 1 Basecamp account(s). The person is added to the JSON as data.person (id, name, email) when fetched; a failed lookup falls back to the identity rendering.
  • SetUserEmail / SetUserIdentity treat an empty value as an omission and leave the stored field alone. me used to call SetUserEmail("") on every run under an in-house token, wiping the user_email the login had stored.
  • --expect-identity mismatch (and every other place loginIdentity.label() renders) names an id-only identity as identity 28142355 instead of (identity 28142355) with a blank name.

The person lookup runs only when the authorization document lacks a name or email, so a Launchpad or BC5 login with a full identity makes no extra request.

Why

Smoke-test finding "authorization.json under in-house tokens omits identity name/email; CLI me and --expect-identity show blanks". Two visible symptoms — the blank <> summary and an --expect-identity mismatch message that opened with an empty name — and one silent one: after me, auth status no longer knew who the credential belonged to, because the empty email had overwritten the stored one.

Before / After

Before:

$ basecamp me
 <> - 1 Basecamp account(s)
$ basecamp auth login --with-token -P bot --account 999 --expect-identity 1
Error: Authenticated as  (identity 28142355), not identity 1; nothing was stored

After:

$ basecamp me                              # account configured
Ada Lovelace <ada@example.com> - 1 Basecamp account(s)
$ basecamp me                              # person lookup unavailable
identity 28142355 - 1 Basecamp account(s)
$ basecamp auth login --with-token -P bot --account 999 --expect-identity 1
Error: Authenticated as identity 28142355, not identity 1; nothing was stored

Borrowed from Codex

Nothing here; Codex has no equivalent identity document.

Testing

  • internal/commands: TestMeIdentityOnlyResolvesThePerson (identity-only payload plus a person record: summary, data.person, stored user_id/user_email), TestMeIdentityOnlyFallsBackToTheIdentity (person 404: identity summary, stored email untouched), TestLoginIdentityLabelWithoutNameOrEmail.
  • internal/auth: TestSetUserIdentity_EmptyValuesAreOmissions.
  • httptest servers only. Gates: make fmt-check vet lint, go test -tags dev ./internal/..., make check-surface check-skill-drift, and the rest of make check (e2e, naming, lockstep, tidy).

Summary by cubic

Fixes basecamp me and --expect-identity for in-house (bc3) tokens: id-only identities are now named, and me no longer blanks a stored email or overwrites it with an environment token's identity.

Bug Fixes

  • basecamp me now shows identity <id> when the authorization document has no name or email, and resolves the person from the configured account when possible; the person record fills only fields the document left empty.
  • SetUserEmail and SetUserIdentity treat empty values as omissions, and me skips the write under BASECAMP_TOKEN; logins still record who they verified.
  • The --expect-identity mismatch message now prints identity <id> instead of a blank name with ids in brackets.

Written for commit 2cd06d4. Summary will update on new commits.

Review in cubic

Copilot AI balanced review requested due to automatic review settings September 13, 2026 01:27
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) auth OAuth authentication labels Sep 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T04:17:30.843533Z 2cd06d4 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

SetUserIdentity can overwrite stored credential metadata when BASECAMP_TOKEN is active.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Improves identity rendering and persistence for ID-only BC3 authorization responses.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Resolves account-scoped person details for basecamp me.
  • Preserves stored identity fields when incoming values are empty.
  • Improves ID-only login labels and regression coverage.
File summaries
File Description
internal/commands/people.go Adds person resolution and identity fallback summaries.
internal/commands/people_test.go Tests person resolution and fallback behavior.
internal/commands/auth.go Improves ID-only identity labels.
internal/commands/auth_identity_test.go Tests identity label variants.
internal/auth/auth.go Treats empty identity fields as omissions.
internal/auth/auth_test.go Tests preservation of stored fields.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/auth/auth.go

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 571254171b

ℹ️ 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".

Comment thread internal/commands/people.go Outdated
Copilot AI review requested due to automatic review settings September 13, 2026 01:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The environment-token guard breaks post-login identity persistence, while partial profile responses can discard known identity data.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread internal/auth/auth.go Outdated
Comment thread internal/commands/people.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc57f6679f

ℹ️ 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".

Comment thread internal/commands/people.go Outdated
Copilot AI review requested due to automatic review settings September 13, 2026 02:02
Copilot AI previously approved these changes Sep 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The focused changes match the stated behavior and include coverage for the relevant success, fallback, and credential-storage paths.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8205233d5

ℹ️ 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".

Comment thread internal/commands/people.go Outdated
Copilot AI review requested due to automatic review settings September 13, 2026 02:11
Copilot AI dismissed their stale review, a newer Copilot review was requested September 13, 2026 02:11
Copilot AI previously approved these changes Sep 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The identity fallbacks and persistence semantics are coherent and covered by focused regression tests.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@jeremy

jeremy commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

Review threads: 3 resolved (3 fixed, 0 declined with the reasoning in each thread).

An in-house (bc3) token's /authorization.json reports only identity.id.
`basecamp me` rendered that as " <> - 1 Basecamp account(s)" and then
stored the empty email over the one the login had written, so `auth
status` forgot who the credential belonged to. The --expect-identity
mismatch message opened with the same blank name.

SetUserEmail and SetUserIdentity now treat an empty value as an
omission. `me` names an id-only identity as "identity <id>", and when an
account is configured it looks the person up there — the same call a
login verifies against — for the name and email, adding them to the JSON
as data.person; a failed lookup keeps the identity rendering. The label
every login message renders names an id-only identity by its ids alone.
`me` now persists the person it resolves, and under BASECAMP_TOKEN that
person belongs to the environment token, not to whatever credential is
stored for the profile. SetUserIdentity takes the rule SetUserEmail
already had: a BASECAMP_TOKEN session writes nothing.
Guarding SetUserIdentity itself also silenced the write a login makes
after storing its new credential, which runs under BASECAMP_TOKEN too
and would have left that credential without its verified user. The
guard now sits where the environment token's identity is learned: me
skips the write, logins keep it.

The person record fills gaps in the authorization document rather than
replacing it: an email the document named survives a record that omits
its own, and the merged email is what gets stored.
…empty

The merge tested the record's fields for emptiness rather than the document's, so an identity with its canonical email but no name had that email replaced by the account person's. The document's values now stay as its own; the record fills the empty ones.
@jeremy

jeremy commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Rebased onto main after #711, #713 and #714 landed. One conflict, additive: both sides appended tests to internal/auth/auth_test.go; both kept. Build, vet and the auth/commands suites match main.

Copilot AI review requested due to automatic review settings September 14, 2026 04:14
Copilot AI dismissed their stale review, a newer Copilot review was requested September 14, 2026 04:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The changes are focused, consistent with existing account-scoped SDK usage, and comprehensively covered by regression tests.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@jeremy
jeremy merged commit f9ab293 into main Sep 14, 2026
27 checks passed
@jeremy
jeremy deleted the authux-3c branch September 14, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth OAuth authentication commands CLI command implementations tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants