Skip to content

chore(sqlc): CI gate for stale generated query code (#7) - #26

Merged
vianbas merged 3 commits into
mainfrom
chore/7-sqlc-ci-gate
Jun 18, 2026
Merged

chore(sqlc): CI gate for stale generated query code (#7)#26
vianbas merged 3 commits into
mainfrom
chore/7-sqlc-ci-gate

Conversation

@vianbas

@vianbas vianbas commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds make sqlc-check Makefile target wrapping sqlc diff for local use.
  • Updates CONTRIBUTING.md Workflow step 4 to document make sqlc / make sqlc-check when SQL sources change.
  • Adds a sqlc diff gate to the backend CI job: installs sqlc v1.31.1 (matching the committed generated-code header) and fails if internal/platform/postgres/db/ is stale relative to queries/*.sql.

Closes #7

Changed files

File Change
Makefile Added sqlc-check to .PHONY; added sqlc-check target after sqlc
CONTRIBUTING.md Extended Workflow step 4 with make sqlc / make sqlc-check instructions
.github/workflows/ci.yml Added "Install sqlc" and "Check sqlc output is up to date" steps to backend job, between Set up Go and Verify formatting
docs/superpowers/plans/2026-06-18-sqlc-ci-gate.md Implementation plan (committed as project artifact)

Architecture

No application code changes. The sqlc query layer was already complete when this PR was opened: queries/*.sql, internal/platform/postgres/db/*.go, all three store packages, make sqlc, and docs/operations/local-development.md were all in place. This PR adds the optional CI gate from the issue scope and the accompanying discoverability improvements (Makefile shortcut, CONTRIBUTING.md note).

The sqlc diff step is inserted early in the backend job (after Go setup, before gofmt) so that stale generated code is caught before test and build steps run.

Security considerations

  • No secrets or credentials involved.
  • The sqlc binary is fetched from the official GitHub release at the pinned version v1.31.1 using a tarball download. Pinning to the exact version (matching // versions: sqlc v1.31.1 in committed generated files) prevents unexpected output reformatting from version upgrades.
  • sqlc diff performs file comparison only; it does not connect to any database.

Testing evidence

  • Web lint: exit 0.
  • Web typecheck: exit 0.
  • Web tests: 7/7 passed.
  • Web build: exit 0.
  • git diff --check: empty output (no whitespace errors, no conflict markers).
  • sqlc diff exits 0 against the current committed generated code (no drift) — verified by CI, which will run on this PR.
  • Go gates (fmt, vet, test, build): go not on local PATH; CI backend job covers this. No Go source files were modified so regression is not possible.

Known limitations

  • The CI download URL is linux_amd64-specific. Local make sqlc-check requires a platform-appropriate sqlc install (see docs/operations/local-development.md).
  • make verify intentionally does not call make sqlc or make sqlc-check — regeneration is always a manual step so developers decide when to evolve the schema.

Follow-up issues

None — this closes #7.

Viko and others added 3 commits June 18, 2026 16:56
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vianbas
vianbas merged commit ac48505 into main Jun 18, 2026
3 checks passed
@vianbas
vianbas deleted the chore/7-sqlc-ci-gate branch June 18, 2026 11:03
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.

chore: sqlc query layer for feature modules

1 participant