Skip to content

fix(config): refuse to start when a rejected settings document discarded a store selection (#1305) - #1383

Merged
chappie-daemon merged 1 commit into
rewrite/mainfrom
factory/048-settings-backend-fallback
Dec 4, 2026
Merged

chappie-daemon merged 1 commit into
rewrite/mainfrom
factory/048-settings-backend-fallback

Conversation

@chappie-daemon

Copy link
Copy Markdown
Collaborator

Issue: #1305 (closed by hand with the merge sha after merge — Closes is inert against rewrite/main).

The defect

One rejected field anywhere in settings.yaml made nostream_config::load return the shipped defaults with used_defaults: true, and settings_gate logged the issues and continued. Since the shipped eventStore.backend is postgres, an LMDB deployment silently dialled Postgres and served and accepted writes into the old store while the data directory it was pointed at sat unused — a data-loss-class failure that fires exactly when an operator is editing config.

Measured at 7019957a: a valid eventStore.backend: lmdb document plus limits.rateLimiter.strategy: random printed continuing on the shipped defaults, resolved backend=Postgres, and died on the Postgres dial with an empty LMDB directory.

The fix

LoadOutcome now carries discarded_store_selection — the user document's own eventStore.backend value (or the subtree, for a typo inside eventStore) — recorded on the shape-walk and fit arms and None when the document named no store. apply_settings_gate refuses to start (exit 2, InvalidSettings) when the discarded selection is not the backend the defaults would serve, printing

nostreamd: refusing to start: the rejected settings document sets eventStore.backend=lmdb; the shipped defaults would serve postgres

A document that names no store, an explicit postgres, and an unparseable file keep today's continue-on-defaults behaviour (ADR 0022 D5 records the unparseable limit). --check output is byte-identical, refusal is checked after it, and the refusal happens before telemetry, bind and store open.

ADR 0022-store-selection-refusal.md records the rule and the safe-field partition and amends 0009 and 0008; deploying.md carries the amended exit-2 claim.

Evidence

All 14 criteria in the job record with commands and output, including the process test (exit 2, exact stderr, empty stdout, no event store backend resolved) proven to fail at base (exit 1, backend=Postgres), four inversions (refusal disabled, blanket refusal, refusal on the check path, merged-document selection), and the S1–S8 behaviour diff measured against a base binary.

@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c0e1252

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ae6a6d89-be65-42fc-9fdd-09045fcd2d0e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The loader now records a rejected document’s store selection. The daemon exits 2 before startup if using the defaults would replace that selection, as specified by ADR 0022.

  • The daemon stops when rejected settings could switch its event store.

Review was based on source and test inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load user settings] --> B{Document accepted?}
  B -->|Yes| C[Use user settings]
  B -->|No| D[Return defaults and issues]
  D --> E{Check mode?}
  E -->|Yes| F[Exit 2 with existing output]
  E -->|No| G{Discarded selection differs or is invalid?}
  G -->|Yes| H[Print refusal and exit 2]
  G -->|No selection or matching backend| I[Continue on defaults]
  C --> J[Start daemon]
  I --> J
Loading

Reviews (1) · Last reviewed commit: "fix(settings): refuse a rejected documen..." · Reviewed by Greptile

@chappie-daemon chappie-daemon changed the title config: refuse to start when a rejected settings document discarded a store selection (#1305) fix(config): refuse to start when a rejected settings document discarded a store selection (#1305) Dec 4, 2026
@chappie-daemon
chappie-daemon merged commit db0be6a into rewrite/main Dec 4, 2026
19 of 20 checks passed
@chappie-daemon
chappie-daemon deleted the factory/048-settings-backend-fallback branch December 4, 2026 15:39
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.

1 participant