Skip to content

Conversation

@tolgaozen
Copy link
Member

@tolgaozen tolgaozen commented Nov 15, 2025

…ables

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated database configuration key naming: min_idle_conns renamed to min_idle_connections for improved consistency. If you use this setting, update your configuration files and environment variables (e.g., PERMIFY_DATABASE_MIN_IDLE_CONNECTIONS) accordingly.

@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Walkthrough

The changes rename the database pool configuration key min_idle_conns to min_idle_connections throughout the codebase, affecting configuration files, documentation, flags, environment variables, and the internal Postgres connection pool implementation.

Changes

Cohort / File(s) Summary
Documentation & Examples
docs/performance-test/values.yaml, docs/setting-up/configuration.mdx, example.config.yaml
Configuration key renamed from min_idle_conns to min_idle_connections in YAML examples, environment variable mappings (PERMIFY_DATABASE_MIN_IDLE_CONNSPERMIFY_DATABASE_MIN_IDLE_CONNECTIONS), and documentation tables.
Configuration Struct
internal/config/config.go
Public field Database.MinIdleConns renamed to Database.MinIdleConnections with corresponding mapstructure tag update (min_idle_connsmin_idle_connections). Default initialization updated.
Factory & Command Logic
internal/factories/database.go, pkg/cmd/config.go, pkg/cmd/serve.go, pkg/cmd/flags/serve.go
Flag and config references updated from database-min-idle-conns to database-min-idle-connections; source field updated from conf.Database.MinIdleConns to conf.Database.MinIdleConnections.
Postgres Pool Implementation
pkg/database/postgres/consts.go, pkg/database/postgres/options.go, pkg/database/postgres/postgres.go, pkg/database/postgres/postgres_test.go
Internal field minIdleConns renamed to minIdleConnections in the Postgres struct; constant _defaultMinIdleConns renamed to _defaultMinIdleConnections; tests updated to reflect new field name.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • Homogeneous refactoring applied consistently across 13 files with a single pattern (field rename)
  • Each individual change is straightforward (struct field, constant, flag, and documentation updates)
  • Primary concern: Ensure all references across config layer, command layer, and database layer are updated consistently and no references were missed

Possibly related PRs

Poem

🐰 A constant quest for clearer names,
From minIdle to minConnections' reframe,
Each struct field, each flag aligned,
Consistency—the bunny's design!
Now docs and code in harmony sing, 🎵

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to only update documentation, but the PR makes extensive code changes across multiple Go source files (config, database, cmd) renaming MinIdleConns to MinIdleConnections. Revise the title to reflect the full scope: e.g., 'refactor: rename min_idle_conns to min_idle_connections across config and database' to accurately represent code changes, not just documentation updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/configure-min-idle-conns

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d10112 and dbeee93.

📒 Files selected for processing (12)
  • docs/performance-test/values.yaml (1 hunks)
  • docs/setting-up/configuration.mdx (4 hunks)
  • example.config.yaml (1 hunks)
  • internal/config/config.go (2 hunks)
  • internal/factories/database.go (2 hunks)
  • pkg/cmd/config.go (2 hunks)
  • pkg/cmd/flags/serve.go (1 hunks)
  • pkg/cmd/serve.go (1 hunks)
  • pkg/database/postgres/consts.go (1 hunks)
  • pkg/database/postgres/options.go (1 hunks)
  • pkg/database/postgres/postgres.go (3 hunks)
  • pkg/database/postgres/postgres_test.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
internal/factories/database.go (1)
pkg/database/postgres/options.go (1)
  • MinIdleConnections (44-48)
pkg/database/postgres/postgres_test.go (2)
pkg/database/postgres/postgres.go (1)
  • Postgres (22-52)
pkg/database/postgres/options.go (1)
  • MinIdleConnections (44-48)
pkg/cmd/config.go (2)
internal/config/config.go (1)
  • Database (160-184)
pkg/database/postgres/options.go (1)
  • MinIdleConnections (44-48)
pkg/cmd/serve.go (2)
internal/config/config.go (1)
  • Database (160-184)
pkg/database/postgres/options.go (1)
  • MinIdleConnections (44-48)
internal/config/config.go (1)
pkg/database/postgres/options.go (1)
  • MinIdleConnections (44-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze (go)
  • GitHub Check: Scan Container for Vulnerabilities
  • GitHub Check: Test with Coverage
  • GitHub Check: Test with Coverage
🔇 Additional comments (20)
example.config.yaml (1)

84-84: LGTM! Configuration key renamed for clarity.

The rename from min_idle_conns to min_idle_connections improves consistency with the min_connections naming pattern and makes the configuration more explicit.

internal/factories/database.go (2)

25-25: LGTM! Documentation updated.

Comment correctly references the renamed field MinIdleConnections.


67-69: LGTM! Field reference updated correctly.

The factory now correctly references conf.MinIdleConnections and passes it to the database option.

internal/config/config.go (2)

174-174: LGTM! Public field renamed with correct mapstructure tag.

The field rename from MinIdleConns to MinIdleConnections includes the proper mapstructure tag update to min_idle_connections, ensuring configuration file compatibility.


364-364: LGTM! Default initialization updated.

The default configuration correctly initializes MinIdleConnections to 0.

docs/performance-test/values.yaml (1)

114-114: LGTM! Helm values file updated.

The configuration key has been correctly renamed to min_idle_connections in the performance test values file.

docs/setting-up/configuration.mdx (4)

101-101: LGTM! YAML example updated.

The configuration example correctly shows min_idle_connections: 0.


407-407: LGTM! Structure documentation updated.

The configuration structure properly documents min_idle_connections.


436-436: LGTM! Glossary entry updated.

The parameter description correctly references min_idle_connections and accurately describes its mapping to pgxpool MinIdleConns.


463-463: LGTM! Environment variable mapping updated.

The environment variable has been correctly renamed to PERMIFY_DATABASE_MIN_IDLE_CONNECTIONS.

pkg/database/postgres/postgres_test.go (2)

188-193: LGTM! Test case updated.

The test correctly verifies that MinIdleConnections option sets the minIdleConnections field.


279-296: LGTM! Backward compatibility tests updated.

The test cases correctly verify that minIdleConnections is only set when explicitly configured (> 0).

pkg/database/postgres/consts.go (1)

7-7: LGTM! Internal constant renamed.

The constant has been correctly renamed from _defaultMinIdleConns to _defaultMinIdleConnections.

pkg/cmd/flags/serve.go (1)

510-515: LGTM! Flag and environment bindings updated.

The viper bindings correctly reference database.min_idle_connections and PERMIFY_DATABASE_MIN_IDLE_CONNECTIONS.

pkg/database/postgres/options.go (1)

44-48: LGTM! Internal field alignment improved.

The change correctly updates the field assignment to use minIdleConnections, aligning the internal field name with the external MinIdleConnections function name. This improves code consistency.

pkg/database/postgres/postgres.go (3)

44-45: LGTM! Field declaration updated correctly.

The struct field has been properly renamed from minIdleConns to minIdleConnections, and the comment accurately describes its purpose mapping to pgxpool's MinIdleConns.


66-77: LGTM! Default initialization updated correctly.

The initialization now uses _defaultMinIdleConnections, maintaining consistency with the renamed field.


115-120: LGTM! Field usage updated correctly.

The configuration logic correctly references minIdleConnections throughout, and the comment accurately explains the behavior.

pkg/cmd/config.go (2)

97-97: LGTM! Config command flag updated correctly.

The flag definition correctly references conf.Database.MinIdleConnections and uses the new flag name database-min-idle-connections.


227-227: LGTM! Config output updated consistently.

The configuration table output correctly displays database.min_idle_connections as the key and references cfg.Database.MinIdleConnections for the value. The getKeyOrigin call properly checks for the updated flag name (database-min-idle-connections) and environment variable (PERMIFY_DATABASE_MIN_IDLE_CONNECTIONS).

@tolgaozen tolgaozen merged commit f51cc99 into master Nov 15, 2025
13 checks passed
@tolgaozen tolgaozen deleted the fix/configure-min-idle-conns branch November 15, 2025 10:07
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