Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(planning): enforce confirmed image-source coverage in validate

hugohe34ab5f66b6151
diff --git a/skills/ppt-master/scripts/docs/project.md b/skills/ppt-master/scripts/docs/project.md
index 32179aaf..fd9d75c3 100644
--- a/skills/ppt-master/scripts/docs/project.md
+++ b/skills/ppt-master/scripts/docs/project.md
@@ -43,7 +43,11 @@ Notes:
it does not rewrite either artifact or compare their values for textual
equality. It also does not prove final-confirmation → Design Spec fidelity or
Design Spec → lock semantic projection; Generate Step 4 owns those two gates
- before this structural validation. The design schema is structural lint for
+ before this structural validation. One slice is enforced mechanically: when
+ `confirm_ui/result.json` records a final confirmed stage, every confirmed
+ non-`none` `image_usage` source must appear in at least one `## images` row
+ of the lock (`provided` maps to `user`; `ai` is also satisfied by `slice`).
+ The design schema is structural lint for
the human-readable brief; the lock schema owns machine execution values. For structured template use,
validation also compares the lock's Master/Layout identities with the actual
template SVG roots. Versioned scaffolds carry the schema marker. Markerless
diff --git a/skills/ppt-master/scripts/project_specs.py b/skills/ppt-master/scripts/project_specs.py
index 33fa2a85..9f0cbc1a 100644
--- a/skills/ppt-master/scripts/project_specs.py
+++ b/skills/ppt-master/scripts/project_specs.py
@@ -59,6 +59,17 @@ _SCHEMA_MARKER_RE = re.compile(
re.IGNORECASE,
)
+# Confirmed `image_usage` source id → acceptable `## images` acquisition tokens.
+# Mirrors the strategist.md §h mapping (ai→ai, web→web, provided→user,
+# placeholder→placeholder); a confirmed `ai` plan may legitimately enter the
+# lock only as sliced sheet elements, so `slice` also satisfies `ai`.
+_CONFIRMED_IMAGE_SOURCE_TOKENS = {
+ "ai": ("ai", "slice"),
+ "web": ("web",),
+ "provided": ("user",),
+ "placeholder": ("placeholder",),
+}
+
def _normalize_schema_value(value: str) -> str:
"""Normalize a Markdown scalar before enum, pattern, and catalog checks."""
@@ -682,6 +693,40 @@ def _validate_strict_data_surface(
return errors
+def _confirmed_image_sources(project_dir: Path) -> list[str]:
+ """Return confirmed non-`none` image sources from the final Confirm UI state.
+
+ Reads ``confirm_ui/result.json`` only when it records a final confirmed
+ stage; a chat-delegated or superseded confirmation without that file keeps
+ the coverage check silent. Malformed payloads are treated as absent —
+ the Confirm UI owns result integrity, not this validator.
+ """
+ result_path = project_dir / "confirm_ui" / "result.json"
+ if not result_path.is_file():
+ return []
+ try:
+ payload = json.loads(result_path.read_text(encoding="utf-8-sig"))
+ except (OSError, UnicodeError, json.JSONDecodeError):
+ return []
+ if not isinstance(payload, dict):
+ return []
+ if payload.get("status") != "confirmed" or payload.get("stage") != "final":
+ return []
+ raw_usage = payload.get("image_usage")
+ if isinstance(raw_usage, str):
+ raw_usage = [raw_usage]
+ if not isinstance(raw_usage, list):
+ return []
+ sources: list[str] = []
+ for item in raw_usage:
+ if not isinstance(item, str):
+ continue
+ token = item.strip().casefold()
+ if token and token != "none" and token not in sources:
+ sources.append(token)
+ return sources
+
+
def _validate_spec_lock_relations(
markdown_path: Path,
matched: Mapping[str, dict[str, object] | None],
@@ -752,6 +797,26 @@ def _validate_spec_lock_relations(
f"{', '.join(unknown_chart_pages)}"
)
+ confirmed_sources = _confirmed_image_sources(markdown_path.parent)
+ if confirmed_sources:
+ # Row values are free-form beyond the leading acquisition source;
+ # both `ai | ...` and `ai, ...` delimiter styles occur in practice.
+ image_tokens = {
+ _normalize_schema_value(re.split(r"[|,]", value, maxsplit=1)[0]).casefold()
+ for value in fields("images").values()
+ }
+ for source in confirmed_sources:
+ accepted = _CONFIRMED_IMAGE_SOURCE_TOKENS.get(source)
+ if accepted is None or not image_tokens.isdisjoint(accepted):
+ continue
+ expected = " or ".join(f"'{token}'" for token in accepted)
+ errors.append(
+ f"{markdown_name} schema: confirmed image source '{source}' "
+ f"(confirm_ui/result.json image_usage) has no '## images' row "
+ f"with acquisition {expected}; repair design_spec.md §VIII "
+ "from the final confirmation, then re-project the lock"
+ )
+
info = get_project_info_common(str(markdown_path.parent))
format_key = str(info.get("format", "unknown"))
canvas = CANVAS_FORMATS.get(format_key)
diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.md
index ae9795e0..edbc6639 100644
--- a/skills/ppt-master/workflows/generate-pptx.md
+++ b/skills/ppt-master/workflows/generate-pptx.md
@@ -240,7 +240,7 @@ Fill and audit `design_spec.md` against the complete final confirmation. Only af
python3 ${SKILL_DIR}/scripts/project_manager.py scaffold-lock <project_path>
```
-After filling the lock, compare its machine-relevant values against the completed Design Spec, then run `python3 ${SKILL_DIR}/scripts/project_manager.py validate <project_path>`. A `result.json` → Design Spec mismatch or Design Spec → lock projection mismatch is blocking even when the standalone Markdown schemas pass. Repair the Design Spec only from the final confirmation state, then re-project the affected lock rows. A resume path edits existing files in the same order and never re-scaffolds them.
+After filling the lock, compare its machine-relevant values against the completed Design Spec, then run `python3 ${SKILL_DIR}/scripts/project_manager.py validate <project_path>`. A `result.json` → Design Spec mismatch or Design Spec → lock projection mismatch is blocking even when the standalone Markdown schemas pass. `validate` mechanically enforces one slice of this: with a final confirmed `confirm_ui/result.json`, every confirmed non-`none` `image_usage` source must be represented by at least one `## images` row (`ai` is also satisfied by `slice`); the remaining semantic comparison stays with this gate. Repair the Design Spec only from the final confirmation state, then re-project the affected lock rows. A resume path edits existing files in the same order and never re-scaffolds them.
**✅ Checkpoint — Phase deliverables complete, auto-proceed to next step**:
```markdown