Repository navigation
fix(config): warn once per deprecated field value - #20825
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the dedup set never empties: switching a field back to a value it held earlier in the same process stays silent, and the new test asserts that. [DESIGN-REVIEWED] 59d4c01 Description read[DESCRIPTION-READ] d8904e7b1555bf408fb59875ccf287d8401ac725e94a48025c19286bd51762d1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: What this change shipsInventory (7 items) — 7 justifiedIntent: stop a populated deprecated config field from logging the same warning on every config load or reload (#20812). This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 59d4c01 Description read[DESCRIPTION-READ] bc6424c5946869ac35863c038f7d583461b282b63d8fd9f8ca6ea7e16d788ba1 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
97f648b to
ced1c94
Compare
|
Rebased: main moved in The rebase also picks up #20802, the fix for the earlier Backend Tests (Windows) (7) red in Locally on the new base: the config/validation tests, the related backend set and the static gates pass. The fork workflows for ced1c94 are waiting for maintainer approval. |
Remember each populated deprecated field value after its first warning so repeated config reloads stay quiet. Warn once again when the value changes.
ced1c94 to
59d4c01
Compare
|
Rebased onto
The fork workflows still wait for a maintainer to approve them. |
bolichen97
left a comment
There was a problem hiding this comment.
Looks good to ship. Head reviewed: 59d4c01.
What I checked:
- Correctness: the membership check and the add run under one lock, so concurrent validation emits one record per key. The
continueskips only the log call for that entry. The log call stays outside the lock. - Secrets: the warning text is still only the field path and help text. The registry keeps an in-memory SHA-256 digest of
repr(value), never logged or saved. The new Telegram assertion pins that no raw token is retained. - Tests: the new test goes red if the dedup check is removed (the second identical load would log again). Both tests reset the process-global set with
monkeypatch, so test order cannot decide the result. No other test on main asserts this warning, so no hidden order dependency remains. - Main: main still warns on every load, so this is not superseded. The PR applies cleanly and GitHub reports it mergeable.
One optional point inline about a change back to an earlier value. It does not block.
Remaining before merge: CI on this head is still queued and the readiness label is action required. The AI review comments still name the earlier head. I will check again when the checks finish.
| value_digest = hashlib.sha256(repr(node).encode("utf-8")).digest() | ||
| warning_key = (entry.path, value_digest) | ||
| with _DEPRECATED_WARNING_LOCK: | ||
| if warning_key in _REPORTED_DEPRECATED_FIELDS: |
There was a problem hiding this comment.
🟡 A change back to an earlier value is silent, and the Goal reads as if it should warn.
The registry keeps every (path, digest) pair seen in the process. When an operator sets 0.8, then 0.9, then 0.8 again, the third value is a change, but it logs nothing. The Goal says "show it once again when that value changes". The spec paragraph and the test describe "once per distinct value", so the two texts disagree.
with _DEPRECATED_WARNING_LOCK:
if warning_key in _REPORTED_DEPRECATED_FIELDS:
continue
_REPORTED_DEPRECATED_FIELDS.add(warning_key)Why it matters: an operator who reverts a value gets no notice for it. The set also grows by one entry per distinct value seen, with no bound. In practice that is small, because only the owner's config writes reach it.
Suggestion: keep only the last digest per path:
_LAST_DEPRECATED_DIGEST: dict[str, bytes] = {}
...
with _DEPRECATED_WARNING_LOCK:
if _LAST_DEPRECATED_DIGEST.get(entry.path) == value_digest:
continue
_LAST_DEPRECATED_DIGEST[entry.path] = value_digestThis bounds memory at the number of deprecated fields and warns on every real change. If "each distinct value once" is the intended rule, I will withdraw this. A one-line edit to the Goal so it matches the spec is then enough.
Rule: Description and diff fidelity (PR template Goal)
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 59d4c01.
Checked on this head: PR Readiness is passed, base is main, no merge conflict, no failing or pending required check (the cancelled entries are superseded runs), and no AI review lane reports a blocking finding. Earlier review notes on correctness and secret handling still hold: the membership check and the add share one lock, and only a digest of the value is kept, never logged. No security denylist path is touched and the linked issue is tier T1.
Problem / Motivation
Goal: Show each populated deprecated config field warning once per process for one value, and show it once again when that value changes.
Every config load or reload emits the same WARNING for a populated deprecated field. The field stays in the config by design, so saving cannot clear the warning.
Why it matters
A healthy gateway repeats an unchangeable warning throughout its logs. This noise hides warnings that need action.
Not a goal
What changed (motivation → approach → change)
The validator treated each config read as a new deprecation event.
src/kiro_crew/config/validation.pynow hashes each deprecated value and remembers its(path, digest)pair for the life of the process. A repeated value stays quiet. A distinct value creates one new warning. A lock makes that check atomic across concurrent config reads. The digest keeps configured credentials out of the registry. The existing Telegram warning assertion resets this process-global state so test order cannot decide its result.docs/system-specs/modules/config.mdrecords the warning frequency and fingerprint behavior.Backwards compatibility
Compatible: validation results, saved config, schema entries, and first-warning text stay unchanged.
Removes nothing: the change only suppresses duplicate log records for a field value already reported in this process.
Tests
test/test_config_loader_agent_section.py::TestDynamicSubagentSizingFields::test_deprecated_warning_is_once_per_valueloads one deprecated value twice, a distinct value twice, and the first value again. It proves one warning for each distinct value and silence for every repeat.test/test_telegram_accounts_deprecated.py::TestEmptyAccountsAreNotMaterialized::test_a_populated_map_is_still_announced_as_deprecatedisolates the process-global warning state and proves the registry does not retain either configured Telegram token.Determinism proof: 20 independent serial repetitions passed, 10 independent
-n4runs beside neighboring tests passed, and a reordered-neighbor run passed. The full config suite passed with 2,208 tests and 1 skip. The 56-test flake-pattern ratchet passed. Diff-scoped Semgrep reported zero findings. A 16-thread smoke test emitted exactly one warning from concurrent validation calls.Manual verification
N/A — unit coverage drives the real config loader and captures its production warning logger.
Related Issues
Closes #20812
Pattern harvest
Rule candidate: review-prompt
Pattern: a warning about intentionally preserved state needs process-level deduplication when routine reloads revisit that state.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.