Conversation
getTodolists() used single-page Get() while getProjects() and getPeople() both used GetAll(). Projects with >15 todolists silently truncated results, causing name resolution to fail for todolists beyond page 1.
The old implementation did a raw single-page GET to /projects.json (max 15 results) with fmt.Scanf selection. Replaced with two modes: - --project flag: non-interactive setter via name resolver with validation - No flag: interactive picker via the resolve module (paginated via SDK) Both paths persist via resolve.PersistProjectID, eliminating duplicate config-writing logic.
There was a problem hiding this comment.
Pull request overview
Fixes pagination-related gaps in name resolution and updates basecamp config project to use the shared resolver/picker flow so users can select/resolve projects beyond the first API page.
Changes:
- Update todolist fetching in the names resolver to use the paginated
GetAll()path. - Rewrite
config projectto support--project(non-interactive) via the names resolver and no-flag interactive selection via the shared picker. - Add targeted tests for todolist pagination and
config projectbehaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/names/resolver.go | Switch todolist retrieval to paginated GetAll() to avoid silently missing items beyond page 1. |
| internal/names/resolver_test.go | Add an httptest-driven regression test ensuring todolist pagination is followed. |
| internal/commands/config.go | Refactor config project to use resolver + picker and persist the chosen project id. |
| internal/commands/config_test.go | Add tests covering config project with --project, invalid IDs, and non-interactive/no-flag behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback:
- Guard cmd.Flags().Lookup("project") against nil before accessing .Changed
- Switch PersistValue from os.WriteFile to atomic temp+rename to avoid
partial writes on interruption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config projectonly showed 15 projects (raw single-page GET). Rewritten to use the name resolver (--projectflag) and the paginated interactive picker (no flag), eliminating duplicate config-writing logic.Get()whilegetProjects()andgetPeople()both usedGetAll(). Projects with >15 todolists silently failed name resolution for items beyond page 1.Test plan
TestConfigProject_ExplicitFlag— resolves and persists via--projectTestConfigProject_ExplicitFlag_InvalidID— rejects unknown IDsTestConfigProject_NoFlag_NonInteractive— errors in non-interactive modeTestResolverGetTodolists_FollowsPagination— httptest server with Link headers across 2 pagesmake checkpasses (fmt, vet, lint, test, e2e, surface, provenance)Summary by cubic
Fixes pagination gaps so projects and todolists beyond the first page are selectable. Rewrites the
config projectflow to use the name resolver and a paginated picker, with safer atomic config writes.Bug Fixes
GetAll()and follows Link pagination to resolve lists beyond the first page.--projectflag lookup to avoid nil dereferences and made config writes atomic (temp+rename) to prevent partial files.Refactors
config projectnow uses the name resolver with--project(ID or name) and a paginated interactive picker without the flag.resolve.PersistProjectID, removing duplicate config writing and adding validation.Written for commit d957412. Summary will update on new commits.