Skip to content

feat(cli): add test-db skill topic - #7892

Open
Prashansa-K wants to merge 5 commits into
developfrom
prashansakulshrestha/cli-3304-add-test-db-skill-topic
Open

Prashansa-K wants to merge 5 commits into
developfrom
prashansakulshrestha/cli-3304-add-test-db-skill-topic

Conversation

@Prashansa-K

@Prashansa-K Prashansa-K commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds the test-db topic to supabase skill display, with guidance for running pgTAP tests through supabase test db.

The topic covers:

  • Where tests live (supabase/tests, files or directories as arguments, test new) and what the command does and does not do (it enables pgTAP for the run, and does not apply migrations or reset).
  • Reading the raw pg_prove output, which is not wrapped in a JSON envelope, and what the one-line stderr failure message does and does not say.
  • Telling real test failures (fix the test or schema, never reset or retry unchanged) from setup failures (stack down, pgTAP unavailable, no tests found, bad path, unapplied migrations), with the next command for each.
  • When a local reset or migration up helps before a run and when it does not, pointing to the migrations topic for db reset.
  • --remote: supported but not recommended, and the approval flow the agent follows before it runs against a hosted database.

It also registers the topic, adds it to the overview's topic list, and drops one bullet from migrations that the overview already covers, to keep that topic under its size cap now that the footer lists one more topic.

🤖 Generated with Claude Code

@Prashansa-K
Prashansa-K requested a review from a team as a code owner December 1, 2026 05:54
@Prashansa-K
Prashansa-K requested a review from jgoux December 1, 2026 05:54
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit b62fbda against develop at 00782d7 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 155 ms 152 ms no real change
supabase --help help 157 ms 157 ms no real change
supabase init init 158 ms 159 ms no real change
supabase migration new bench migration-new 164 ms 165 ms no real change
supabase config convert config-convert 164 ms 164 ms no real change
supabase config validate config-validate 175 ms 176 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 194 ms 194 ms no real change
supabase projects list projects-list 172 ms 175 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 197 ms 191 ms no real change

API calls: unchanged for all 9 commands.

Binary size: 135.7 MB, up 8.0 KB from 135.7 MB.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 151-183 ms 151-159 ms -2 ms (-2%) within noise
supabase --help help 155-168 ms 155-172 ms +0 ms (+0%) within noise
supabase init init 155-160 ms 156-163 ms +1 ms (+1%) within noise
supabase migration new bench migration-new 162-179 ms 162-172 ms +2 ms (+1%) within noise
supabase config convert config-convert 162-168 ms 162-168 ms 0 ms (0%) within noise
supabase config validate config-validate 171-191 ms 172-183 ms +1 ms (+1%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 184-221 ms 182-256 ms -1 ms (0%) within noise
supabase projects list projects-list 169-186 ms 172-189 ms +3 ms (+1%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 176-307 ms 175-255 ms -5 ms (-3%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase config validate config-validate 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@github-actions github-actions Bot 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.

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@3dcb524 supplied to reviewers (advisory, not a style pass).

Both independent reviews were available. Eight distinct findings were confirmed in the new test-db skill topic. The most consequential is that the hosted retry guidance can redirect write-capable tests away from the database the user approved. The CLI reference style snapshot was available, and its scope excludes the changed skill content and metadata. The diff introduces no overlay drift, breaking CLI behavior, or fundamental conflict with the supplied next work.

Findings

Severity Location Category Sources Claim
🟠 MAJOR apps/cli/src/commands/skill/content/test-db.md:52 correctness claude+codex The hosted approval instructions tell the agent to retry with a project ref even when the user approved a database URL. Substituting the ref can run write-capable SQL on a different database.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:25 correctness claude The topic says every failure emits plain-text stderr in JSON mode. Setup and consent failures can instead emit a JSON error envelope on stdout.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:51 correctness claude The hosted approval guidance omits that an approved retry can remove the project's network bans while establishing the connection.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:34 error-handling codex The pgTAP availability check queries the local database even when extension creation failed on a hosted database.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:23 error-handling codex The output guide treats a TAP plan mismatch paired with a nonzero test exit as proof that SQL execution stopped early.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:33 error-handling codex The troubleshooting guide diagnoses a stopped stack from errors that also occur while the database is running but unhealthy or unreachable.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:45 correctness codex The reset guidance rules out a reset for a failed assertion even when local schema drift caused the failure.
🟡 MINOR apps/cli/src/commands/skill/content/test-db.md:51 correctness codex The hosted warning implies that the presence of ROLLBACK determines whether test SQL changes hosted data.

Stats

Claude findings: 3 · Codex findings: 6 · Confirmed: 8 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@blacksmith-sh

blacksmith-sh Bot commented Dec 1, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
src/commands/skill/content/topics.unit.test.ts/skill topic migrations content >
renders within its size cap
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@Prashansa-K

Copy link
Copy Markdown
Contributor Author

Waiting on #7891 (functions skill topic) to merge before this PR goes green.

On develop, every rendered topic ends with a footer that lists every other registered topic. Registering a new topic therefore adds a footer line to every existing topic, including migrations, which already renders close to the 12 KB cap. With this PR's topic added, migrations goes over the cap and the size test in topics.unit.test.ts fails, even though migrations.md is unchanged here.

#7891 replaces that footer with a per-topic related list, so adding a topic no longer grows the others. Once it merges, this PR will be rebased onto it and the unit tests should pass without trimming migrations.md.

Prashansa-K and others added 5 commits December 2, 2026 07:40
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Prashansa-K
Prashansa-K force-pushed the prashansakulshrestha/cli-3304-add-test-db-skill-topic branch from 4780edf to ff51d98 Compare December 2, 2026 02:16
@Prashansa-K Prashansa-K self-assigned this Dec 2, 2026

This branch has not been deployed

No deployments
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.

1 participant