Skip to content

fix(config)!: address a database section's errors to that section - #1115

Merged
gaborage merged 2 commits into
mainfrom
fix/config-error-field-path
Aug 21, 2026
Merged

fix(config)!: address a database section's errors to that section#1115
gaborage merged 2 commits into
mainfrom
fix/config-error-field-path

Conversation

@gaborage

@gaborage gaborage commented Aug 20, 2026

Copy link
Copy Markdown
Owner

What

All three database sections share one normalization module, so each raised errors spelling their fields against the root. The startup door attached the path by wrapping the message, leaving the *ConfigError behind errors.As saying Field = "database.database", so a consumer switching on Field could not tell which section failed. The path now lives in Field and only there (databases.reporting.host, multitenant.tenants.acme.database.host), byte-identical to what ADR-051's delivered-empty check already emits.

Impact

Breaking (ADR-076, atom C60.16). field == "database.host" matchers break for non-root sections — errors.As plus a suffix match survives — and the message loses its databases.reporting: prefix. Root and the connect door are unchanged. Filed not fixed: #1113 (the runtime door and three other tenant-tree spellings), #1114 (Action still names the root env var).

Verification

A test cross-checks the qualified spelling against the delivered-empty producer over every identity key, rather than trusting two hand-typed tables to agree.

Closes #1025

Summary by CodeRabbit

  • Bug Fixes

    • Database configuration validation errors now include the relevant section path in their field details.
    • Root-level connection errors retain their existing field names.
    • Error details are preserved consistently across nested database configurations.
  • Documentation

    • Added guidance on handling section-qualified configuration errors, migration considerations, and matching database-scoped fields.
    • Documented scheduler normalization and validation behavior.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

Next review available in: 37 minutes

Limit details: You’ve used the included review currently available. Your 105 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 75872113-d8d7-4779-a734-c0122d2988cc

📥 Commits

Reviewing files that changed from the base of the PR and between 58607a0 and f749c7c.

📒 Files selected for processing (2)
  • wiki/architecture_decisions.md
  • wiki/migrations.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99c165dd-7b2d-41d9-ba16-580177667bb1

📥 Commits

Reviewing files that changed from the base of the PR and between 4c94c8f and 58607a0.

📒 Files selected for processing (6)
  • CLAUDE.md
  • config/database_section.go
  • config/database_section_test.go
  • wiki/adr_076_section_qualified_config_error_field.md
  • wiki/architecture_decisions.md
  • wiki/migrations.md

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

Database section normalization now qualifies ConfigError.Field values for named and tenant sections. Root errors retain root field names. Tests cover qualification rules, and ADR-076 plus migration guidance document the behavior.

Changes

Database error qualification

Layer / File(s) Summary
Qualification logic and validation
config/database_section.go, config/database_section_test.go
Normalization errors now use section-qualified fields for named and tenant databases. Structured errors are copied with qualified fields and cloned details. Tests cover root, named, tenant, nested, and connect-time cases.
Decision and migration documentation
CLAUDE.md, wiki/adr_076_section_qualified_config_error_field.md, wiki/architecture_decisions.md, wiki/migrations.md
ADR-076 and migration records document field qualification, root exceptions, and database-scoped matching predicates.

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

Merge Risk: ⚪ Minimal · up to 58607

This PR qualifies non-root database configuration error fields while preserving root behavior and documenting the consumer migration. No actionable merge-blocking risk remains after normal checks and review.

Poem

I’m a rabbit with a tidy config trail,
Qualified fields now point without fail.
Root paths stay rooted, sections align,
Tests guard each database line.
Hop, hop—ADR-076 is fine!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The migration update adds unrelated C60.12 scheduler guidance outside the database error qualification objectives. Remove the unrelated C60.12 scheduler guidance or move it to a separate pull request.
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (4 skipped: 4 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: qualifying database section errors to their sections.
Linked Issues check ✅ Passed The changes satisfy #1025 and explicitly defer the runtime inconsistencies described in #1113.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/config-error-field-path

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

@gaborage
gaborage force-pushed the fix/config-error-field-path branch from a9f6e5a to 58607a0 Compare August 21, 2026 02:13
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 21, 2026
Root, databases.<name>, and multitenant.tenants.<id>.database share one
normalization module and therefore one set of error constructors, all
spelling their fields against the root. The startup door attached the
section path by WRAPPING, so the message read "databases.reporting:
config_missing: database.database required" while the *ConfigError a
consumer reaches through errors.As still said Field="database.database".
A consumer switching on Field could not tell which section failed, and
the spelling disagreed with the path-qualified keys ADR-051's
delivered-empty check already emits for the same sections.

normalizeDatabaseSection now rewrites the error it returns: a key under
the root section swaps its "database" head for the section path
(databases.reporting.host), and a tenant keeps its own trailing
".database" (multitenant.tenants.acme.database.host) -- byte-identical
to the delivered-empty spelling, cross-checked by a test over every
identity key rather than by two hand-typed tables agreeing. A field that
is not key-shaped is prefixed instead, so the Oracle connection-
identifier check keeps its name.

The rewrite works on a copy, because the constructors are shared with
the connect door, which resolves a config with no section path to speak
of; that door keeps the root spelling and is pinned by its own test. The
wrapping message is gone, so the path is printed once.

Two adjacent defects were found while writing this and are filed, not
fixed: the runtime door still reports the root spelling for a
dynamically-resolved tenant, alongside three other Field spellings in
the tenant tree (#1113), and Action still names the root env var for a
named section, which the removed wrapper used to frame as a template
(#1114). ADR-076 records both deferrals and their cost.

Decision recorded in ADR-076; migration atom C60.16.

Closes #1025
CodeRabbit (mirror#6). The migration advice told consumers to replace
field == "database.host" with strings.HasSuffix(field, ".host"), but
ConfigError.Field is not a database-only namespace: cache.redis.host and
messaging.broker.host both end in .host, so a consumer following the
runbook would route an unrelated config error as a database-host error.

C60.16 now carries a predicate scoped to the three database field
families -- exact match on database.<key>, and a suffix only behind the
databases. or multitenant.tenants. prefix -- and the ADR, the ADR index
summary and the CLAUDE.md line say the same thing rather than "match by
suffix".
@gaborage
gaborage force-pushed the fix/config-error-field-path branch from 58607a0 to f749c7c Compare August 21, 2026 02:35
@gaborage
gaborage merged commit c383588 into main Aug 21, 2026
22 checks passed
@gaborage
gaborage deleted the fix/config-error-field-path branch August 21, 2026 02:39
@sonarqubecloud

Copy link
Copy Markdown

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.

config: tenant-tree errors use four different Field spellings config: path-qualify ConfigError.Field for named and tenant database sections

1 participant