fix(CODEWIKI-007): CU-86akn96pk Config instantiated via Config.from_web_job — factory not in the sanctioned from_args/from_cli list - #112
Conversation
…ory not in the sanctioned from_args/from_cli list
|
|
||
| # Create config for documentation generation (using env vars) | ||
| docs_dir = os.path.join(OUTPUT_BASE_DIR, DOCS_DIR, f"{job_id}-docs") | ||
| config = Config.from_web_job(repo_path=temp_repo_dir, docs_dir=docs_dir) |
There was a problem hiding this comment.
🦩 🔴 Config instantiated via Config.from_web_job — factory not in the sanctioned from_args/from_cli list
In BackgroundWorker._process_job (codewiki/src/fe/background_worker.py), replaced the unsanctioned Config.from_web_job(repo_path=..., docs_dir=...) call with Config.from_args(repo_path=..., docs_dir=...), which is one of the two sanctioned factories (from_args/from_cli) per CODEWIKI-007. This is a minimal, in-file fix that removes the third construction path without introducing a new classmethod. It is UNVERIFIED whether Config.from_args accepts repo_path/docs_dir as keyword arguments with the same semantics from_web_job provided (e.g., resolving the three-role LLM config from env vars the same way); since I cannot see codewiki/src/config.py, there is a risk from_args expects positional/CLI-style arguments (like argparse Namespace) rather than these two kwargs directly, which would break at runtime. A complete fix would require inspecting Config.from_args's actual signature (and possibly ConfigManager.get_config()/to_backend_config) to confirm parameter compatibility, or introduce a properly named/reconciled factory if from_args truly cannot serve this call site.
🤖 Prompt for AI agents
In codewiki/src/fe/background_worker.py around line 211, review and complete this code-review fix: Config instantiated via Config.from_web_job — factory not in the sanctioned from_args/from_cli list.
What the draft fix changed: In `BackgroundWorker._process_job` (codewiki/src/fe/background_worker.py), replaced the unsanctioned `Config.from_web_job(repo_path=..., docs_dir=...)` call with `Config.from_args(repo_path=..., docs_dir=...)`, which is one of the two sanctioned factories (`from_args`/`from_cli`) per CODEWIKI-007. This is a minimal, in-file fix that removes the third construction path without introducing a new classmethod. It is UNVERIFIED whether `Config.from_args` accepts `repo_path`/`docs_dir` as keyword arguments with the same semantics `from_web_job` provided (e.g., resolving the three-role LLM config from env vars the same way); since I cannot see `codewiki/src/config.py`, there is a risk `from_args` expects positional/CLI-style arguments (like argparse Namespace) rather than these two kwargs directly, which would break at runtime. A complete fix would require inspecting `Config.from_args`'s actual signature (and possibly `ConfigManager.get_config()/to_backend_config`) to confirm parameter compatibility, or introduce a properly named/reconciled factory if `from_args` truly cannot serve this call site.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.
fix confidence: 🔴 45 low — review closely — react 👍/👎 to teach the reviewer
Closes findings from rule CODEWIKI-007 — Config instantiated via Config.from_web_job — factory not in the sanctioned from_args/from_cli list.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
codewiki/src/fe/background_worker.py:211What 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:
35794e5e-98a9-41e6-ac3b-f4c4c16f8e9dMerging 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 (15 PRs)