Skip to content

Require Config.Stores and drop the PostgreSQL code from gonsole/auth - #77

Merged
SirLouen merged 12 commits into
mainfrom
feat/76-auth-080
Oct 13, 2026
Merged

SirLouen merged 12 commits into
mainfrom
feat/76-auth-080

Conversation

@SirLouen

@SirLouen SirLouen commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Closes #76

What

  • Config.Stores is required. A nil one makes every account command, Authorize and Record fail with an error that names it.
  • Migration, RecordMigration, PostgresRecords and the records migration are removed. gonsole/auth/postgres has Migration, RecordMigration and NewRecordStore in their place.
  • The module no longer requires pgx, goose, pgtestdb or authkit/postgres.
  • The tests run on in-memory stores: gouncer's testkit store and a records fake that passes recordstest. CI tests the module with no PostgreSQL server.
  • The shared PostgreSQL test server now starts from dbkit/postgres/compose.yaml.

Why

A program on SQLite that imports gonsole/auth links the PostgreSQL driver today, through the default of a nil Config.Stores. Now the core holds the interfaces and the commands, and each engine lives in a module of its own. This is a breaking change, released as 0.8.0.

Testing Instructions

Stop the PostgreSQL test server of gonsole/auth/compose.yaml and start it from dbkit/postgres/compose.yaml. The tests of dbkit/postgres and gonsole/auth/postgres pass on it.

Summary by CodeRabbit

  • Breaking Changes
    • Config.Stores is required. Authentication commands, authorization, and record creation fail if it is unset.
    • gonsole/auth no longer provides PostgreSQL migrations or record storage. Use gonsole/auth/postgres for PostgreSQL-backed capabilities.
  • Improvements
    • SQLite-based programs no longer pull in a PostgreSQL driver through gonsole/auth.
    • Authentication and record-store tests now run against in-memory stores, without requiring PostgreSQL.

@SirLouen SirLouen self-assigned this Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ae7f8a53-b3de-498c-9519-202c6f7679ff
📥 Commits

Reviewing files that changed from the base of the PR and between 6d18678 and f90a97d.

📒 Files selected for processing (5)
  • gonsole/auth/authorize_test.go
  • gonsole/auth/createadmin_test.go
  • gonsole/auth/grantrole_test.go
  • gonsole/auth/memory_test.go
  • gonsole/auth/record_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

gonsole/auth now requires configured stores and removes its PostgreSQL store and migration code. Record writes use the configured Records store. Tests use in-memory stores, and CI runs gonsole/auth in the general test matrix rather than the PostgreSQL matrix.

Changes: Auth store decoupling

Layer / File(s) Summary
Require configured stores and remove PostgreSQL code
gonsole/auth/config.go, gonsole/auth/record.go, gonsole/auth/schema.go, gonsole/auth/pgrecords.go, gonsole/auth/migrations/*, gonsole/auth/go.mod, gonsole/auth/.golangci.yml, gonsole/auth/CHANGELOG.md, gonsole/auth/postgres/numbers_test.go, gonsole/auth/schema*_test.go
Config.Stores is required, and Record writes through its configured Records store. The module removes its PostgreSQL store and migration code, related dependencies, and migration tests. The changelog records the required setting and removed APIs.
Replace PostgreSQL test setup with in-memory stores
gonsole/auth/memory_test.go, gonsole/auth/*_test.go
Auth tests use in-memory stores and world fixtures. They check nil-store failures, account commands, record operations, and store contracts without PostgreSQL-backed fixtures.
Route auth tests through the general CI matrix
.github/workflows/ci.yml, dbkit/postgres/compose.yaml
The general test matrix adds gonsole/auth; the PostgreSQL matrix removes it. The Compose project name changes to dbkit-postgres.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to f90a9

This change moves auth tests onto in-memory stores. No concrete production risk was identified in the reviewed test changes.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 96 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the two main changes: requiring Config.Stores and removing PostgreSQL code from gonsole/auth.
Linked Issues check Passed The pull request satisfies the coding requirements in directly linked issue [#76]. Config.Stores is required, and withStores returns a named missing-stores error. Tests cover Authorize, Record…
Out of Scope Changes check Passed The changes remain within issue [#76]. CI and Compose updates support the required PostgreSQL module separation. In-memory stores, contract tests, dependency cleanup, and changelog updates support the…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

codescene-access[bot]

This comment was marked as outdated.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High impact] No outstanding findings prevent merging. The previous dry-run test coverage issue is fully addressed.

Summary

This PR requires Config.Stores and removes PostgreSQL code and dependencies from gonsole/auth.

  • Auth commands and hooks use only the stores an app provides.
  • The core auth package no longer ships PostgreSQL storage or migrations.
  • Shared auth tests run without a PostgreSQL server.

No outstanding findings prevent merging.

Reviews (2) · Last reviewed commit: "test(gonsole/auth): check that create-ad..." · Reviewed by Greptile

Comment thread gonsole/auth/grantrole_test.go Outdated

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Improved (7 files improve in Code Health)

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

View Improvements
File Code Health Impact Categories Improved
authorize_test.go 8.28 → 10.00 Complex Conditional
createadmin_test.go 9.39 → 10.00 Code Duplication
grantrole_test.go 9.31 → 10.00 Complex Conditional, Bumpy Road Ahead
list_test.go 9.39 → 10.00 Complex Conditional
reach_test.go 9.10 → 10.00 Code Duplication, String Heavy Function Arguments
record_test.go 8.82 → 10.00 Complex Conditional
records_test.go 8.16 → 10.00 Complex Method, Complex Conditional

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@SirLouen
SirLouen merged commit 0207ef8 into main Oct 13, 2026
41 checks passed
@SirLouen
SirLouen deleted the feat/76-auth-080 branch October 13, 2026 20:06
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.

Drop the PostgreSQL code from gonsole/auth and require Config.Stores

1 participant