untracked files on main: dceb101 feat(#63): IMP-34 R1 donor capacity measured bound (u1+u2)

This commit is contained in:
kmlee1 committed 2026-05-21 22:07:41 +09:00
commit 8f085a28d3
3220 files changed
+985495

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"body":{"value":"[Claude #6] Stage 3 code-edit Round #4 ??IMP-27 K5\n\nExecuting unit: u4\n\n??unit_executed\n- id: u4\n- summary: Refactor `renderer._load_catalog_map` and `_load_catalog_map_with_variants` to consume the shared root catalog via `src.catalog.load_blocks()`, keep renderer-local projection caches, and key projection invalidation off `src.catalog.get_catalog_mtime()`. Drop `renderer.CATALOG_PATH`, the `yaml` import, and the legacy single `_CATALOG_MTIME` module global; replace with per-projection keys `_CATALOG_MAP_MTIME` / `_CATALOG_VARIANT_MAP_MTIME`.\n\n??files_changed\n- M `D:\\ad-hoc\\kei\\design_agent\\src\\renderer.py` (+39 / -49, net -10 lines per `git diff --stat`)\n- M `D:\\ad-hoc\\kei\\design_agent\\tests\\test_catalog_shared_loader.py` (+109, fixture extended + 5 new u4 tests appended; file remains untracked from u1)\n\n??diff_summary\n- `src/renderer.py`:\n - Header import block:\n - REMOVED `import yaml` (no remaining `yaml.*` call site in this module).\n - ADDED `from src import catalog as _catalog_mod` (single delegation entry point ??mirrors u2 wiring at `block_reference.py:30` and u3 wiring at `block_selector.py`).\n - `from collections import OrderedDict`, `from pathlib import Path`, `from typing import Any`, `from jinja2 import Environment, FileSystemLoader`, and `logger` retained (still used by `TEMPLATES_DIR` L21, `STATIC_DIR` L22, `OrderedDict` group grouping later in the file, Jinja env, and type hints).\n - Module-level state (formerly L23, L28~L30, L65~L66 ??now L20~L26):\n - REMOVED `CATALOG_PATH = TEMPLATES_DIR / \"catalog.yaml\"` (path lives in `src.catalog.CATALOG_PATH` only).\n - REMOVED `_CATALOG_MTIME: float = 0.0` (single legacy key ??replaced by per-projection keys so the two projections invalidate independently and correctly under `get_catalog_mtime()` keying).\n - ADDED `_CATALOG_MAP_MTIME: float = 0.0` and `_CATALOG_VARIANT_MAP_MTIME: float = 0.0` (renderer-local projection cache keys; values come from `_catalog_mod.get_catalog_mtime()`).\n - `_CATALOG_MAP: dict[str, str] | None = None` retained (projection cache).\n - `_CATALOG_VARIANT_MAP: dict[str, str] | None = None` retained (projection cache); moved up next to its mtime key (formerly L65~L66, now L25~L26) so both projection caches sit together.\n - Section header comment updated: `catalog.yaml?먯꽌 id ??template 寃쎈줈 留ㅽ븨 濡쒕뱶 (BF-10: mtime 泥댄겕濡??먮룞 媛깆떊)` ??`id ??template 寃쎈줈 留ㅽ븨 (IMP-27: src.catalog 怨듭쑀 濡쒕뜑 ?꾩엫, renderer-local projection cache)`.\n - `_load_catalog_map() -\u003e dict[str, str]` (formerly L32~L62, now L29~L55):\n - Body shrunk to projection-only: calls `_catalog_mod.load_blocks()` for raw data and `_catalog_mod.get_catalog_mtime()` for the cache key; projection map rebuild iterates the returned `list[dict]` and writes `id ??template`.\n - File I/O (`open(CATALOG_PATH, ...)`, `yaml.safe_load`, the missing-file warning, the exception swallowing) fully removed ??those concerns now live in `src.catalog.load_root_catalog`.\n - Return contract unchanged: `dict[str, str]` keyed by block id. Logging line `catalog.yaml 濡쒕뱶: {N}媛?釉붾줉 留ㅽ븨` preserved (callers / log monitors unaffected).\n - `_load_catalog_map_with_variants() -\u003e dict[str, str]` (formerly L69~L97, now L58~L80):\n - Same projection-only pattern: consumes `_catalog_mod.load_blocks()` directly. Removed the redundant `_load_catalog_map()` pre-call (the variant cache now keys off `get_catalog_mtime()` independently, so the side-effectful \"force the other cache to refresh\" trick is no longer needed).\n - Removed the second `open(CATALOG_PATH, ...)` + `yaml.safe_load` block ??single shared file read enforced by `src.catalog`.\n - Return contract unchanged: `dict[str, str]` keyed by `\"block_id--variant_id\"`, excluding `default` variants. Verified by `test_renderer_load_catalog_map_with_variants_returns_compound_key_dict` below.\n- `tests/test_catalog_shared_loader.py`:\n - Fixture extended (lines 22~38): `fixture-block-b` now carries `variants` with a `default` and a `compact` entry, enabling the variant projection test to exercise the `default`-exclusion rule (preserves pre-IMP-27 behavior in `renderer._load_catalog_map_with_variants`).\n - `_reset_renderer_projection_cache()` helper added (lines 47~53) and called from the `fixture_catalog_path` fixture (line 65) so each test starts with both renderer-local projection caches cleared. Without this, the module-level state would leak across tests.\n - 5 new u4 tests appended after the u3 block (lines 313~421):\n - `test_renderer_load_catalog_map_returns_id_to_template_dict` ??verifies `id ??template` projection contract (matches existing callers `_resolve_template_path` at L135 of the new renderer).\n - `test_renderer_load_catalog_map_with_variants_returns_compound_key_dict` ??verifies `\"id--variant\" ??template` projection, with explicit aLine truncated