Skip to content

Fix pagination gaps in config project and todolist resolver#241

Merged
jeremy merged 3 commits into
mainfrom
timeline
Mar 11, 2026
Merged

Fix pagination gaps in config project and todolist resolver#241
jeremy merged 3 commits into
mainfrom
timeline

Conversation

@jeremy

@jeremy jeremy commented Mar 10, 2026

Copy link
Copy Markdown
Member

Summary

  • config project only showed 15 projects (raw single-page GET). Rewritten to use the name resolver (--project flag) and the paginated interactive picker (no flag), eliminating duplicate config-writing logic.
  • Todolist name resolver used Get() while getProjects() and getPeople() both used GetAll(). Projects with >15 todolists silently failed name resolution for items beyond page 1.

Test plan

  • TestConfigProject_ExplicitFlag — resolves and persists via --project
  • TestConfigProject_ExplicitFlag_InvalidID — rejects unknown IDs
  • TestConfigProject_NoFlag_NonInteractive — errors in non-interactive mode
  • TestResolverGetTodolists_FollowsPagination — httptest server with Link headers across 2 pages
  • make check passes (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 project flow to use the name resolver and a paginated picker, with safer atomic config writes.

  • Bug Fixes

    • Todolist name resolver now uses GetAll() and follows Link pagination to resolve lists beyond the first page.
    • Guarded --project flag lookup to avoid nil dereferences and made config writes atomic (temp+rename) to prevent partial files.
  • Refactors

    • config project now uses the name resolver with --project (ID or name) and a paginated interactive picker without the flag.
    • Centralized persistence via resolve.PersistProjectID, removing duplicate config writing and adding validation.

Written for commit d957412. Summary will update on new commits.

jeremy added 2 commits March 10, 2026 15:05
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.
@jeremy jeremy requested a review from a team as a code owner March 10, 2026 22:07
Copilot AI review requested due to automatic review settings March 10, 2026 22:07
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) bug Something isn't working labels Mar 10, 2026

Copilot AI 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.

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 project to 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 project behaviors.

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.

Comment thread internal/commands/config.go Outdated
Comment thread internal/commands/config.go

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 4 files

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
@github-actions github-actions Bot added the tui Terminal UI label Mar 11, 2026
@jeremy jeremy merged commit c3f3e86 into main Mar 11, 2026
33 of 34 checks passed
@jeremy jeremy deleted the timeline branch March 11, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations tests Tests (unit and e2e) tui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants