Skip to content

refactor(config): a default that backs a settings field is read only through the settings - #2561

Merged
dan-petty merged 2 commits into
mainfrom
refactor/2447-settings-defaults-boundary
Oct 28, 2026
Merged

dan-petty merged 2 commits into
mainfrom
refactor/2447-settings-defaults-boundary

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A DEFAULT_* value that a settings field takes as its default was also imported at 40 places in 27 modules outside config/. A module that reads the default by its name does not see a config file or a variable that sets the setting. Seven places ignored such a setting:

  • SemanticChunker, and so the workspace indexer and the code-retrieval benchmark, never read ai.rag.chunk_size or ai.rag.chunk_overlap.
  • devops ai rag search gave --top-k and --min-score the defaults, so ai.rag.top_k and ai.rag.score_threshold did not apply. The rag_search tool gave the retriever no score threshold.
  • Review group analysis recorded the defaults of ai.temperature and ai.top_p as its sampling, while the analysis task's client sends ai.tasks.analysis.
  • The audit log accepted DEVOPS_CLI_AUDIT_LOG_DEST only in .data of the working directory or in DEVOPS_CLI_DATA_DIR, not in data.dir of the config file.
  • The GitHub quota ledger, the roadmap Service state and the OSV snapshot digest ignored data.dir and data.cache_dir of the config file, and fell back to .data of the working directory.

What changes:

  • setting_default(key) in config/settings.py gives the default that a field declares. A module reads it only where no settings are loaded.
  • A class that holds a setting reads the loaded settings when its caller gives no value: SemanticChunker, WorkspaceIndexer, SemanticRetriever, QdrantClient (qdrant.timeout), ValkeyClient (valkey.timeout) and LLMResponseCache. acquire_ollama_slot, track_ollama_url and QdrantClient.search_points take max_parallel and limit from their callers, which pass the settings.
  • devops ai rag search resolves --top-k and --min-score from ai.rag before its dry run, and its help names the settings.
  • run_group_analysis with no sampling records the analysis task's sampling (configured_sampling()).
  • The audit check, the GitHub identity cache directory, the Service state directory and the OSV digest resolve data.dir or data.cache_dir of the loaded settings with resolve_data_path. The GitHub cache root is read once for each process, and reset_github_rate_limiter reads it again.
  • The fallbacks when the settings cannot load read setting_default. The AIBOM hardware estimate names its own context window. The spend report gets its reference models from the ledger only. _resolve_llm_cache loses its copies of the cache defaults.
  • An invariant in tests/invariants/test_source_tree.py finds each read of a setting's default outside config/. It derives the names from the settings module, so it keeps no list and no baseline. CONTRIBUTING.md states the rule.

Closes #2447

Change: openspec/changes/archive/2026-10-28-2447-settings-defaults-boundary/

…through the settings

A `DEFAULT_*` value that a settings field takes as its default was also
imported at 40 places in 27 modules outside `config/`. Each place read
the default by its name, and seven of them ignored a setting that a
config file or a variable sets: the RAG chunk size and overlap, the
defaults of `devops ai rag search` and of the `rag_search` tool, the
sampling that group analysis records, the audit log destination check,
the GitHub identity cache directory, the roadmap Service state directory
and the OSV snapshot digest directory.

Each place now reads the loaded setting, or `setting_default(key)`, the
default that the field declares, where no settings are loaded. A class
that holds a setting reads the loaded settings when its caller gives no
value. An invariant finds every read of a setting's default outside
`config/`, with the names derived from the settings module.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

  • uv run devops ci fail-to-pass --base origin/main: 9 failed on base.
    • The invariant listed the 40 places (first: devops_cli/ai/client/network.py:28 DEFAULT_OLLAMA_MAX_PARALLEL).
    • Chunker: assert (2400, 240) == (900, 90).
    • ai rag query dry run: assert (0, 5, 0.35) == (0, 9, 0.6).
    • Retriever: assert (5, 0.35) == (7, 0.55).
    • Group analysis: assert (0.1, 0.95) == (0.7, 0.8).
    • Audit: SecurityError: DEVOPS_CLI_AUDIT_LOG_DEST must be within <cwd>/.data.
    • GitHub ledger: the cache root was <tmp>/.data/cache, not the configured directory.
    • Service state: <cwd>/.data/roadmap, not the configured data directory.
    • OSV digest: no stamp under the configured cache directory.
  • Full uv run devops ci on the branch: every gate passed. The test step took 5 m 14 s at a load average of 23; perf(ci): the startup-import tests start 56 interpreters and take 204 s of the suite's 2,423 s #2369, perf(ci): each test shard collects only its own test files #2371 and perf(ci): measure coverage and branch cost #2373 own the suite's speed.
  • The test files of the 27 changed modules and tests/config, tests/invariants: 2,052 passed after four tests moved off removed defaults (test_ollama_dynamic_leasing.py x3, test_audit_stream.py).

Filed during the work: #2559 (LLMClient.chat takes temperature, top_p and seed and sends none of them). #2130 owns the digest of the real OSV database.

When this pull request merges, #1000 has all three parts: #2444, #2445 and #2447.

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 23:20
@dan-petty
dan-petty merged commit 0702d13 into main Oct 28, 2026
17 checks passed
@dan-petty
dan-petty deleted the refactor/2447-settings-defaults-boundary branch October 28, 2026 23:21
dan-petty pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.12.0](v0.11.3...v0.12.0)
(2026-10-29)


### Features

* **ai:** constrain structured replies on the openai and claude
providers ([#2550](#2550))
([4f7390a](4f7390a))
* **argo:** retire the Helm release records of the charts that Argo CD
renders ([#2568](#2568))
([cabfcd4](cabfcd4))
* **k8s:** devops k8s tunnel keeps the cloudflared forward to
k8s.&lt;domain&gt; running
([#2567](#2567))
([f9493fa](f9493fa)),
closes [#1641](#1641)
* **monitoring:** alert when the otel collector fails to export spans,
metric points or log records
([#2565](#2565))
([4fc8ff7](4fc8ff7))
* **telemetry:** the roadmap Service counts its GitHub writes, budget
holds, Firecrawl searches and own deliveries, and caps refine's comments
on one item
([#2556](#2556))
([9819877](9819877)),
closes [#2475](#2475)


### Bug Fixes

* **git:** report a worktree that a run in parallel removed as removed,
not a failed reclaim
([#2557](#2557))
([a556984](a556984)),
closes [#2408](#2408)
* **k8s:** the devops perimeter opens only the collector's OTLP/HTTP
port, 4318
([#2549](#2549))
([d156ce7](d156ce7))
* **sandbox:** devops sandbox logs reads each line with its stream from
a real engine
([#2546](#2546))
([e7216d5](e7216d5)),
closes [#2520](#2520)
* **service:** the webhook route refuses an unsigned or oversized
delivery before it reads the body, and a rate limit guards it
([#2553](#2553))
([40efcd4](40efcd4)),
closes [#2476](#2476)


### Performance Improvements

* **ai:** price a request with one load of the settings
([#2555](#2555))
([5d86538](5d86538)),
closes [#1420](#1420)


### Code Refactoring

* **config:** a default that backs a settings field is read only through
the settings
([#2561](#2561))
([0702d13](0702d13))
* **exceptions:** each exception class declares its error_code and
exit_code ([#2558](#2558))
([410dece](410dece))
* **review:** render the review report from one input, outside the
orchestrator
([#2563](#2563))
([9e73e6d](9e73e6d)),
closes [#1008](#1008)
* **security:** src has no unreviewed Bandit findings, and the gate
scans src at low severity
([#2560](#2560))
([45261dd](45261dd)),
closes [#1538](#1538)
* **security:** the scanners stop looking for mocks, and their tests run
on the scanner fake
([#2551](#2551))
([2b7f37a](2b7f37a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

refactor(config): a default that backs a settings field is read only through the settings, and an import-boundary test holds it

1 participant