Skip to content

feat: refactor pg commands to leverage sdk - #3728

Merged
michaelmalave merged 8 commits into
feat/heroku-sdk-integrationfrom
mm/feat/heroku-sdk-integration-pg-commands
May 28, 2026
Merged

michaelmalave merged 8 commits into
feat/heroku-sdk-integrationfrom
mm/feat/heroku-sdk-integration-pg-commands

Conversation

@michaelmalave

Copy link
Copy Markdown
Contributor

Summary

This branch migrates core CLI command surfaces to @heroku/sdk and adds tooling to accelerate further command migrations, with broad updates across addons, pipelines, maintenance, Postgres, logs, and supporting libraries. Scope includes command implementations, shared helpers, and corresponding unit test updates to align with SDK request/response behavior.

  • Integrate @heroku/sdk into the CLI and command runtime paths
  • Migrate addons, pipelines, maintenance, Postgres, and logs commands from legacy API client patterns to SDK APIs
  • Refactor shared helpers and command internals to use SDK-compatible data flows
  • Add SDK migration codemod/tooling and documentation for follow-on command migrations
  • Remove obsolete legacy PG upgrade types no longer needed after SDK migration
  • Update unit tests across migrated commands and libraries to validate new SDK-backed behavior

Type of Change

  • fix: Bug fix or issue (patch semvar update)
  • feat: Introduces a new feature to the codebase (minor semvar update)
  • perf: Performance improvement
  • docs: Documentation only changes
  • tests: Adding missing tests or correcting existing tests
  • chore: Code cleanup tasks, dependency updates, or other changes

Verification

npm ci
npm run lint
npm test

Additional Context

  • Breaking: none expected; behavior is intended to remain equivalent while switching API client internals
  • Risk: medium; wide command-surface migration, mitigated by broad unit test updates
  • Follow-up: continue migrating remaining commands with the new codemod/tooling path and monitor edge-case API error mapping

Related Issue

W-22265695

… database APIs (instead of legacy typed this.heroku calls), removing obsolete PG upgrade types and updating unit tests to match the new request/response behavior
… client once and pass it through helper methods instead of re-creating it in each call

@tlowrimore-heroku tlowrimore-heroku 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.

LGTM!

Comments:

  • I see you're having to do a lot of double assertions (i.e. x as unknown as Y), in this PR. I think You, Eric, and I should discuss how best to avoid this. I think the crux of the issue is that SDK returns types defined by @heroku/types, but we're still opting to use the types defined in the CLI.
  • I also see several updates to nock. There was a discussion a couple of weeks ago--I think you may have been OOO--where there was a strong consensus to mock the SDK, rather than mocking the HTTP request/responses. We should probably revisit this conversation to see if everyone still feels this is the best approach.

… commands to use them, reducing duplicated SDK request/error handling logic across command implementations
… ordering, and set a default test HEROKU_API_KEY so SDK token initialization does not fail during mocked test runs
…d SDK mocking helper and align expectations with SDK-based response shapes and call patterns.
…ry entries, and update .gitignore to reflect cleanup of these now-obsolete migration tooling files.
…dictionary entries, and update .gitignore to reflect cleanup of these now-obsolete migration tooling files."

This reverts commit a93d08e.
…g shared runUpgrade/prepareUpgrade/dryRunUpgrade helpers and refactor the corresponding upgrade commands to use them instead of repeating inline SDK method casting

@tlowrimore-heroku tlowrimore-heroku 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.

Nice! I like the sdk-adapter approach!

@michaelmalave
michaelmalave merged commit a2dad85 into feat/heroku-sdk-integration May 28, 2026
4 of 17 checks passed
@michaelmalave
michaelmalave deleted the mm/feat/heroku-sdk-integration-pg-commands branch May 28, 2026 15:25

This branch had an error being deployed

1 failed deployment
AcceptanceTests — 917b0c6f Deployed May 27, 2026 by michaelmalave via acceptance (20.x, ubuntu-latest) #8599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants