Skip to content

Resolve "me" via profile API; require explicit project for cross-cutting todo filters#205

Merged
jeremy merged 4 commits intomainfrom
whoami
Mar 7, 2026
Merged

Resolve "me" via profile API; require explicit project for cross-cutting todo filters#205
jeremy merged 4 commits intomainfrom
whoami

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 6, 2026

Summary

"me" resolutionResolvePerson("me") was fetching the entire /people.json list to match the current user's email. Now calls /my/profile.json directly (single request), cached in-memory for the session, cleared on account switch. people show me also short-circuits to avoid a redundant re-fetch.

todos --assignee / --overdue — these filters silently inherited a config-default project and returned incomplete results scoped to one project. Now they require --in <project> and error with a hint pointing to basecamp reports assigned/overdue for cross-project queries. Same fix for todos sweep.

Test plan

  • make check passes (fmt, vet, lint, test, e2e)
  • basecamp people show me -vv — single People.Me request
  • basecamp todos --assignee me — errors with hint to use --in or reports assigned
  • basecamp todos --assignee me --in <project> — works as before
  • basecamp todos sweep --overdue --complete — errors requiring --in

Copilot AI review requested due to automatic review settings March 6, 2026 21:10
@github-actions github-actions bot added tests Tests (unit and e2e) bug Something isn't working labels Mar 6, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the names.Resolver “me” person resolution to use the account-scoped /my/profile.json endpoint (via the SDK) rather than paginating through /people.json, improving scalability for large accounts.

Changes:

  • Switch ResolvePerson("me") to call People().Me() (single request) and remove email-based matching against the full people list.
  • Add an in-memory session cache (r.me) for the “me” profile and clear it on cache reset / account switch.
  • Simplify/replace “me” resolution tests to use an injectable resolveMeFn test hook.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/names/resolver.go Implements /my/profile.json-based “me” resolution with session caching and cache invalidation on account changes.
internal/names/resolver_test.go Updates “me” resolution tests to align with the new resolution path (using a test override).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/names/resolver_test.go
Comment thread internal/names/resolver.go Outdated
Comment thread internal/names/resolver.go
Copilot AI review requested due to automatic review settings March 6, 2026 21:44
@github-actions github-actions bot added the commands CLI command implementations label Mar 6, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/names/resolver.go
Comment thread internal/commands/people.go
dhh and others added 3 commits March 7, 2026 08:03
ResolvePerson("me") was fetching the entire /people.json list (paginated)
just to match the current user's email. This doesn't scale for accounts
with thousands of users.

Now calls People().Me() — a single request returning the authenticated
user's account-scoped person record directly. This eliminates the full
people list fetch, the email string matching, and the auth.GetUserEmail()
dependency for "me" resolution.

The result is cached in-memory (r.me) for repeated use within a session,
cleared on account switch.
`people show me` was resolving "me" via People.Me() to get the person ID,
then re-fetching the same person via People.Get(id). Now detects "me"
directly and returns the People.Me() result without a second request.
@jeremy jeremy changed the title Resolve "me" via /my/profile.json instead of fetching all people Resolve "me" via profile API; require explicit project for cross-cutting todo filters Mar 7, 2026
@github-actions github-actions bot added docs breaking Breaking change labels Mar 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

⚠️ Potential breaking changes detected:

  • The --assignee and --overdue flags now require an explicit project to be set via --in, a global flag, or a config default, whereas previously they could be used without explicitly specifying a project.
  • The sweep subcommand now requires an explicit project to be provided via --in, a global flag, or a config default, and no longer falls back to an interactive picker.

Review carefully before merging. Consider a major version bump.

Copilot AI review requested due to automatic review settings March 7, 2026 16:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/commands/todos.go
Comment thread internal/commands/todos.go Outdated
Comment thread internal/commands/todos.go Outdated
Comment thread internal/commands/todos_test.go
Comment thread README.md
Without an explicit project, these filters silently inherited a config
default and returned incomplete results scoped to one project. Now they
error with a hint pointing to `basecamp reports assigned/overdue` for
cross-project queries.

Same fix for `todos sweep` — mutation commands should never silently
inherit an ambient project.
@jeremy jeremy merged commit cb22547 into main Mar 7, 2026
21 checks passed
@jeremy jeremy deleted the whoami branch March 7, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change bug Something isn't working commands CLI command implementations docs tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants