Skip to content

feat(deck): notesMode keep|strip|export — speaker notes policy for the PPTX build - #666

Merged
ShotaroKataoka merged 2 commits into
aws-samples:mainfrom
hmkim:feat/notes-policy
Nov 20, 2026
Merged

ShotaroKataoka merged 2 commits into
aws-samples:mainfrom
hmkim:feat/notes-policy

Conversation

@hmkim

@hmkim hmkim commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a speaker-notes policy to deck.json: "notesMode": "keep" | "strip" | "export".

  • keep (default, absent = keep): unchanged behaviour, slide notes become speaker notes.
  • strip: the .pptx is built without speaker notes.
  • export: the .pptx is built without speaker notes and they are written to <output stem>.notes.md next to it (output.pptx → output.notes.md; one ## pageNN — title <!-- slug --> section per slide, {{...}} styling removed, links kept as text <URL>). generate / generate_pptx return the file as notes_path.

Why: a deck handed to an audience must not carry the presenter's script. This matters most for imported slides (import_attachment → pptx_to_json), whose original notes often hold internal guidance that the composer never sees. Today the only way to ship such a deck is to edit every slides/*.json by hand before the build, which also throws the notes away for the presenter.

The slide files are never touched, so composing, check_specs and round-trips are unchanged. An invalid value is a check_specs error and stops the build (no silent default). Partial builds (only_slugs / iso.pptx) write no notes file, so a composer's isolated rebuild cannot overwrite the deck's export.

Changes: engine/schema (NOTES_MODES, deck_notes_mode, validate_specs error), engine/builder (PPTXBuilder(write_notes=...)), new engine/notes.py (plain_notes_text, speaker_notes_markdown), api (BuildConfig.notes_mode, export in generate), guide slide-json-spec.md, CHANGELOG.

Checklist

  • make all passes (ruff + pytest) — make lint clean; make test: 3658 passed, 19 skipped, 4 failures that also fail on untouched main in my environment (test_image_label_width::test_latin_label_width, test_tool_descriptions::test_description_budget[local|acp|remote]), unrelated to this change
  • ash scan --mode local --fail-on-findings — ran with the scanners available here (bandit, checkov, cdk-nag, cfn-nag, detect-secrets, npm-audit, semgrep); no finding in any file touched by this PR
  • Docs updated if behavior/paths changed — sdpm/references/guides/slide-json-spec.md (deck.json section)
  • CHANGELOG.md [Unreleased] updated for user-facing changes
  • Commit messages follow Conventional Commits

Testing

  • New tests/test_notes_mode.py (22 tests): schema default/explicit/invalid values, validate_specs / check_specs, a 3-slide deck built in each mode (speaker notes present / absent in the .pptx, notes_path returned only for export, Markdown content with styling removed and a (no notes) slide), partial build writes no file, invalid mode stops generate, Markdown rendering without title/slugs.
  • Existing test_deck_spec, test_builder_notes_master, test_roundtrip, test_accessibility_metadata still pass.

Boundaries touched

  • sdpm/references/ — one bullet added to guides/slide-json-spec.md (deck.json fields); no workflow document changed

…e PPTX build

deck.json "notesMode" decides what the build does with each slide's "notes":
"keep" (default, unchanged) writes them as speaker notes; "strip" leaves them
out of the .pptx; "export" leaves them out and writes <output stem>.notes.md
next to the .pptx (one "## pageNN — title" section per slide, {{...}} styling
removed), returned as notes_path by generate / generate_pptx.

A deck handed to an audience must not carry the presenter's script, which
imported slides often bring along in their original notes. The slide files keep
their notes, so composing and check_specs are unchanged; an invalid value is a
check_specs error and stops the build (no silent default). Partial builds
(only_slugs / iso.pptx) write no notes file.

- engine/schema: NOTES_MODES, deck_notes_mode(), validate_specs error
- engine/builder: PPTXBuilder(write_notes=...)
- engine/notes.py: plain_notes_text, speaker_notes_markdown
- api: BuildConfig.notes_mode, generate() export + notes_path
- guide slide-json-spec.md, CHANGELOG, tests/test_notes_mode.py (22)
@ShotaroKataoka

Copy link
Copy Markdown
Contributor

🤖 KiroCrew automated comment: review drafted by KiroCrew on behalf of the maintainers. It does not approve or merge.

⚠️ NEEDS CHANGES: notesMode works locally, but "export" silently acts like "strip" on the remote server

Thanks for this. The feature is small, well scoped and well tested. keep / strip look correct, invalid values are caught by both check_specs and generate, and partial builds skip the notes file as described. CI is green (the blog-label check is maintainer-only). I ran tests/test_notes_mode.py, test_deck_spec.py and test_builder_notes_master.py locally on the PR head: 113 passed.

1. Remote (Layer 3) generate_pptx drops the exported notes (please fix)

  • servers/remote/tools/generate.py:367-368 builds into a temp workspace: api_generate(json_path=tmpdir, output_path=out).
  • With "notesMode": "export", sdpm/sdpm/api.py:972-976 writes output.notes.md into that temp dir. Only the .pptx is uploaded (generate.py:371-375), and the tool result (generate.py:418-422) does not pass notes_path on.
  • Result: a remote user who picks export gets a deck with no notes and no notes file, and nothing tells them. The description says "generate / generate_pptx return the file as notes_path", which holds for the local server only.

Suggested fix, either one:

  • (a) In generate_pptx (remote), when gen_result.get("notes_path") is set, upload the file (for example next to the pptx key, pptx/{deck_id}/<uuid>.notes.md, text/markdown) and return its key or URL in the result. Add a test.
  • (b) Smaller: document export as local-only for now, and have the remote tool add a warning to its result when notesMode is export, so it is never silent.

2. A stale <stem>.notes.md can outlive the mode change (low)

If a deck is built once with export and then with keep or strip, the old output.notes.md stays beside the new .pptx. For strip, that is the same presenter script the user just chose to leave out. Consider deleting an existing <stem>.notes.md on a full build when the mode is not export, or say in the guide that the file is not cleaned up.

3. HTML decks (low, docs only)

notesMode only affects the PPTX builder. HTML decks keep their <aside class="notes"> in output.html, but validate_specs accepts notesMode on an HTML deck without a word. One line in slide-json-spec.md ("PPTX decks only") would avoid the wrong expectation.

Overlap with other open PRs

Security

No workflow, dependency, install-script or network changes. The only new file write is <output stem>.notes.md, derived from the caller's own output path. No secrets found.

…e notes file cleanup; PPTX-only note

Review on aws-samples#666:
1. servers/remote generate_pptx built into a temp workspace and uploaded only the
   .pptx, so "export" silently acted like "strip" on the AWS stack. The notes file
   now goes to pptx/<deckId>/<build>.notes.md (same build id as the .pptx),
   the deck record gets notesS3Key (cleared on a keep/strip rebuild), the
   superseded notes object is deleted like the old .pptx, and the result carries
   notesS3Key plus a signed notesUrl.
2. A full build in keep/strip mode deletes a <stem>.notes.md left by an earlier
   export build; partial builds never touch it.
3. Guide: PPTX decks only (HTML decks keep their <aside class="notes">).

Tests: test_mcp_generate (export upload + keep clears), test_notes_mode (stale cleanup).
@hmkim

hmkim commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All three points addressed in the follow-up commit:

  1. Remote generate_pptx — option (a). When gen_result["notes_path"] is set, the file is uploaded as pptx/<deckId>/<build>.notes.md (same build id as the .pptx, text/markdown). The deck record gets notesS3Key (set to None on a keep/strip rebuild so it never points at old notes), the superseded notes object is deleted alongside the old .pptx, and the tool result returns notesS3Key and a signed notesUrl. Tests: test_generate_pptx_export_uploads_notes_beside_the_deck, test_generate_pptx_keep_clears_notes_key_and_deletes_old_notes.
  2. Stale <stem>.notes.md — a full build in keep/strip mode deletes it; partial builds (only_slugs) never touch it. Test: test_full_build_without_export_deletes_a_stale_notes_file. Documented in the guide.
  3. HTML decks — guide now says "PPTX decks only: an HTML deck keeps its <aside class="notes">".

CHANGELOG updated. make lint clean; make test 3662 passed (the same 4 failures as on main in my environment: test_latin_label_width, test_description_budget[*]). Happy to rebase once #595 lands.

@ShotaroKataoka ShotaroKataoka added the blog:skip ブログ対象外 label Nov 20, 2026
@ShotaroKataoka

ShotaroKataoka commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Thanks, @hmkim. All three points from round 1 are addressed with tests: the remote generate_pptx uploads the exported notes and keeps notesS3Key in step, stale notes files are cleaned up on full builds, and the guide says PPTX decks only. I re-ran test_notes_mode, test_mcp_generate, test_deck_spec and test_builder_notes_master on the PR head (122 passed), and the branch merges cleanly with main.

A few small follow-ups we will handle on our side after merge, so nothing more is needed from you:

  • The run_python auto-rebuild on the remote server (_refresh_pptx_artifact) does not upload the notes or update notesS3Key yet.
  • The orchestrator, which owns deck.json, does not receive the guide that documents notesMode. We plan to give the deck.json fields their own guide.

@ShotaroKataoka
ShotaroKataoka merged commit e8a2766 into aws-samples:main Nov 20, 2026
24 of 25 checks passed
ShotaroKataoka added a commit that referenced this pull request Nov 20, 2026
* feat(deck)!: speakerNotes pptx|markdown replaces notesMode

deck.json "notesMode" (keep|strip|export, #666, unreleased) becomes
"speakerNotes": "pptx" (default, notes written as speaker notes) or
"markdown" (left out of the .pptx, written to <output stem>.notes.md).
"strip" is removed; no compatibility for the old key or values: a
leftover "notesMode" is ignored like any unknown key.

SPEAKER_NOTES / deck_speaker_notes() replace NOTES_MODES /
deck_notes_mode(); BuildConfig.speaker_notes, _notes_markdown_path().
CHANGELOG [Unreleased] rewritten for the new name and values, plus the
deck-json-spec guide entry.

Verified: make lint (ruff) passed; make test 3673 passed, 18 skipped
(run on the full PR 1 tree; the icon catalog was linked in from the
downloaded assets, without it test_svg_icon_is_inlined_with_prefixed_ids
fails on the missing catalog).

* feat(guides): deck-json-spec guide, returned by start_presentation as static.deck_spec

New guide deck-json-spec lists every deck.json field of PPTX and HTML
decks (template, fonts, defaultTextColor, defaultBackground, slideSize,
outputFormat, title, language, speakerNotes, autoSpacing): required or
optional, default, who writes it, which format it affects, and that the
style fields stay fixed after apply_style. slide-json-spec and
slide-html-spec keep the folder figure and point to it.

start_presentation returns it as static.deck_spec (preloaded with the
other references); the L4 orchestrator modes place it in the system
prompt right after the role document, before the cache point.
orchestrator.md is unchanged.

Verified: make lint (ruff) passed; make test 3673 passed, 18 skipped.
New tests: test_entry_tools (static.deck_spec, slide specs point to the
guide), test_agent_modes (deck_spec part before the cache point in
orchestrator/vibe/spec; resolved system prompt contains it with one
start_presentation call), test_agent_assembly (text reaches the agent).
ShotaroKataoka added a commit that referenced this pull request Nov 20, 2026
* feat(deck)!: speakerNotes pptx|markdown replaces notesMode

deck.json "notesMode" (keep|strip|export, #666, unreleased) becomes
"speakerNotes": "pptx" (default, notes written as speaker notes) or
"markdown" (left out of the .pptx, written to <output stem>.notes.md).
"strip" is removed; no compatibility for the old key or values: a
leftover "notesMode" is ignored like any unknown key.

SPEAKER_NOTES / deck_speaker_notes() replace NOTES_MODES /
deck_notes_mode(); BuildConfig.speaker_notes, _notes_markdown_path().
CHANGELOG [Unreleased] rewritten for the new name and values, plus the
deck-json-spec guide entry.

Verified: make lint (ruff) passed; make test 3673 passed, 18 skipped
(run on the full PR 1 tree; the icon catalog was linked in from the
downloaded assets, without it test_svg_icon_is_inlined_with_prefixed_ids
fails on the missing catalog).

* feat(guides): deck-json-spec guide, returned by start_presentation as static.deck_spec

New guide deck-json-spec lists every deck.json field of PPTX and HTML
decks (template, fonts, defaultTextColor, defaultBackground, slideSize,
outputFormat, title, language, speakerNotes, autoSpacing): required or
optional, default, who writes it, which format it affects, and that the
style fields stay fixed after apply_style. slide-json-spec and
slide-html-spec keep the folder figure and point to it.

start_presentation returns it as static.deck_spec (preloaded with the
other references); the L4 orchestrator modes place it in the system
prompt right after the role document, before the cache point.
orchestrator.md is unchanged.

Verified: make lint (ruff) passed; make test 3673 passed, 18 skipped.
New tests: test_entry_tools (static.deck_spec, slide specs point to the
guide), test_agent_modes (deck_spec part before the cache point in
orchestrator/vibe/spec; resolved system prompt contains it with one
start_presentation call), test_agent_assembly (text reaches the agent).

* feat(engine): strip_speaker_notes removes notes from a stored PPTX

sdpm.engine.notes.strip_speaker_notes(source, target) drops every slide's
notes-slide relationship and saves the copy (no rebuild); returns how many
notes slides it removed. shared.artifact_keys.no_notes_pptx_key names the
cached copy beside its build: pptx/<deck>/<build>.nonotes.pptx.

Ran: uv run pytest -q tests/test_speaker_notes.py tests/test_artifact_keys.py (35 passed)

* fix(remote): run_python rebuild uploads speakerNotes markdown and updates notesS3Key

PptxRefresh.notes_path carries the Markdown the full build wrote with
speakerNotes "markdown". _refresh_pptx_artifact uploads it beside the PPTX
(same build id) and sets notesS3Key (cleared with "pptx"), as generate_pptx
does. Both delete the superseded build's .notes.md and .nonotes.pptx copy.

Ran: uv run pytest -q tests/test_refresh_pptx.py tests/test_run_python_pptx_characterization.py
tests/test_mcp_generate.py tests/test_run_python_semantics.py (all passed)

* feat(api): PPTX download without speaker notes

GET /decks/{id}/pptx?notes=without signs a copy of the stored PPTX without
speaker notes. The first such request makes it with
sdpm.engine.notes.strip_speaker_notes and keeps it beside the build
(pptx/<deck>/<build>.nonotes.pptx); later requests reuse it. Same read
permission and 404s as the plain download. The deck list items and the deck
detail carry speakerNotes ("markdown" when the record has notesS3Key).

Ran: uv run pytest -q tests/test_api_html_routes.py tests/test_api_public_decks.py (51 passed)

* feat(web-ui): local PPTX download without speaker notes

GET /api/decks/{id}/pptx?notes=without runs sdpm.engine.notes.strip_speaker_notes
through uv run (servers/local environment) into a fresh temp dir, serves the
copy with the same headers and removes the dir; an engine failure is a 500.
The local deck list and detail carry speakerNotes ("markdown" when
output.notes.md sits beside output.pptx).

Ran: cd web-ui && npx vitest run src/app/api/decks (all passed; the uv-backed
route.engine.test.ts ran, not skipped)

* feat(web-ui): download PPTX with or without notes

The deck card "..." menu has two download items, with notes and without
notes (both modes). The cloud deck view's PPTX link becomes a small menu
with the same two choices; each asks for a fresh signed URL. The local
"Open PPTX" button is unchanged. "With notes" is disabled for a deck whose
stored PPTX was built with speakerNotes "markdown"; both items show for a
deck without notes. en/ja messages added (deckCard, carousel).

Ran (web-ui): npx eslint src/ --quiet && npx tsc --noEmit && npm test
(133 files, 1535 tests passed) && npm run build:cloud (ok); en/ja key
parity check OK; package-lock.json unchanged

* docs: changelog and storage layout for the PPTX download without notes

Full verification of PR 2 on this commit:
- make lint: passed (ruff, all checks)
- make test: 3693 passed, 18 skipped (with the icon catalog linked into
  sdpm/assets, as test_html_assemble needs it; without it that one test fails)
- web-ui: npx eslint src/ --quiet && npx tsc --noEmit && npm test
  (133 files, 1535 tests) && npm run build:cloud: all passed; the uv-backed
  route.engine.test.ts ran (not skipped)
- en/ja key parity: OK; package-lock.json unchanged

* fix(web-ui): say "speaker notes" in the PPTX download items

"Notes" alone could be read as other notes or comments in the app.
en: "Download PPTX (with/without speaker notes)", carousel "With/Without
speaker notes"; ja: 「PPTX をダウンロード(スピーカーノート付き/なし)」,
carousel 「スピーカーノート付き」「スピーカーノートなし」. The aria labels are the
same text plus ": {name}". Key names unchanged.

The deck card menu was w-64 (256px); the longest label measures about
302px (ja) and 260px (en) at 14px in headless Chromium, so the menu now
sizes to its content (w-max). The carousel menu already had no fixed width.

Checks: en/ja parity OK, eslint pass, tsc pass, npm test 133 files /
1535 tests passed, build:cloud pass.
@ShotaroKataoka

ShotaroKataoka commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to this PR are merged

Thanks again for this feature. Building on it, two follow-ups are now on main:

  • feat(deck)!: deck-json-spec guide and speakerNotes pptx|markdown #674: the field is renamed. "notesMode": "keep" | "strip" | "export" is now "speakerNotes": "pptx" | "markdown". "pptx" (the default) keeps the notes in the .pptx. "markdown" is the former "export": the notes stay out of the .pptx and go to <output stem>.notes.md. "strip" is removed, because the slide files keep their notes either way and the Markdown file costs nothing. Since none of this was released, there is no compatibility alias. If you already use notesMode, please switch to speakerNotes. deck.json fields now have their own guide (deck-json-spec), which the orchestrator receives from start_presentation, so agents can set the field when a user asks for it.
  • feat(web-ui): download PPTX with or without speaker notes #675: choose at download time in the Web UI. In both cloud and local mode, the deck card menu offers "Download PPTX (with speaker notes)" and "Download PPTX (without speaker notes)". The cloud deck view's PPTX button opens the same choice. The no-notes copy is made from the stored .pptx by sdpm.engine.notes.strip_speaker_notes, with no rebuild, so it works for imported decks too. Web UI users no longer need to set anything in deck.json to hand out a deck without the presenter's script. On the AWS stack, "markdown" also uploads the notes on the run_python auto-rebuild, which fixes the notesS3Key gap noted in round 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blog:skip ブログ対象外

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants