Skip to content

fix(html-output-mode): pre-merge review fixes (#1–#16) and final E2E items - #467

Merged
ShotaroKataoka merged 24 commits into
dev/html-outputfrom
fix/html-premerge-review
Oct 31, 2026
Merged

ShotaroKataoka merged 24 commits into
dev/html-outputfrom
fix/html-premerge-review

Conversation

@ShotaroKataoka

Copy link
Copy Markdown
Contributor

Fixes the pre-merge review findings for HTML output mode (issues #1–#16) and the four items from the final E2E check, before dev/html-output goes to main. Review issue #17 (move websockets to an optional extra) is intentionally not done: websockets stays a required dependency of sdpm-skill.

PPTX decks take the same code path as before. An absent or null outputFormat still means PPTX, and the PPTX GET /decks/{id} response is unchanged. The MCP tool count stays at 20.

Review issues

# Issue Fix Commit
1 HTML artifacts not published as one revision Each build's preview/PNG epoch is a millisecond revision above every listed epoch. A refresh or finalize that does not commit (failed preview upload or record update) deletes its own previews and PNGs d387f10, ad64477
2 Invalid outputFormat falls through to PPTX Three-way parse on every surface: absent/null → PPTX, valid → that format, invalid → stop. CLI exits 1, sdpm.tools.generate_pptx raises, local/remote run_python return errors.outputFormat, remote generate_pptx / get_preview return the error 90277c6
3 Browser check does not block WebRTC An egress guard installed with Page.addScriptToEvaluateOnNewDocument (page and auto-attached iframes) removes the RTC constructors and WebTransport and makes window.open return null. A probe after load and before any slide code fails the check closed. network_blocked is set only after the probe passes. script-external now flags RTCPeerConnection and stun: / turn: URLs 0669686
3 AgentCore canary scripts/verify_agentcore_browser_egress.py: run against a dev deployment, it showed WebRTC removed and the Fetch block holding. DNS hints were not tested, and the docs say so d5da9b5
4 Exfiltration warnings not durable script-external findings ({slug, kinds}) are written to the deck record as htmlScriptExternal at refresh/finalize, validated into scriptWarnings by GET /decks/{id}, and shown as an "External access" badge before Present / PDF / HTML, shared decks included e4ee82b
5, 11 No real-browser coverage Opt-in real-browser tests for the network block, popups, WebRTC in every frame kind, free-block overflow and the speaker view under the deck CSP. New CI browser job (ubuntu + Chrome, SDPM_TEST_BROWSER=1). It fails rather than skips when Chrome is missing 71b140c, 722e2d6
6 Free-positioned blocks skip scroll overflow free is included in the scroll-overflow rule bcd295a
7 PPTX orchestrator guidance changed The four instructions are restored with their original wording bf807a5
8 Decoration availability wrong denominator Uses the converter's predicate, now public as template.decorations_complete e658391
9 Failed decoration render memoised forever The memo expires after FAILED_RENDER_RETRY_S (600 s) dfa5382
10 Local preview route untested Vitest for the sandbox CSP on output.html and preview/*.html, nosniff, 404 for other .html paths and 403 for paths outside the deck 34467ff
12 Vendor files unverified sdpm/vendor/SHA256SUMS, checked by tests/test_vendor_checksums.py and sha256sum -c in CI 4a21df9
13 [Unreleased] documents removed surfaces HTML entries collapsed into one net "HTML output mode" entry. SDPM_JS_CHECK / js_check are gone from it 6d26707
14, 15 Present URL lifetime, shared bucket origin Listed as accepted risks in HTML Deck Security (docs/en/architecture.md), with the controls that bound them 6038bf9
16 Stale comments agentcore_browser.py, agent/modes/composer.py and web-ui/src/app/api/decks/route.ts corrected 97ffd3c

Final E2E items

  • (a) HTML decks ran without a template. html-deck.md (served as format_notes before apply_style) now says to choose a template and pass it to apply_style. The remote error for an unresolvable template names the deck.json value and apply_style(deck_id, style, template), and is logged at info level (069daa9, 9a62bce).
  • (b) Operating instructions drawn on slides. html-deck.md and composer-html.md say that the slide shows the controls and the operating steps go in <aside class="notes">. slide-html-spec.md says to pick the icon variant that contrasts with its background (069daa9).
  • (c) Finalize label said "Generating PPTX" for HTML decks. A DeckFormatContext passes the deck's format to the chat, and the step reads "Finalizing HTML deck" (6198db2).
  • (d) Compose lanes stuck at "Queued". ComposeCard settles every lane still starting or working when the tool succeeds (6198db2).

Verification

  • uv run ruff check: clean
  • uv run pytest tests/: 1689 passed, 39 skipped
  • Real-browser set (SDPM_TEST_BROWSER=1, Chrome on macOS): 13 passed
  • web-ui: vitest for chat, deck and the preview route: 236 passed. tsc --noEmit and eslint clean. en/ja key parity OK
  • The new CI browser job runs for the first time on this PR

Known low-severity follow-ups (from review)

  • The remote _deck_format and _is_html_deck raise AttributeError on a deck.json that is valid JSON but not an object. The local _deck_format already returns "pptx" in that case.
  • orchestrator.md still differs from main in two PPTX-facing places: "plain text only when" became "plain text when", and the visual definition lost its examples. No changelog entry mentions this.
  • DNS hints are documented as unproven in AgentCore Browser but are not in the "Accepted risks" list.
  • There is no .gitattributes entry for sdpm/vendor/** -text, so a CRLF checkout on Windows would fail the vendor checksum test.
  • A garbled comment above FAILED_RENDER_RETRY_S in sdpm/sdpm/engine/html/template.py.

Next

The dev-deploy E2E re-run follows this PR. It checks (a) and (b) in practice and confirms the Web UI changes (badge, finalize label, lane status) on a deployed stack.

…putFormat

An explicit invalid outputFormat (e.g. "htlm") no longer falls through to a PPTX
build: the CLI exits 1, sdpm.tools.generate_pptx raises, local and remote run_python
report errors.outputFormat and build nothing, remote generate_pptx / get_preview
return the error. Absent/null still means PPTX; unreadable deck.json keeps the PPTX path.

Verified: uv run pytest tests/test_cli_contract.py tests/test_run_python_semantics.py tests/test_remote_html.py tests/test_entry_tools.py -q (129 passed)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 1 (review #2) done
Next: FEAT-001 item 2 (scroll overflow of free-positioned blocks)
…ocks

Free-positioned top-level blocks now get the content-larger-than-box overflow finding
that placeholders, regions and region children already got.

Verified: uv run pytest tests/test_html_layout_judge.py tests/test_html_browser_check.py -q (24 passed, 8 real-browser skipped)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 2 (review #6) done
Next: FEAT-001 item 3 (decoration availability by the layouts that need a render)
… that need a render

template_html_view counted SVGs against every layout, so a template whose layouts draw
only placeholders (blank-light) or a complete cache with such layouts reported
decorations as unavailable without LibreOffice. It now uses the converter's predicate,
template.decorations_complete (renamed from _svgs_complete, now public).

Verified: uv run pytest tests/test_entry_tools.py tests/test_html_template.py -q (57 passed; both new tests fail on the old code)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 3 (review #8) done
Next: FEAT-001 item 4 (failed-render memo with a TTL)
…inutes

The failed-render memo held for the whole process, so a transient LibreOffice failure
in a long-lived server disabled decorations until restart. The memo now stores the
failure time and is reused only within FAILED_RENDER_RETRY_S (600 s).

Verified: uv run pytest tests/test_html_template.py -q (16 passed)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 4 (review #9) done; FEAT-001 complete
Next: FEAT-002 (browser-check egress, real-browser tests, CI)
…lide code runs

The browser check blocked http(s)/ws(s) through Fetch, but WebRTC (STUN/TURN)
bypasses Fetch and the deck CSP. An egress guard installed with
Page.addScriptToEvaluateOnNewDocument (page and auto-attached iframe targets)
removes the RTC constructors and WebTransport and makes window.open return
null; a probe after the load (top, window[n] of a fresh iframe, contentWindow,
srcdoc iframe, window.open) fails the check closed before any slide runs.
network_blocked is now set only after the probe. script-external flags
RTCPeerConnection and stun:/turn: URLs and carries per-diag kinds.

Verified: ruff clean; pytest tests/test_html_check.py tests/test_html_browser_check.py
tests/test_remote_html.py: 146 passed, 8 skipped; real-browser suite 8 passed
(Chrome); guard removed -> probe fails closed (manual run).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 5 (review #3) done
Next: real-browser tests for network block, popups, WebRTC, speaker view
…s, WebRTC and the speaker view

New opt-in tests: network requests stopped by the deck CSP and, with the CSP
removed, failed by the Fetch block (blocked_requests >= 2); window.open does
not stop the check; RTCPeerConnection unreachable from top, window[n],
contentWindow and srcdoc frames; overflow of a free-positioned block; the
speaker view's hashed script runs under the deck CSP. The real_browser marker
now skips only without SDPM_TEST_BROWSER=1, and use_browser fails when no
browser is found.

Verified: SDPM_TEST_BROWSER=1 pytest -k real_browser: 13 passed (Chrome, macOS);
without the variable: 14 passed, 13 skipped; ruff clean.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 6 (review #5, #11) done
Next: CI browser job
New `browser` job: ubuntu-latest with the runner's google-chrome, the AppArmor
user-namespace restriction lifted for Chrome's sandbox, SDPM_TEST_BROWSER=1,
`pytest tests/test_html_browser_check.py -k real_browser -v -rs`. The
use_browser fixture fails when Chrome is missing, so the job cannot go green
by skipping.

Verified: ci.yml parses (yaml.safe_load), jobs include browser.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 7 (review #5) done
Next: AgentCore Browser egress canary
scripts/verify_agentcore_browser_egress.py runs the remote server's browser
check (AgentCore Browser source + api.refresh_html) on a canary deck that
looks for WebRTC in every reachable window, starts ICE gathering against a
public STUN server, fetches/loads https://example.com and, with
--dns-domain, emits dns-prefetch / preconnect hints to a one-off host.
Exit 0 only when network_blocked is true, the rtc slide reported and no
WebRTC / srflx was found.

Verified (dev account, ap-northeast-1): status issues (CSP
refusals of the net slide), network_blocked true, blocked_requests 0,
"rtc: probed 5" with no "available"/"srflx", DNS egress not verified, PASS,
exit 0.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 8 (review #3) done
Next: FEAT-002 full verification
…as one revision

Each build's preview/PNG epoch is now a millisecond revision strictly above every
listed epoch, so two builds in the same second no longer share or lose keys. A
refresh that does not commit (failed preview upload or record update) deletes its
own previews and PNGs, as finalize already did.

Verified: uv run pytest tests/test_remote_html.py tests/test_html_artifacts.py tests/test_api_html_routes.py -q (66 passed); ruff clean.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-003 item 9 (review #1) done
Next: FEAT-003 item 10 (clear template-resolution error)
…oes not resolve

prepare_html_workspace re-raises a template resolution ValueError naming the
deck.json template and pointing at apply_style(deck_id, style, template);
refresh_html_deck logs that case at info level without a traceback.

Verified: uv run ruff check sdpm/ servers/ shared/ api/ agent/ (clean); uv run pytest tests/ -q (1681 passed, 39 skipped).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-003 items 9-10 done
Next: FEAT-004 (exfiltration warning surfaced, Web UI fixes)
…scripts reach outside

The static check's script-external findings ({slug, kinds}) are returned by
generate_html / refresh_html as script_external, written to the deck record
as htmlScriptExternal at refresh and finalize (a clean build removes it),
validated and exposed by GET /decks/{id} as scriptWarnings, and shown as an
"External access" badge before Present / PDF / HTML in the cloud Web UI.
The agent-facing run_python result (local and remote) leaves the key out;
the warnings already name these slides.

Verified: uv run ruff check (clean); uv run pytest tests/test_html_api.py
tests/test_remote_html.py tests/test_api_html_routes.py -q (79 passed);
npx vitest run src/components/deck/SlideCarousel.test.tsx (4 passed);
npx tsc --noEmit (clean).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 item 11 (review #4) done
Next: FEAT-004 item 12 (finalize label, compose lanes)
… lanes when the tool completes

A DeckFormatContext carries the open deck's outputFormat to the chat; the
generate_pptx row (full and compact) reads "Finalizing HTML deck" when the
deck or the tool result is HTML. ComposeCard treats tool success as the
end of every lane still starting/working, so no lane stays "Queued" and
each shows its created count.

Verified: npx vitest run src/components/chat (11 files, 79 passed; the new
lane test fails without the ComposeCard change); npx tsc --noEmit (clean).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 item 12 (E2E c, d) done
Next: FEAT-004 item 13 (local preview route test)
Node-environment vitest for /api/preview/[...path] against a temp
SDPM_DECK_ROOT: output.html gets "sandbox allow-scripts allow-popups
allow-popups-to-escape-sandbox", preview/<slug>.html gets "sandbox", both
with nosniff and text/html; other .html paths are 404, paths outside the
deck 403, a PNG is image/png.

Verified: uv run ruff check (clean); uv run pytest tests/ -q (1686 passed,
39 skipped); cd web-ui && npx eslint src/ --quiet && npx tsc --noEmit &&
npm test (50 files, 406 passed) && npm run build:cloud (ok); i18n parity OK.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 items 11-13 done
Next: FEAT-005 (guidance, vendor manifest, docs, changelog)
Restore "Do not transcribe the material:", "do not substitute — say so
and ask", "and the material, not the style" and "Name the form, not the
style's pattern or class (...)" with their original wording; the rest
stays format-neutral.

Verified: uv run pytest tests/test_entry_tools.py tests/test_agent_modes.py -q -> 66 passed

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 14 (review #7) done
Next: HTML guidance (template choice, operating steps in notes, icon contrast)
…ps go in the notes

html-deck.md: a Template bullet (choose one and pass it to apply_style;
deck.json keeps it); visual names the control and its effect, the
operating steps go in the speaker notes. composer-html.md: the slide shows
the controls, the steps go in <aside class="notes">; the layout pass's
frame, regions and deck.css are for what the audience reads.
slide-html-spec.md: pick the icon variant (theme_filter) that contrasts
with its background.

Verified: uv run pytest tests/test_entry_tools.py tests/test_remote_html.py -q -> 85 passed

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 15 (E2E a, b, icon contrast) done
Next: sdpm/vendor checksum manifest checked in CI
… in CI

sdpm/vendor/SHA256SUMS (sha256sum format, ./ paths) lists every vendored
file; tests/test_vendor_checksums.py checks the listed set equals the files
on disk and each digest matches; the CI python job runs
`sha256sum -c SHA256SUMS`; sdpm/vendor/README.md documents regeneration.

Verified: uv run pytest tests/test_vendor_checksums.py -q -> 2 passed;
cd sdpm/vendor && shasum -a 256 -c SHA256SUMS -> 14 OK; ci.yml parses.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 16 (review #12) done
Next: HTML Deck Security docs (accepted risks, browser-check egress)
…HTML Deck Security

docs/en/architecture.md: the browser check's WebRTC / WebTransport guard
and probe, what network_blocked means, the AgentCore canary result (DNS
hints not proven blocked); script-external findings kept on the deck
record and shown next to Present / Download, shared decks included;
Accepted risks: the 4-hour Present bearer URL outliving unsharing and the
single bucket origin with the controls that bound it.

Verified: proofread against browser_check.py, api/index.py and FEAT-002's
canary output; docs only, no code change.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 17 (review #3, #4, #14, #15) done
Next: correct stale comments (#16)
agentcore_browser.py: the runtime role has three browser actions;
composer.py: compose_slides writes .json or .html slide files, and the
finalize step is generate_pptx (PPTX or output.html); decks route: HTML
decks keep browser-check PNGs under preview/png/, so the thumbnail is the
static HTML preview.

Verified: uv run pytest tests/test_agent_modes.py -q -> 25 passed;
cd web-ui && npx tsc --noEmit -> clean

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 18 (review #16) done
Next: collapse the [Unreleased] HTML entries in CHANGELOG.md
… the net change

One "HTML output mode" Added entry describes what ships (local + cloud,
Web UI player / Present / PDF / HTML, CSP, scripts with ECharts / D3,
browser_check with WebRTC disabled, PNG previews, external links in new
tabs, script-external warning on the deck page, invalid outputFormat stops
builds, tool count 20, PPTX unchanged, deploy list). The phase entries, the
guidance and js_check Changed entries, the SDPM_JS_CHECK Removed entry and
the HTML Fixed entries are gone; runtime role, Python 3.10, Haiku 5.5 and
Security entries are kept.

Verified: no SDPM_JS_CHECK / js_check in [Unreleased].

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 19 (review #13) done
Next: whole-branch verification (item 20)
…d update fails

refresh deletes an uncommitted run's previews and PNGs (1e3f5186), but
finalize_html_deck only did so for a failed preview upload: a failed record
update left the new-revision previews winning the key map over the record's
older output.html. finalize now deletes this run's previews before re-raising.

Verified: uv run ruff check sdpm/ servers/ shared/ api/ agent/ -> clean;
uv run pytest tests/ -q -> 1689 passed, 39 skipped (new
test_generate_pptx_record_failure_removes_this_runs_previews fails without the fix).

SPEC: 20261029-1619_html-output-mode
Progress: integration of FEAT-001..005; finalize matches refresh on uncommitted builds
Next: integration review verdict
@ShotaroKataoka ShotaroKataoka added the blog:skip ブログ対象外 label Oct 31, 2026
…ting steps only in the notes

Composers still drew operating instructions as captions, hint lines and the
starting text of fields a control fills (E2E iteration 1: 4 of 10 scripted
slides in fceb8dfc / b861428b). composer-html.md and slide-html-spec.md now
say that every visible text, captions, labels and a field's starting text
included, names the content, and that how to operate the slide is written
only in <aside class="notes">. html-deck.md's review step sends such a slide
back to its composer.

Ran: uv run pytest -q tests/test_entry_tools.py tests/test_run_python_semantics.py (pass)

SPEC: 20261029-1619_html-output-mode
Progress: operating-instruction guidance tightened for composer and orchestrator review
Next: redeploy to dev and re-run the final E2E
…round in the PNG

E2E iteration 1 (9c52ea4c concept) again drew black icons on the dark
aws-dark background. The composer's PNG check now names icon contrast and
points to search_assets theme_filter for the other variant.

Ran: make lint (pass); make test (1687 passed, 39 skipped)

SPEC: 20261029-1619_html-output-mode
Progress: icon-contrast guidance added to the composer's check step
Next: redeploy to dev and re-run the final E2E
…preview route test fixture

The CI ASH scan (semgrep, HIGH) flagged path.join(root, rel) in the
test's write() helper. root is a mkdtemp directory and rel is a literal
fixture path, so annotate it with the same nosemgrep comment the other
tmpdir fixtures use. Test-only change; no runtime behaviour changes.

Verified: npx vitest run src/app/api/preview -> 5 passed;
ash --mode local --fail-on-findings -> exit 0 (semgrep/bandit/checkov/
detect-secrets PASSED).

SPEC: 20261029-1619_html-output-mode
Progress: CI scan job failure on PR #467 fixed
Next: watch PR #467 checks until all green
- Icon guidance: theme_filter picks a light/dark variant; SVG icons without variants
  (Material) are recoloured with CSS fill
- Remote _deck_format and tools._is_html_deck treat a non-object deck.json as PPTX
- orchestrator.md: restore main's PPTX wording ("only when", visual definition)
- .gitattributes: sdpm/vendor/** -text so vendor checksums hold on CRLF checkouts
- architecture.md: unproven DNS hints in the cloud browser check as an accepted risk
- template.py: fix the garbled comment above FAILED_RENDER_RETRY_S

SPEC: 20261029-1619_html-output-mode
Progress: PR #467 review low items closed
Next: merge #467, then dev/html-output -> main
@ShotaroKataoka
ShotaroKataoka merged commit a43b1d2 into dev/html-output Oct 31, 2026
11 checks passed
@ShotaroKataoka
ShotaroKataoka deleted the fix/html-premerge-review branch October 31, 2026 06:12
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.

1 participant