Skip to content

docs: sync API_DOCS type blocks with source interfaces - #580

Merged
cevheri merged 3 commits into
libredb:mainfrom
sonalisrisivani:docs/api-types-567
Sep 6, 2026
Merged

docs: sync API_DOCS type blocks with source interfaces#580
cevheri merged 3 commits into
libredb:mainfrom
sonalisrisivani:docs/api-types-567

Conversation

@sonalisrisivani

Copy link
Copy Markdown
Contributor

Summary

  • Bring the DatabaseConnection and QueryResult TypeScript blocks in docs/API_DOCS.md field-for-field with src/lib/types.ts, carrying the interface comments and noting which connection fields the server reads versus client-side bookkeeping (color, environment, group, managed, seedId).
  • Add a drift guard that extracts top-level field names from each of the four Data Types blocks (DatabaseConnection, QueryResult, TableSchema, HealthInfo) and from the matching interfaces, and asserts they are equal. Written first, it failed on the two drifted blocks and passed on the other two.

Fixes #567.

Test plan

  • tests/unit/api-docs-types.test.ts failed on DatabaseConnection and QueryResult before the doc edit; TableSchema and HealthInfo already matched.
  • After the doc edit, all five assertions in that file pass.
  • CI bun run test (100% line-coverage gate) on this PR.

DatabaseConnection and QueryResult had drifted behind src/lib/types.ts; a field-name guard on all four Data Types blocks fails until the docs follow. Fixes libredb#567.
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cevheri

cevheri commented Sep 6, 2026

Copy link
Copy Markdown
Member

Welcome, and thanks for picking this up. The two blocks now match src/lib/types.ts field for field and in order, and the guard bites: I removed seedId from the doc block locally and the DatabaseConnection case failed as it should.

Two changes before merge.

  1. The typecheck failure is one line. ] as const; at tests/unit/api-docs-types.test.ts:30 makes SHAPES a readonly tuple, and Bun's test.each(table: T[]) takes a mutable array. Both red checks are this one error, since next build runs tsc first. Change the line to ];. With that, bun run typecheck, the test file, bun run format and bun run knip pass here.

  2. The prose lists createdAt among the fields the server reads to open a connection. It does not: src/lib/db/factory.ts keys the provider cache on id and reads type, host, port, the credentials, ssl and sshTunnel. Move createdAt to the client-side list.

Not blockers. Your test plan left bun run test unchecked; the local gate in CONTRIBUTING step 4 would have caught this in twenty seconds. If your environment cannot run it, say so and we read CI together. And #567 was claimed by @shashank-sn seventy minutes before your comment; check the thread before claiming. This PR stays, since it is here
and correct; I am pointing them to a sibling issue.

@cevheri

cevheri commented Sep 6, 2026

Copy link
Copy Markdown
Member

Hi @shashank-sn, can you review this PR and write a small notes

@cevheri

cevheri commented Sep 6, 2026

Copy link
Copy Markdown
Member

main moved this afternoon: 0.13.7 became 0.14.0 and the chart 0.1.58 became 0.1.59, tagged at 14:05 +03. This branch is 18 commits behind and still carries Chart.yaml version: 0.1.58 / appVersion: "0.13.7".

One thing the update will not clear: Lint, Typecheck and Build is already failing here, and it is failing on Run TypeScript type check, not on the chart guard. That one is in your diff and still needs fixing. bun run typecheck reproduces it locally.

Please take current main before the next round. From a fork:

git remote add upstream https://github.com/libredb/libredb-studio.git   # once
git fetch upstream
git merge upstream/main          # or: git rebase upstream/main
git push                         # after a rebase: git push --force-with-lease

Why now rather than at merge time: the chart version sync guard is the first step of Lint, Typecheck and Build, and CI fetches main with --depth=1, so it compares your Chart.yaml against main's tip rather than against your merge base. libredb-studio-0.1.58 is a released tag, so the guard refuses it. When that step fails the job stops there and the eleven gates behind it (the three other drift guards, format, lint, typecheck, knip, build, build:lib, attw and the Go launcher tests) come back unmeasured rather than green. Measured on #582 earlier today; merging main cleared it.

@sonalisrisivani

Copy link
Copy Markdown
Contributor Author

Updated PR #580 and pushed commit 95776812.

Changes:

  • Rebases the branch onto current main (including the current chart/package versions).
  • Fixes the Bun typecheck issue by replacing the readonly test.each table callback with explicit tests.
  • Classifies createdAt as client-side bookkeeping in the DatabaseConnection prose.

Validation:

  • bun test tests/unit/api-docs-types.test.ts: 5 passed
  • bun run typecheck: passed
  • bunx biome check docs/API_DOCS.md tests/unit/api-docs-types.test.ts: passed
  • git diff --check: passed

The full local suite previously reached 10,387 passing tests but had 166 unrelated chart/infrastructure hook-timeout failures; CI has been triggered again by this push.

@cevheri cevheri added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 6, 2026
@cevheri
cevheri merged commit 266baaf into libredb:main Sep 6, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs/API_DOCS.md: the DatabaseConnection and QueryResult type blocks are behind the source interfaces

2 participants