feat: Add Enterprise/Core retention policy support to update_database (supersedes #56) - #59
Conversation
- Add updateDatabaseCoreEnterprise() method for PATCH /api/v3/configure/database/{name}
- Support retentionPeriod parameter for Core/Enterprise (sets retention_period_ns)
- Update tool description to indicate Enterprise support
- Add retention policy examples to README
- Update CHANGELOG with new feature
- Update tool availability from 'Cloud Dedicated only' to 'All versions'
Fixes #55
- Changed from PATCH /api/v3/configure/database/{name} to PUT /api/v3/configure/database
- Database name now passed in request body as 'db' parameter
- retention_period format changed from retention_period_ns (nanoseconds) to retention_period (duration string like '1y', '7d')
- Added formatRetentionPeriod() helper to convert nanoseconds to duration strings
- Tested successfully with 'ev_cars' database setting 1y and 2y retention periods
- API returns 200 OK with empty response body on success
Sync the Enterprise/Core retention work (PR #56) with main (v1.3.0 plus the new test infrastructure). Resolve conflicts in CHANGELOG, README, the database-management service, and the database tools. Corrections made while resolving, verified against InfluxDB 3 Core 3.9.3: - update_database for Core/Enterprise sends PUT /api/v3/configure/database with retention_period as a humantime duration string (e.g. "60d"), not PATCH and not a retention_period_ns field. CHANGELOG, README, the tool description, and code comments now match the actual contract. - Keep Core/Enterprise support and restore the Cloud Serverless and Clustered update paths that main added. update_database now validates all five product types. - Fix formatRetentionPeriod: a sub-day period was rounded down to "0d", which marks all data for immediate deletion. It now emits whole days when evenly divisible, otherwise whole hours, and rejects periods shorter than one hour. Tests: - Unit tests for the nanosecond-to-duration conversion and the PUT payload, including the 1h-not-0d regression. - Gated integration test that creates a database, updates its retention, and cleans up against a live Core instance. - Update the build-run-core-enterprise skill: update_database is available for Core/Enterprise (retention period only; updating retention on Core needs v3.2.0+).
Version consistency check: - Bump version to 1.4.0 (minor: new backward-compatible retention feature) across package.json, package-lock.json, and config.ts - Promote CHANGELOG "[Unreleased]" to "[1.4.0] - 2026-06-05" so the top heading matches package.json Cloud Serverless integration test: - Gate "update_database sets a retention period (Core/Enterprise)" to core/enterprise via INFLUX_DB_PRODUCT_TYPE. The test created a database and updated retention, which the v3 API supports on Core/Enterprise but not Cloud Serverless (v2 bucket API), so it failed in the Cloud Serverless CI job. Formatter: - Add repo-local .prettierrc.json (prettier defaults: 2-space, double quotes, printWidth 80). Without a local config, prettier inherited an ancestor config and reformatted the whole repo. Normalize existing files to the local config in this commit.
CI fixes pushed (65b1aed)Both failing checks are addressed. Version consistency check — was failing because the CHANGELOG top heading was
Integration tests (Cloud Serverless) — the
Formatter — added a repo-local Pipeline: |
Add a Format check CI job and a format:check script (prettier --check .) so formatting drift is caught on every PR. The repo already conforms to the local .prettierrc.json added in #59. Add .prettierignore for build output, node_modules, and the generated package-lock.json.
Summary
Supersedes #56. That PR is from a fork with maintainer edits disabled, so this branch carries the same work, synced with
mainand with the review findings resolved.Adds retention-period support to
update_databasefor InfluxDB 3 Core and Enterprise, and merges the v1.3.0 changes frommain(test infrastructure, error-handling, Cloud Serverless/Clustered support).Review findings addressed
updateDatabaseswitch dropped those cases. Mergingmainreinstates them;update_databasenow validates all five product types and routes each correctly.PUT /api/v3/configure/databasewithretention_periodas a humantime duration string (for example"60d") — notPATCH, and not aretention_period_nsfield. The code was already correct; the CHANGELOG, README, tool description, and code comments were not. They now match the contract.formatRetentionPerioddata loss. A sub-day period rounded down to"0d", which marks all data for immediate deletion. It now emits whole days when evenly divisible, otherwise whole hours, and rejects periods shorter than one hour.Verification
PUTpayload, the day/hour formatting, and the1h-not-0dregression (8 tests).PUT … "60d"returned HTTP 200 on Core 3.9.3.npm run build,npm run lint, and the protocol tests pass.Notes
maxTables/maxColumnsPerTableremain Cloud Dedicated/Clustered only; they are ignored (with a warning) on Core/Enterprise.build-run-core-enterpriseskill, which previously statedupdate_databasewas unavailable for Core/Enterprise.