Skip to content

feat: add data maintenance extensions - #185

Merged
erika-wallace merged 4 commits into
mainfrom
ew/data-maintenance-extensions
Nov 6, 2026
Merged

erika-wallace merged 4 commits into
mainfrom
ew/data-maintenance-extensions

Conversation

@erika-wallace

@erika-wallace erika-wallace commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds CRUD/operational coverage for Postgres maintenance to @heroku/sdk.

  • Converts src/resources/data/maintenance.ts into src/resources/data/maintenance/ with one module per operation: info.ts, history.ts, run.ts, schedule.ts, window.ts (getWindow/updateWindow), and wait-for-completion.ts, tied together by a barrel index.ts that exports maintenanceExtensions.
  • info keeps its prior behavior but changes signature from (appIdentity, addonIdentity?, options?) to (addonIdentity, options?), with app scoping now passed via options.appIdentity. It also now returns {addon, maintenance} instead of just the raw maintenance result.
  • Adds history, run, schedule, getWindow, and updateWindow, each resolving the add-on once and supporting a beforeX hook (beforeHistory, beforeRun, beforeSchedule, beforeGetWindow, beforeUpdateWindow) that fires after resolution but before the underlying API call, plus AbortSignal support throughout.
  • Adds waitForCompletion, which polls maintenance.info until status leaves running, with configurable intervalMs/timeoutMs, a beforeWait hook, and abort support.
  • run and waitForCompletion reject Essential-tier databases up front (via isEssentialTier) without calling beforeRun/beforeWait or hitting the API; history, schedule, and the window operations intentionally don't apply this restriction.
  • Fixes postgresDatabase.destroy() to catch heroku-fetch's NotFoundError instead of the synthetic AddonNotFoundError when probing for a cross-app match — the Platform API 404s on an unmatched add-on resolve rather than returning 200 with an empty array, so the prior check never actually caught the no-match case.
  • Adds a ./resources/data/maintenance subpath export to package.json for the new directory layout.
  • Updates examples/pg.ts to call maintenance.info with its new two-argument signature.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:

Steps:

  1. Passing CI suffices

Screenshots (if applicable)

Related Issues

GUS work item: W-23385548

@erika-wallace
erika-wallace requested a review from a team as a code owner November 6, 2026 17:38
@erika-wallace
erika-wallace force-pushed the ew/data-maintenance-extensions branch from 9722873 to 7a46434 Compare November 6, 2026 18:40

@tlowrimore-heroku tlowrimore-heroku left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@erika-wallace
erika-wallace merged commit 73c860c into main Nov 6, 2026
11 checks passed
@erika-wallace
erika-wallace deleted the ew/data-maintenance-extensions branch November 6, 2026 19:44
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