Skip to content

Return fresh project after update#513

Merged
robzolkos merged 4 commits into
mainfrom
fix/projects-update-refetch
Jun 29, 2026
Merged

Return fresh project after update#513
robzolkos merged 4 commits into
mainfrom
fix/projects-update-refetch

Conversation

@robzolkos

@robzolkos robzolkos commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Refetch projects after projects update before returning the response envelope
  • Add a red/green regression test for stale update responses

Validation

Reproduced on current main against Rob Zolkos test account/project: the update response returned the old description while a follow-up projects show returned the new description.

After this change, the same live validation returns the updated description in the projects update response.

Local tests:

GOWORK=off go test ./internal/commands -run TestProjectsUpdateReturnsFreshProjectAfterDescriptionChange
GOWORK=off go test ./internal/commands

Closes #468.


Summary by cubic

Return the fresh project after projects update by refetching, fixing stale fields in the response. If the refetch fails, fall back to the update response and include a diagnostic. Closes #468.

  • Bug Fixes
    • After a successful update, refetch with Projects().Get and return that result so description and updated_at are current.
    • When refetch fails, return the update response and add a notice via output.WithDiagnostic; tests also assert the PUT body includes the current name when only description changes.

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

Review in cubic

Copilot AI review requested due to automatic review settings June 29, 2026 20:52
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) bug Something isn't working labels Jun 29, 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 a stale-response bug in the projects update command by ensuring the CLI returns the post-write project state, aligning the JSON envelope with what a subsequent projects show would return.

Changes:

  • Refetch the project after Projects().Update(...) and return the freshly fetched record.
  • Add a regression test that simulates a stale update response and asserts the command returns the updated description/updated_at.

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.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/commands/projects.go Refetches the project after update so the response reflects the latest server state.
internal/commands/projects_test.go Adds a mock-transport regression test to catch stale update responses.

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

Comment thread internal/commands/projects_test.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.

1 issue found across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/commands/projects_test.go
Copilot AI review requested due to automatic review settings June 29, 2026 21:02

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread internal/commands/projects.go Outdated
@robzolkos robzolkos merged commit f4bf171 into main Jun 29, 2026
26 checks passed
@robzolkos robzolkos deleted the fix/projects-update-refetch branch June 29, 2026 21:23
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

projects update response returns pre-write description (stale field)

2 participants