Skip to content

feat: 1.1.0 — metric data, dashboards, metric descriptions and merged datasets - #10

Merged
bwiz merged 3 commits into
mainfrom
feature/v2-1
Oct 26, 2026
Merged

bwiz merged 3 commits into
mainfrom
feature/v2-1

Conversation

@bwiz

@bwiz bwiz commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CLI 1.1.0 follows the Databox API 2.1. Every type and request body was checked field by field against the API's contracts.

  • metric data (new): reads a metric's values over a date range, with --granularity (no hourly), dimensions and filters. --json returns the API's response unchanged. syncInfo is {status, lastSyncedAt, message} with the API's statuses: synced, skipped, inProgress, neverSynced, failed. The timeout is 170 s, longer than the API's 150 s sync wait.
  • dashboard topic (new):
    • dashboard list (refuses a blank --search), dashboard metrics <id> and dashboard rename <id> --name.
    • rename sends exactly {name}; name rules are left to the API.
    • databoard list / databoard metrics stay, on the new routes, and are deprecated: oclif prints a warning on stderr that points to dashboard …, and --json stdout stays clean.
  • metric update --description sets a metric's description, and --description "" clears it. metric get shows a Description line. metric create gets no flag, because the API's create doesn't accept a description.
  • dataset list --type dataset|mergedDataset, plus a Type column. Combining mergedDataset with --data-source-id is left to the API to refuse.
  • 409 while a dataset modification is applied: the error ends with "Retry after N s", read from Retry-After. There is no automatic retry.
  • Types:
    • DatasetListItem.type;
    • MetricListItem.description;
    • MetricDetail.logicalOperators (no longer optional);
    • new DataboardListItem.
  • Docs (the npm page):
    • README: the Dashboards, Metric Descriptions and Reading Metric Values sections, Errors (409 / Retry-After), and the regenerated command reference.
    • CHANGELOG 1.1.0, written in place.
    • skills/databox-metrics and skills/databox-datasets.

The CLI makes no v1 calls, so the API's v1 admin-only change doesn't affect it. Its new error shapes and permission 403s are shown the way they come.

Also in 1.1.0: --api-url validation (#9 plus the follow-up fixes)

  • fix: reject an --api-url that is not an http(s) URL, with exit 2 #9 (merged into main, brought in here): --api-url, DATABOX_API_URL and a stored apiUrl must be an http(s) URL. A bad flag or env value exits 2 before any prompt or request, a bad stored value exits 1, and auth login refuses a bad --api-url before reading the key.
  • Follow-up from the review of fix: reject an --api-url that is not an http(s) URL, with exit 2 #9:
    • Messages say what is wrong and never repeat the value, so a key pasted as the URL stays out of CI logs.
    • Surrounding whitespace is ignored: requests are built from one normalised base, and auth login saves that.
    • auth login without --api-url refuses a bad stored URL before reading the key.
    • A username, password, query string or fragment is refused.
    • A stored null falls back to the default.
  • Tests: 734 unit tests passing.

Verified

  • Clean build; test typecheck and lint pass.
  • npm test: 672 passing.
  • Unit tests:
    • request bodies asserted with lastBody for dashboard rename, metric update --description (including "") and metric data;
    • flag validation for --type, --granularity, --search and the IDs.
  • e2e on a 2.1 dynamic environment: the dashboard, databoard, dataset and metric suites gave 64 passing, 0 failing, 0 skipped.
    • Dashboard rename: it runs under withRestore(), and the name is restored.
    • Description: it is set, read back and cleared with "" on a metric the suite created.
    • --type mergedDataset: the API refuses it when combined with --data-source-id.
    • Unknown dashboard id: the API answers "Dashboard not found" on id.
  • npm pack --dry-run: 1.1.0, with the dashboard commands included.

Noticed, not changed

  • About 15 existing comments, including in .claude/rules/commands.md and e2e-testing.md, claim @oclif/test's runCommand refuses an empty flag value. It doesn't; update.test.ts now passes "".
  • The other list commands still drop a blank --search silently; only dashboard list refuses it, as commands.md requires.

🤖 Generated with Claude Code

bwiz and others added 3 commits October 26, 2026 09:35
… datasets

Follows the Databox API 2.1:
- metric data: read a metric's values over a date range, with dimensions and
  filters; syncInfo reports status, lastSyncedAt and message.
- dashboard list / metrics / rename on /v2/dashboards. databoard list and
  databoard metrics use the new routes and are deprecated.
- metric update --description sets a description; an empty value clears it.
  metric get shows it.
- dataset list --type dataset|mergedDataset, with a Type column.
- A 409 while a dataset modification is applied says when to retry.
- Types follow the API contracts: dataset type, metric description,
  logicalOperators; hourly granularity is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…itespace, and auth login checks a stored URL

Follow-up to the --api-url validation:
- Error messages describe what is wrong (no scheme, a scheme other than
  http/https, a username or password, a query string or fragment) and never
  repeat the value, so a key pasted as the URL stays out of logs.
- Surrounding whitespace is ignored: every request is built from one
  normalised base URL, and auth login saves that normalised URL.
- auth login without --api-url fails on an invalid stored URL before reading
  the key, with the same message as other commands.
- A stored null apiUrl falls back to the default URL; a non-string exits 1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@bwiz bwiz added the minor Minor (Semantic Versioning) label Oct 26, 2026
@bwiz
bwiz merged commit e800241 into main Oct 26, 2026
5 checks passed
@bwiz
bwiz deleted the feature/v2-1 branch October 26, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Minor (Semantic Versioning)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant