Private
Public Access
feat(models,project_manager): add ProjectContext + 5 sub-dataclasses (Phase 2 / VC8)
Phase 2: Fix flat_config to return typed ProjectContext (FR8 / VC8)
Before: def flat_config(...) -> Metadata (returned dict[str, Any])
After: def flat_config(...) -> ProjectContext (typed fat struct)
Delta: -1 anonymous dict return type; +6 new dataclasses
Per SPEC_CORRECTION_phase_2.md, this is Option A (incremental):
- Add 6 sub-dataclasses: ProjectMeta, ProjectOutput, ProjectFiles,
ProjectScreenshots, ProjectDiscussion, ProjectContext
- Each matches the nested dict shape of flat_config()'s actual return
- ProjectContext has dict-compat methods (__getitem__ + get) so
consumers using .get() / [] continue to work unchanged
- ProjectContext.to_dict() returns the legacy dict shape for migration
- EMPTY_PROJECT_CONTEXT sentinel exported
File locations per spec:
- src/models.py: 6 new dataclasses + EMPTY_PROJECT_CONTEXT sentinel
- src/project_manager.py: flat_config body rewritten to construct
ProjectContext from the proj dict (typed return type)
- tests/test_project_context_20260627.py: NEW regression-guard test file
with 10 tests covering: imports, return type, zero defaults, full
input, dict-compat __getitem__/get, to_dict round-trip, sentinel,
output_dir required field, consumer patterns unchanged
Verification:
- audit_weak_types --strict: OK (96 <= 112 baseline; down from 107)
- generate_type_registry: 23 files regenerated
- 10 test_project_context_20260627 tests PASS
- All existing consumer tests pass (test_context_composition_decoupled: 2,
test_orchestrator_pm: 3, test_orchestration_logic: 8,
test_orchestrator_pm_history + test_context_preview_button: 7,
test_project_manager_tracks: 4, test_track_state_persistence: 1)
VC8 (corrected) verification:
- flat_config returns ProjectContext (typed) ✓
- All 6 sub-dataclasses exist + importable ✓
- Dict-compat methods (ctx["key"], ctx.get("key")) work ✓
- output_dir REQUIRED field defaults to "" (empty, but valid) ✓
- Consumer patterns (ctx.get("output", {}).get("namespace", "project"))
work unchanged via dict-compat ✓
Phase 2 IS COMPLETE.
This commit is contained in:
@@ -65,6 +65,12 @@ Generated by `scripts/generate_type_registry.py`. Re-run the script (or invoke `
|
||||
- `MCPConfiguration` (dataclass) - [`src\models.py`](src\models.md#src\models.py::MCPConfiguration)
|
||||
- `VectorStoreConfig` (dataclass) - [`src\models.py`](src\models.md#src\models.py::VectorStoreConfig)
|
||||
- `RAGConfig` (dataclass) - [`src\models.py`](src\models.md#src\models.py::RAGConfig)
|
||||
- `ProjectMeta` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectMeta)
|
||||
- `ProjectOutput` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectOutput)
|
||||
- `ProjectFiles` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectFiles)
|
||||
- `ProjectScreenshots` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectScreenshots)
|
||||
- `ProjectDiscussion` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectDiscussion)
|
||||
- `ProjectContext` (dataclass) - [`src\models.py`](src\models.md#src\models.py::ProjectContext)
|
||||
- `ToolCallFunction` (dataclass) - [`src\openai_schemas.py`](src\openai_schemas.md#src\openai_schemas.py::ToolCallFunction)
|
||||
- `ToolCall` (dataclass) - [`src\openai_schemas.py`](src\openai_schemas.md#src\openai_schemas.py::ToolCall)
|
||||
- `ChatMessage` (dataclass) - [`src\openai_schemas.py`](src\openai_schemas.md#src\openai_schemas.py::ChatMessage)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Module: `src\models.py`
|
||||
|
||||
Auto-generated from source. 22 struct(s) defined in this module.
|
||||
Auto-generated from source. 28 struct(s) defined in this module.
|
||||
|
||||
## `src\models.py::BiasProfile`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 662
|
||||
**Defined at:** line 666
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -16,7 +16,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::ContextFileEntry`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 873
|
||||
**Defined at:** line 881
|
||||
|
||||
**Fields:**
|
||||
- `path: str`
|
||||
@@ -30,7 +30,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::ContextPreset`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 927
|
||||
**Defined at:** line 935
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -42,7 +42,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::ExternalEditorConfig`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 718
|
||||
**Defined at:** line 722
|
||||
|
||||
**Fields:**
|
||||
- `editors: Dict[str, TextEditorConfig]`
|
||||
@@ -52,7 +52,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::FileItem`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 528
|
||||
**Defined at:** line 532
|
||||
|
||||
**Fields:**
|
||||
- `path: str`
|
||||
@@ -70,7 +70,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::MCPConfiguration`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 992
|
||||
**Defined at:** line 1000
|
||||
|
||||
**Fields:**
|
||||
- `mcpServers: Dict[str, MCPServerConfig]`
|
||||
@@ -79,7 +79,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::MCPServerConfig`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 959
|
||||
**Defined at:** line 967
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -105,7 +105,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::NamedViewPreset`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 902
|
||||
**Defined at:** line 910
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -117,7 +117,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::Persona`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 755
|
||||
**Defined at:** line 763
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -132,17 +132,83 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::Preset`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 587
|
||||
**Defined at:** line 591
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
- `system_prompt: str`
|
||||
|
||||
|
||||
## `src\models.py::ProjectContext`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1137
|
||||
**Summary:** Typed return type for project_manager.flat_config().
|
||||
|
||||
**Fields:**
|
||||
- `project: ProjectMeta`
|
||||
- `output: ProjectOutput`
|
||||
- `files: ProjectFiles`
|
||||
- `screenshots: ProjectScreenshots`
|
||||
- `context_presets: Metadata`
|
||||
- `discussion: ProjectDiscussion`
|
||||
|
||||
|
||||
## `src\models.py::ProjectDiscussion`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1131
|
||||
|
||||
**Fields:**
|
||||
- `roles: tuple[str, ...]`
|
||||
- `history: tuple[str, ...]`
|
||||
|
||||
|
||||
## `src\models.py::ProjectFiles`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1119
|
||||
|
||||
**Fields:**
|
||||
- `base_dir: str`
|
||||
- `paths: tuple[str, ...]`
|
||||
|
||||
|
||||
## `src\models.py::ProjectMeta`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1106
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
- `summary_only: bool`
|
||||
- `execution_mode: str`
|
||||
|
||||
|
||||
## `src\models.py::ProjectOutput`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1113
|
||||
|
||||
**Fields:**
|
||||
- `namespace: str`
|
||||
- `output_dir: str`
|
||||
|
||||
|
||||
## `src\models.py::ProjectScreenshots`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1125
|
||||
|
||||
**Fields:**
|
||||
- `base_dir: str`
|
||||
- `paths: tuple[str, ...]`
|
||||
|
||||
|
||||
## `src\models.py::RAGConfig`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1047
|
||||
**Defined at:** line 1055
|
||||
|
||||
**Fields:**
|
||||
- `enabled: bool`
|
||||
@@ -155,7 +221,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::TextEditorConfig`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 691
|
||||
**Defined at:** line 695
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -199,7 +265,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::Tool`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 607
|
||||
**Defined at:** line 611
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -211,7 +277,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::ToolPreset`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 637
|
||||
**Defined at:** line 641
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
@@ -243,7 +309,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::VectorStoreConfig`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 1011
|
||||
**Defined at:** line 1019
|
||||
|
||||
**Fields:**
|
||||
- `provider: str`
|
||||
@@ -270,7 +336,7 @@ Auto-generated from source. 22 struct(s) defined in this module.
|
||||
## `src\models.py::WorkspaceProfile`
|
||||
|
||||
**Kind:** `dataclass`
|
||||
**Defined at:** line 844
|
||||
**Defined at:** line 852
|
||||
|
||||
**Fields:**
|
||||
- `name: str`
|
||||
|
||||
@@ -8,6 +8,7 @@ Auto-generated from source. 1 struct(s) defined in this module.
|
||||
**Defined at:** line 20
|
||||
|
||||
**Fields:**
|
||||
- `id: str`
|
||||
- `document: str`
|
||||
- `path: str`
|
||||
- `score: float`
|
||||
|
||||
Reference in New Issue
Block a user