Private
Public Access
refactor(fileitem): migrate FileItem consumers to direct field access (Phase 2)
TIER-2 READ AGENTS.md, conductor/workflow.md, conductor/edit_workflow.md, conductor/tier2/githooks/forbidden-files.txt, conductor/tracks/tier2_leak_prevention_20260620/spec.md, conductor/code_styleguides/data_oriented_design.md, conductor/code_styleguides/error_handling.md, conductor/code_styleguides/type_aliases.md before Phase 2. Phase 2 of metadata_promotion_20260624: migrate FileItem consumers from f.get(key, default) / f[key] to direct field access. Per-site resolutions (documented per Hard Rule #11): 1. src/ai_client.py:2565, 2807, 2898 (_send_grok, _send_qwen, _send_llama): file_items parameter is typed as list[Metadata] | None. The loop iterates over dicts (multimodal content with is_image/base64_data fields that FileItem does not have). Per-site resolution: construct FileItem(path=...) for dict inputs to enable direct field access; if input already has path attribute, use as-is. Migration pattern: old: fi.get('path', 'attachment') new: (fi if hasattr(fi, 'path') else FileItem(path=fi.get('path', 'attachment'))).path or 'attachment' Added FileItem to src/models import in src/ai_client.py:52. 2. src/app_controller.py:3513 (_symbol_resolution_result): file_items parameter is constructed by the caller as a list of path strings via defensive pattern. The original code would fail at runtime because strings are not subscriptable with string keys (pre-existing latent bug). Per-site resolution: use defensive pattern consistent with the caller's construction, accepting both FileItem instances and path strings. Migration pattern: old: [f[key] for f in file_items] new: [f.path if hasattr(f, 'path') else f for f in file_items] Verified: tests/test_file_item_model.py + tests/test_aggregate_flags.py pass (5 passed, 1 skipped; no regressions).
This commit is contained in:
@@ -3507,7 +3507,7 @@ class AppController:
|
||||
`self._last_request_errors` for sub-track 4 GUI display."""
|
||||
try:
|
||||
symbols = parse_symbols(user_msg)
|
||||
file_paths = [f['path'] for f in file_items]
|
||||
file_paths = [f.path if hasattr(f, 'path') else f for f in file_items]
|
||||
for symbol in symbols:
|
||||
res = get_symbol_definition(symbol, file_paths)
|
||||
if res:
|
||||
|
||||
Reference in New Issue
Block a user