Skip to content

fix(github): offer every database type and link the docs on first contact - #1308

Draft
aparajon wants to merge 2 commits into
mainfrom
armand/first-contact-config-comments
Draft

fix(github): offer every database type and link the docs on first contact#1308
aparajon wants to merge 2 commits into
mainfrom
armand/first-contact-config-comments

Conversation

@aparajon

@aparajon aparajon commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

The comment a user reaches before they have a working schemabot.yaml told them type must be vitess or mysql. Config validation accepts four types, so an adopter arriving with a correct Postgres or Strata config was being told to break it — on the first comment SchemaBot ever posts them.

Both surfaces now read one registry, storage.DatabaseTypes, so the set SchemaBot accepts and the set it offers cannot drift apart:

                       storage.DatabaseTypes
                    (mysql, vitess, strata, postgres)
                                 │
                 ┌───────────────┴───────────────┐
                 ▼                               ▼
      ┌────────────────────┐          ┌─────────────────────┐
      │ config validation  │          │  first-contact PR   │
      │ (what is accepted) │          │ (what is offered)   │
      └────────────────────┘          └─────────────────────┘

These comments also carried no way out: no link, and setup instructions that named "your schema directory" — a directory the reader does not have yet, since not having it is why they are reading the comment. Each of the four now names the directory the file belongs in and links the page documenting it (UX-4).

Documentation links move to pkg/ui, and a test walks the link set against the docs/ tree and resolves each #anchor against a real heading, so a page that moves or a heading that is reworded fails CI instead of shipping a 404.

Invariants: upholds UX-4 — the comment names the next action instead of reporting a condition. No other entry is touched.

No config found

ℹ️ No SchemaBot Configuration Found

Environment: staging

Requested by @Someone at 2026-01-15 14:30:00 UTC

No schemabot.yaml configuration file was found in this repository.

Setup Instructions

Create a schemabot.yaml file in the directory holding the .sql files that declare your tables:

database: your-database-name
type: mysql

type is one of mysql, vitess, strata, postgres.

Setting up schemabot.yaml

If you already have a config

Use the -d flag to specify which database to plan:

schemabot plan -e staging -d <database-name>
Config present but incomplete

⚠️ No Valid SchemaBot Configuration Found

Environment: staging

Requested by @Someone at 2026-01-15 14:30:00 UTC

The schemabot.yaml file must include database and type fields:

database: your-database-name
type: mysql
  • database (required): The database name
  • type (required): one of mysql, vitess, strata, postgres

Setting up schemabot.yaml

Database not found

⚠️ Database Not Found

Database: nonexistent-db | Environment: staging

Requested by @Someone at 2026-01-15 14:30:00 UTC

No schemabot.yaml configuration with database: nonexistent-db was found in this repository.

Check that your schemabot.yaml file has the correct database field matching the -d flag value.

Setting up schemabot.yaml

This pull request was written by Claude Code (Claude Opus 5).

…tact

The comment a user reaches before they have a working schemabot.yaml told
them `type` must be `vitess` or `mysql`. Config validation accepts four
types, so a Postgres or Strata adopter with a correct file was being told
to break it. Both surfaces now read one registry, `storage.DatabaseTypes`,
so the set SchemaBot accepts and the set it offers cannot drift apart.

These comments also carried no way out: no link, and setup instructions
that assumed a schema directory the reader does not have yet. Each now
names the directory the file belongs in and links the page documenting it
(UX-4). The link set is checked against the docs tree, so a page that moves
or a heading that is reworded fails a test instead of shipping a 404.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 5, 2026 19:54

Copilot AI 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.

🟡 Changes recommended

storage.DatabaseTypes is exposed as a mutable exported slice, creating an API footgun where external packages can silently alter validation and rendered UX at runtime.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the “first-contact” GitHub PR comments shown when a repo’s schemabot.yaml is missing/invalid by (1) listing every supported database type (mysql/vitess/strata/postgres) from a single registry shared with config validation, and (2) adding stable documentation links (with tests that fail if links/anchors rot).

Changes:

  • Introduce storage.DatabaseTypes / storage.IsDatabaseType and use them for server-side config validation and template rendering so accepted vs offered types cannot drift.
  • Add pkg/ui documentation link constants (SchemaConfigDocURL, ThrottleDocURL) plus a test that validates pages exist and anchors resolve.
  • Update error templates + TEMPLATES.md examples to include the docs link and clearer setup wording.
File summaries
File Description
TEMPLATES.md Updates rendered template examples to include full type list and a link to setup docs.
pkg/webhook/templates/errors.go Renders database type choices from storage.DatabaseTypes and adds a docs link to first-contact error comments.
pkg/webhook/templates/errors_test.go Adds coverage ensuring first-contact comments include the docs link and all supported types.
pkg/ui/throttle.go Moves ThrottleDocURL out of this file (now centralized in pkg/ui/docs.go).
pkg/ui/docs.go Centralizes user-facing documentation URLs and enumerates them in DocLinks.
pkg/ui/docs_test.go Validates DocLinks targets exist and (when present) anchors match real headings.
pkg/storage/types.go Adds a shared database-type registry (DatabaseTypes) and validator (IsDatabaseType).
pkg/api/config.go Switches database type validation to storage.IsDatabaseType and formats errors from storage.DatabaseTypes.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/storage/types.go Outdated
Comment thread pkg/ui/docs.go Outdated
The set of types a schemabot.yaml may declare is what config validation
accepts, and its other readers only render it. Exporting the backing slice
let any of those readers widen what validates by holding on to it, so the
slice is unexported behind a DatabaseTypes() accessor that clones, matching
RetiredControlOperations() beside it.

Also rewords the DocsBaseURL doc comment, which read as a stutter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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