Skip to content

feat(config): minimal config persistence — Overrides user-only + sparse save#161

Open
seeyabye wants to merge 27 commits into
mainfrom
feat/minimal-config-persistence
Open

feat(config): minimal config persistence — Overrides user-only + sparse save#161
seeyabye wants to merge 27 commits into
mainfrom
feat/minimal-config-persistence

Conversation

@seeyabye

Copy link
Copy Markdown
Contributor

Summary

Implements the minimal-config-persistence OpenSpec change: a two-phase plan to fix the structural defect where the first-run flow bakes the full embedded example to disk and Save re-inflates every field on every write, so code-default changes never reach existing installs.

Replaces the reverted PR #158 (which used a defaults_version patch chain). No version tracking — future default changes propagate lazily via sparse persistence.

Phase 1: Overrides becomes user-only

  • ResolvedSettings(name) on ScrapersConfig — complete default clone for absent overrides, override.Clone() + MergeDefaultsFrom for present
  • Dropped Finalize seeding loop + pipeline.normalize languageDefaults map
  • ScraperRegistryConfigFromApp accepts names []string + defaults map (avoids import cycles)
  • Level 2 mutation API: Override(name), ApplyOverride(name, opts...) (no-op when empty), UserOverride(name) non-creating, WithScrapeActress/WithBrowser option funcs
  • minimalInitStub() as production first-run (sparse stub instead of full ~90-line example)

Phase 2: Sparse persistence

  • diffYAMLDocuments(actual, defaults) — node-diff post-MarshalYAML, emits only non-default leaves + alwaysEmitPaths + null clear-markers for cleared omitempty maps
  • reconcileSparse(dst, sparseTarget, schemaDoc, knownScraperNames) — src-authoritative, key-comment-preserving, recursively deletion-safe, schema-gated
  • ConfigStorage.SaveSparse — shares afero fs, lock, atomic replace; handles missing/malformed; unchanged-byte skip
  • SparseSaveContext{Defaults, Schema, KnownScraperNames} with collision rejection
  • Scraper settings schema (complete, including optional fields + nested ProxyConfig + deprecated aliases)
  • Prepare split: PrepareForPersistence (excludes translation credentials) + PrepareRuntime (full ValidateConfig)
  • API PUT /config uses disk-origin snapshot for preserveRedactedSecrets, SaveSparse for persistence, runtimeCfg (post-env) for reload
  • APIRuntime.SetInitialConfigs(runtimeCfg, diskCfg) + DiskConfigSnapshot() (cloned on set/get)
  • LoadOrCreate convergence: all 3 branches (existing-file, first-run, migration) apply env + Prepare before returning

No defaults_version

No version tracking. Future default-value changes update the code default; existing configs pick it up on their next API save (lazy propagation). Existing baked values persist until users clear them via WebUI.

Test plan

  • go test -short ./internal/config/... ./internal/api/... — pass
  • go test -race ./internal/config/... — pass
  • golangci-lint run ./internal/config/... ./internal/api/... — 0 issues
  • go build ./... — pass
  • Full CI suite (will run on push)

Known limitations (follow-up revisions)

  • Sparse-save defaults use DefaultConfig(nil, nil) (hardcoded priorities) — correct for the standard registry, documented limitation for custom registries
  • Missing some integration tests (env-secret round trips, startup convergence, Prepare split parity) — to be added as follow-up

OpenSpec

  • Change: openspec/changes/minimal-config-persistence
  • Reviewed through 8 cycles by codex-lb/gpt-5.6-sol (medium) — final verdict: PROCEED WITH REVISIONS (0 blockers, 0 majors, 3 minors)

seeyabye added 10 commits July 18, 2026 18:37
…terialization

Phase 1 of minimal-config-persistence:
- Add ResolvedSettings(name) on ScrapersConfig (complete default clone for
  absent, override.Clone() + MergeDefaultsFrom for present)
- Drop Finalize seeding loop (Overrides no longer pre-materialized)
- Drop pipeline.normalize languageDefaults map (redundant with module Defaults)
- Switch ScraperRegistryConfigFromApp to accept names + defaults (avoids
  import cycles), inline resolve via Clone + MergeDefaultsFrom
- Update all 4 call sites (dependencies, hot_reload, e2e)
- Fix info command to use ResolvedSettings instead of direct Overrides
- Update tests assuming old materialization behavior
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 726e824db2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/storage.go
Comment thread internal/scraper/registry_config.go
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review — please review the latest commit (20ced4a) which fixes the lint file-size issue. The two P1 findings are being addressed in a follow-up commit.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20ced4ad1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/storage.go
Comment thread internal/config/storage.go
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review — please review the latest commit (735192e) which addresses the P1 finding about sparse saves on normalize. The P2 about DefaultConfig(nil,nil) is a known documented limitation for custom registries.

@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@seeyabye
seeyabye force-pushed the feat/minimal-config-persistence branch from 735192e to 994b36b Compare July 18, 2026 17:24
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 18, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 18, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.86%. Comparing base (7685a84) to head (b83ef31).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #161      +/-   ##
==========================================
+ Coverage   91.34%   91.86%   +0.52%     
==========================================
  Files         455      457       +2     
  Lines       40593    41381     +788     
==========================================
+ Hits        37078    38013     +935     
+ Misses       2281     2184      -97     
+ Partials     1234     1184      -50     
Flag Coverage Δ
unittests 91.86% <100.00%> (+0.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/javinizer/commands/info/command.go 85.05% <100.00%> (ø)
cmd/javinizer/commands/init/command.go 85.00% <100.00%> (+11.66%) ⬆️
cmd/javinizer/commands/scrape/command.go 91.63% <100.00%> (+0.66%) ⬆️
internal/api/core/bootstrap.go 94.73% <100.00%> (+0.45%) ⬆️
internal/api/core/disk_snapshot.go 100.00% <100.00%> (ø)
internal/api/core/hot_reload.go 94.66% <100.00%> (+0.14%) ⬆️
internal/api/core/runtime_manager.go 92.06% <ø> (ø)
internal/api/system/config.go 83.09% <100.00%> (+2.67%) ⬆️
internal/api/system/config_service.go 100.00% <100.00%> (+28.26%) ⬆️
internal/commandutil/dependencies.go 89.67% <100.00%> (+2.81%) ⬆️
... and 11 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 994b36b2ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/sparse_marshal.go
Comment thread internal/scraper/registry_config.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 18, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review — these P2 findings are documented limitations in the OpenSpec design: (1) nested map entry deletion for proxy profiles is a known reconciliation edge case; (2) partial-override presence for scraper Enabled is the documented tri-state limitation. Both are accepted for v1 and tracked as follow-up.

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 994b36b2ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/storage.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 18, 2026
@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dad30eb286

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/storage.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 643a15262f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/scraper/registry_config.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cca16d79c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/sparse_marshal.go
Comment thread internal/config/sparse_marshal.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab7177cf12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/scraper/registry_config.go
Comment thread internal/config/sparse_marshal.go Outdated
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fbc7535e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/sparse_marshal.go
@github-actions github-actions Bot added the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@seeyabye

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions github-actions Bot removed the 🤖 codex: needs work Codex review found issues that need addressing label Jul 19, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b83ef31635

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions github-actions Bot added the 🤖 codex: ok Codex review found no major issues label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 codex: ok Codex review found no major issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant