Skip to content

fix(CODEWIKI-002): CU-86akn96pk 2 review findings in config.py - #96

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/codewiki-002-af03b136-9aa9712c
Draft

flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/codewiki-002-af03b136-9aa9712c

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Closes 2 review findings in codewiki/src/config.py.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟡 88 medium Config.to_dict() delegates to asdict() instead of explicitly listing fields codewiki/src/config.py:132
2 🔴 55 low — review closely Config.from_dict silently drops unknown/extra fields including ones from a previous schema version codewiki/src/config.py:147

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 9aa9712c-4ca2-4571-94bc-95e5cff4b3cd

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akn96pk CodeWiki review findings sweep (9 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

2 finding(s) fixed in this draft — 2 explained inline on the diff; 1 low-confidence hunk(s) need close review before merging.

Comment thread codewiki/src/config.py
dataclasses.asdict()) so that adding a new field to Config requires a
deliberate decision about whether/how it is serialized here.
"""
data = asdict(self)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 Config.to_dict() delegates to asdict() instead of explicitly listing fields

Rewrote Config.to_dict() (codewiki/src/config.py) to build the returned dict by explicitly listing every non-secret field by name (repo_path, output_dir, ... additional_source_paths), instead of calling asdict(self) and popping secret keys afterward. Secret fields (cluster_api_key, main_api_key, fallback_api_key) are now only added to the dict explicitly when include_secrets=True, rather than being present by default and removed. This satisfies CODEWIKI-002's requirement that to_dict() explicitly enumerate fields, and it removes the "new field silently serialized" risk since any new dataclass field must be added to this list by hand to be included.

🤖 Prompt for AI agents
In codewiki/src/config.py around line 132, review and complete this code-review fix: Config.to_dict() delegates to asdict() instead of explicitly listing fields.
What the draft fix changed: Rewrote `Config.to_dict()` (codewiki/src/config.py) to build the returned dict by explicitly listing every non-secret field by name (repo_path, output_dir, ... additional_source_paths), instead of calling `asdict(self)` and popping secret keys afterward. Secret fields (cluster_api_key, main_api_key, fallback_api_key) are now only added to the dict explicitly when `include_secrets=True`, rather than being present by default and removed. This satisfies CODEWIKI-002's requirement that to_dict() explicitly enumerate fields, and it removes the "new field silently serialized" risk since any new dataclass field must be added to this list by hand to be included.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 88 medium — react 👍/👎 to teach the reviewer

Comment thread codewiki/src/config.py
discarded, so that config drift between the CLI and backend Config is
surfaced instead of hidden.
"""
known_fields = {f.name for f in fields(cls)}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Config.from_dict silently drops unknown/extra fields including ones from a previous schema version

Changed Config.from_dict() (codewiki/src/config.py) to compute unknown = set(data.keys()) - known_fields and raise ValueError listing the unknown keys instead of silently filtering them out with a dict comprehension. This directly addresses the "silently drops unknown/extra fields" finding by turning schema drift into a visible error. Risk/incompleteness: this is a behavior change — any existing caller that relied on from_dict() tolerating extra/renamed keys (e.g. passing through a superset dict from a newer version) will now raise instead of degrading gracefully; a complete fix might instead want a warning-log path or an explicit migration/versioning mechanism, which is beyond a minimal in-file change and was not implemented here.

🤖 Prompt for AI agents
In codewiki/src/config.py around line 147, review and complete this code-review fix: Config.from_dict silently drops unknown/extra fields including ones from a previous schema version.
What the draft fix changed: Changed `Config.from_dict()` (codewiki/src/config.py) to compute `unknown = set(data.keys()) - known_fields` and raise `ValueError` listing the unknown keys instead of silently filtering them out with a dict comprehension. This directly addresses the "silently drops unknown/extra fields" finding by turning schema drift into a visible error. Risk/incompleteness: this is a behavior change — any existing caller that relied on from_dict() tolerating extra/renamed keys (e.g. passing through a superset dict from a newer version) will now raise instead of degrading gracefully; a complete fix might instead want a warning-log path or an explicit migration/versioning mechanism, which is beyond a minimal in-file change and was not implemented here.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(CODEWIKI-002): 2 review findings in config.py fix(CODEWIKI-002): CU-86akn96pk 2 review findings in config.py Sep 23, 2026
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.

0 participants