Skip to content

ci: add CI workflow for python, web-ui, infra, and PR guards - #4

Merged
okamoto-aws merged 7 commits into
mainfrom
ci/add-ci-workflow
Apr 6, 2026
Merged

okamoto-aws merged 7 commits into
mainfrom
ci/add-ci-workflow

Conversation

@okamoto-aws

Copy link
Copy Markdown
Contributor

Changes

  • Add GitHub Actions CI workflow with 4 parallel jobs:
    • python: ruff lint + pytest
    • web-ui: npm ci + eslint + next build
    • infra: npm ci + tsc type check
    • guard: deny cdk.context.json and .env files in PRs

Triggered on push to main and PRs to main.

Comment thread .github/workflows/ci.yml Fixed
Comment thread .github/workflows/ci.yml Fixed
Comment thread .github/workflows/ci.yml Fixed
Comment thread .github/workflows/ci.yml Fixed
@okamoto-aws
okamoto-aws force-pushed the ci/add-ci-workflow branch 2 times, most recently from 4e5ca50 to 910395b Compare April 6, 2026 10:42
@okamoto-aws
okamoto-aws merged commit 6ee9f31 into main Apr 6, 2026
9 checks passed
ShotaroKataoka added a commit that referenced this pull request Oct 31, 2026
…E items (#467)

* 🐛 fix(html-output-mode): stop every build on an invalid deck.json outputFormat

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)

* 🐛 fix(html-output-mode): report scroll overflow of free-positioned blocks

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)

* 🐛 fix(html-output-mode): judge decoration availability by the layouts 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)

* 🐛 fix(html-output-mode): retry a failed decoration render after ten minutes

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)

* 🔒 fix(html-output-mode): disable WebRTC in the browser check before slide 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

* ✅ test(html-output-mode): real-browser tests for network block, popups, 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

* 👷 ci(html-output-mode): run the real-browser tests on ubuntu with Chrome

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

* ✅ test(html-output-mode): 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

* 🐛 fix(html-output-mode): publish an HTML refresh's previews and PNGs 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)

* 🐛 fix(html-output-mode): say how to fix an HTML deck whose template does 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)

* ✨ feat(html-output-mode): warn next to Present / Download when slide 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)

* 🐛 fix(html-output-mode): label the HTML finalize step, settle compose 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)

* ✅ test(html-output-mode): sandbox headers of the local preview route

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)

* 📚 docs(html-output-mode): restore the PPTX orchestrator instructions

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)

* 📚 docs(html-output-mode): HTML decks choose a template; operating steps 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

* 🔒 chore(html-output-mode): checksum manifest for sdpm/vendor, checked 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)

* 📚 docs(html-output-mode): accepted risks and browser-check egress in 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)

* 💡 docs(html-output-mode): correct comments left from earlier phases

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

* 📚 docs(html-output-mode): collapse the [Unreleased] HTML entries into 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)

* 🐛 fix(html-output-mode): finalize removes its previews when the record 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

* 📚 docs(html-output-mode): every visible text names the content; operating 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

* 📚 docs(html-output-mode): composer checks each icon against its background 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

* 🔒 chore(html-output-mode): suppress semgrep path-join finding in the 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

* 🐛 fix(html-output-mode): last low review items before merge

- 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
naohito2000 pushed a commit that referenced this pull request Dec 1, 2026
`style.md` sent the style author to `read_guides(["import-pptx"])` "when the reference deck
should be inspected slide by slide". `import-pptx` opens by telling exactly that reader to
stop: it is the edit branch, and for reference material it says to go back to the briefing
flow. The lenses they actually needed sat 258 lines past that refusal.

And the style contract restated around them had drifted. Step 5 asked for "5-6 demonstration
slides (cover, palette / type ramp / component swatches)" with placeholder copy like
`Cover Title` / `Body sample`, while `style.md` requires Cover, Rules, Message & Outline,
seven named Patterns, a divider and Closing, and says in as many words that nothing in a
style is a specimen sheet. The same guide contradicted itself: its own 5-3 already said not
to write that placeholder copy. Following the parts a reader met first produced the wrong
`art-direction.html`.

New `style-from-pptx` (tags `style, orchestrator`) owns the part that is genuinely about
reading somebody else's deck: Lens B for what the theme declares, Lens A for what each thing
is for, Lens C for what the deck spends its surface on, and the table saying which lens a
given token may come from. Rewritten rather than moved — the extracted text referred to
"Step 2" and "Step 4" of a workflow its new reader never runs, and still called the style's
slides demonstration slides.

`import-pptx` Step 5 is now the two pointers and what is import-specific about them (the
bundle's template for Lens B, the previews Step 4 already built for A and C). It restates
none of the style contract, which took it from 22,375 bytes — 93% of the 24,000-byte
per-guide cap, with 1,625 to spare — to 11,645, and its tags drop `style`.

Found by a four-axis review of the collection (structure #4 ≡ duplication #8, both at
confidence 100).
ShotaroKataoka pushed a commit that referenced this pull request Dec 3, 2026
… what to read (#711)

* feat(guides): guide metadata, tag vocabulary, name rule and size cap

Guides become one collection classified by role tags, so a guide needs
metadata the frontmatter can carry and a single parse every surface shares.
guide_meta returns the metadata with a frontmatter-stripped body, or the one
category under which the guide is invalid, so an invalid guide is reported
rather than silently degraded. is_guide_name is separate from is_style_name,
which deliberately admits acme.v2: a guide name is also a payload key.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 1

* feat(guides): resolve guides from the same three layers as styles

A user extends the collection by dropping a file in their own directory, so
guides need the ordered resolution templates and styles already have. The
user's directory is named guides, matching styles/ and templates/ beside it.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 2

* feat(guides): merge the sources into one collection object

Listing, read-by-name and automatic hand-over must agree on which guide won a
name, so they read one merged object rather than each resolving again. The
object is a value the caller builds, which is what lets the remote merge S3
bodies through the same rule the local merges file reads through.

An invalid entry is reported with its location and never wins a name, so a
broken user guide falls through to the bundled one instead of disabling it.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 3

* feat(guides): select by tag intersection and join the handed-over text

One predicate decides both what a caller can list and what it is handed, so a
guide tagged for one composer mode cannot be visible in that mode while being
invisible to the listing beside it. Selection takes the whole tag set rather
than a role string, which is what lets a guide carry every tag it may be
called under.

The listing deliberately carries no body: it rides inside every start_*
return, where 31 bodies would duplicate the prompt the hand-over already
supplies.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 4

* feat(guides): one read path, cached only where references cannot change

A local server must show an edited guide on the next call, so the collection
is built per call and nothing is remembered. The cloud image's bundled
references are fixed for the life of its process, so preload_references now
warms them here too — but only the bundled ones: a user's guides live in a
store that keeps changing under a running process.

The guide cache is separate from _reference_cache because that one holds
frontmatter-stripped content, and a guide's metadata has to survive the read.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 5

* feat(guides)!: delete the setup guide

Nothing referenced it, and it told the reader to cd into a skill/ directory
this repository does not contain. The install instructions readers actually
need are in README.md and docs/en/getting-started.md.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 6

* feat(guides)!: storytelling-vocabulary becomes story-line, structure first

"Structure" did not say what was being structured, and the guide buried the
decision it exists to support: the five backbones a slide sequence can take,
each with the audience condition that chooses it. Those now open the document
and the vocabulary sits behind them, because the orchestrator is handed this
guide on every deck and reads the opening every time.

The published name storytelling-vocabulary is gone; callers use story-line.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 7

* feat(guides): add verify, the rules a slide owes whatever its style says

Every other guide a composer holds carries preferences, and a deck may swap
all of them. What a drawing is allowed to assert, and whether the text is true
to its evidence, survive that swap — so they needed a guide of their own
rather than living inside whichever style happened to be applied.

Handed to both composer modes, so it is checked on every slide.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 8

* feat(guides): add writing-a-guide

Users can now extend the collection, so the rules their guide has to satisfy
need to be written down somewhere they can find them: the frontmatter grammar,
the closed tag vocabulary, what always costs, and how to name a guide.

The last section works the Japanese-deck case through, because that is where a
reader would otherwise expect sdpm to select by language. Selection is by tag
alone, so a conditional guide carries its condition in its description.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 9

* feat(guides): rewrite source-material-guide for the deck workspace

It still described output under /tmp/sdpm/{name}/ and a "Phase 1 (art
direction)" that no longer exists, which is part of why nothing referenced it.
Its subject has no other home: import-pptx covers turning a PPTX into the
deck, and nothing covered reusing parts of one as material for a new deck.

Rewritten against the import bundle, and extended with how a reuse decision
reaches a composer — through the brief's Sources and the outline's evidence,
since a composer sees nothing else.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 10

* feat(guides): tag every bundled guide, and drop the dead frontmatter keys

Tags are how a guide reaches a role now, so every bundled guide carries the
full set it may be called under — a guide tagged for one composer mode only is
invisible to the other, including in its listing.

category: and name: went with them. Thirteen guides carried one or both and
nothing had ever read either, so they only misled an author writing a guide of
their own.

writing-ja now leads its description with the condition that selects it, since
no code looks at the deck's language: the reader checks the first clause.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 11

* test(guides): pin the bundled collection by equality

A tag added or dropped by accident changes a role's prompt silently, and
sampling would not catch it. The map here is the contract: a new guide needs a
row, which is the moment somebody has to think about its tags.

Content is asserted structurally only — a section exists, a condition is
stated. What a guide says is judged by a person, so HUMAN_REVIEW records the
reviewer, the criterion and where the receipt goes, and is itself checked for
rows nobody could act on.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 12

* feat(guides): the user's guides in the cloud

Third instance of the per-user S3 prefix styles and templates already use, so
"same as styles" holds on the remote too. The text always comes back: unlike a
style, whose description is its <title>, a guide's description and tags live in
the frontmatter, so there is nothing to list without reading the object.

An object that cannot be read comes back empty rather than being skipped, so
the merge reports it against its key. A guide that disappears silently is the
failure this collection exists to prevent.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 13

* feat(agent): a prompt part may call one tool with what another returned

Which guides a role must read is decided by the collection, and a user
extends that collection, so the prompt configuration cannot name them. It can
now name the question instead: read whatever the entry tool reported as
mandatory. A Source inside another Source's args is resolved first and
substituted, sharing the run's memo so a sibling pick of the same tool does
not fetch it twice.

_process_cache_key's classification rule is untouched; it only gains a
representation for args that hold a nested source, so two parts differing in
the inner source cannot share a cache entry.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 14

* feat(guides)!: list_guides, and read_guides over the collection

Nothing enumerated the guides: the only list anywhere was a FileNotFoundError
message, so a guide was reachable only by being named. list_guides answers
which guides exist, what each decides, and which ones a role must read.

read_guides keeps its name and its names parameter — no role or mode selector
— but resolves through the merged collection, so a user's guide is readable by
the identifier the listing showed. Its return becomes {"guides_text": str}:
one representation rather than a list that carries each body once more, and a
single string is what a system prompt can hold, since a picked list of objects
reaches it as JSON with the newlines escaped. The block headings carry what
documents' name carried.

The 30-guide catalogue leaves read_guides' description with it. A description
fixed at import time could never have carried a user's own guides.

Both surfaces expose the same guide tools, parameters and return shapes; the
remote binds its own pair so they read the caller's S3 guides.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 16

* feat(guides)!: the entry payload names its mandatory guides, not their text

static.slide_spec and static.deck_spec are gone. A start_* success return now
carries must_read — the names the collection says this role has to read — and
listing, and nothing else about guides.

The payload is a tool result, and a client files a result past 30,000
characters and shows the model only its ends. Carrying the bodies made that
limit depend on the collection's contents: about 4,000 characters per guide,
on a payload whose deck part already takes 14,000, which put a composer with
three slides at 30,750. A name costs 15, so it stops growing.

The AWS stack still receives the bodies up front, because a system prompt has
no such limit: its parts ask read_guides for whatever that role's entry call
called mandatory, naming no guide, so a user's own always guide reaches it too.
An interactive client reads must_read and calls read_guides itself; the four
role documents now say so.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 15

* feat(guides): create, rename and delete your own guides on the hosted service

"Same relationship as styles" has to include making one, so guides get the
same four endpoints the styles have, minus the pin they do not have.

A guide is validated when it is written, which styles do not need: a style
that fails to parse degrades one deck's look, while a guide that fails to
parse is left out of every hand-over, so the author would not find out until
they inspected a listing. One guide_meta call covers the name, the frontmatter
and the 64 KiB cap in the order the engine defines, and the write is refused
with the cause named.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 17

* feat(guides): reach the guide endpoints from the Web UI

The three places the style endpoints are reached from, for guides: a route
under api/guides/ for local mode, client functions in deckService for the
hosted service, and a row in the cross-site registry so the POST refuses
another site before touching the disk.

The name rule is the engine's, not the style route's: a guide name admits any
single path component without a dot, so 社内標準 works where the style route's
[a-zA-Z0-9_-]+ would refuse it, and acme.v2 does not, because a guide name is
also the key a caller passes back from a listing. No pin functions.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 18

* feat(guides): the outline opens with why that structure was chosen

A reader of specs/outline.md had to reverse-engineer the sequence from the
slides. The orchestrator now names the backbone it took from story-line, the
audience condition that chose it, and what it decided against.

The instruction lives in orchestrator.md, where the outline's content is
specified, so it holds whichever structure guide is in use. It has to be prose
or a heading before the first slide line: an indented `- key: value` line is
read by _SUB_ITEM_RE as a slide's sub-item. No parser changes — the three
outline readers already tolerate leading prose.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 19

* test(guides): pin what this design deliberately did not build

The superseded design made structure and writing resource types of their own,
each with a directory, an environment variable, a listing tool, a default and
a copy written into the deck. A second way to reach a guide is how the tool
surface grew last time, so every symbol, state key, environment variable and
endpoint of that design is asserted absent — across the Python sources and the
Web UI both.

Also pinned: no role document is a collection member, selection carries no
language anywhere, and a deck's specs/ gains nothing from any start_* call.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 20

* docs(guides): record the feature and its three breaking changes

Three published surfaces change at once — static.slide_spec and
static.deck_spec are gone, read_guides returns one text instead of a document
list, and the guide storytelling-vocabulary is now story-line — and a caller
finds that out from here. Each removal is recorded beside its replacement, and
a test parses ## [Unreleased] and asserts so, including that writing-ja keeps
its name and that no line still presents a removed key as current.

The deck-json-spec entry of the same section said start_presentation returns
it as static.deck_spec; it names it in must_read now.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 22

* fix(guides): address the cumulative review's blocking findings

The nested source was resolved through the process cache, which is written
before the outer call. A failed read_guides left the names behind, so the next
turn asked for guides the collection no longer held, resolve_parts aborted the
whole part list, and the agent ran with an empty system prompt. It resolves
uncached now; the outer source's own entry still covers the repeat call.

GET /guides ignored ?role=, so a role-filtered listing returned everything.
A description had no length cap, and one 60,000-character description would
have blown the listing the entry payload was restructured to protect. The
TypeScript name rule was weaker than the engine's, so the UI could create a
guide that never applied. The CLI still read only the bundled directory, which
left a user's own guide invisible to it and made SKILL.md's claim that the
subcommands match the tool names false; it reads the collection now and
list_guides is a subcommand.

Also: the remote checks deck access before building the collection, the
composer payload is built after the four failure branches, and a guide name is
trimmed, bounded and free of control characters on both sides.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: review round 1

* feat(guides): writing-a-guide covers add-vs-replace, and bringing a document in

Nothing in code compares a new always guide against the ones a role already
carries. Name shadowing is the only automatic resolution; two guides with
different names and always on one tag both load, and the per-role mandatory
text has no cap — the 64 KiB cap is per guide, not per set. The sum arrives in
one read_guides call that a client stops showing in full past about 30,000
characters, and the bundled sets already use 8,000 to 12,500 of that. So the
author needs the step and the numbers: read the role's mandatory set from
list_guides, then decide whether to add a name or take an existing one.

The new section covers the other direction — one document the user already has,
written for a human or another agent, that has to become several guides. The
split test is the one already in the document: mark each part with who reads it
and when. Plus what not to carry over, which is where a migrated document
otherwise adds a paragraph that contradicts the slide format a release later.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 23

* fix(guides): verify keeps only the claims that can be false

It had collected preferences, which is the one thing it exists not to do. "A
decoration that asserts nothing is noise" is minimalism, and it calls the
bundled neo-brutalist, duotone and bento styles wrong. The icon paragraph was
the same in the other direction. The colour-count row is design-rules'
subject, the connector-endpoint row is already in visual-forms' Checks, and
the alignment row was taste with a truth-shaped sentence around it.

Every form rule is now conditional on the slide actually encoding that thing,
and the section ends by saying so: where the content encodes none of them, the
shape is free and the style decides how far to take it.

The claim rule no longer assumes the headline carries the claim — writing-ja
describes styles that put a topic there and the claim in a lead line, so it
reads "whatever carries the slide's claim" and leaves which to the style.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 23 (review of the authored content)

* feat(guides): story-line carries the outline design, not just the backbone

verify checks a slide; nothing checked the sequence. The outline had no check
of its own, and that was the gap the two sources exposed. The checks read in
the same sitting as the backbone, so they belong here rather than in a guide
of their own.

Added, in the order the work happens: who to write for — the six gaps between
presenter and audience, and the instruction to design for the least attentive
audience the brief admits; how many slides, with the three bands, the
30-second floor and why both bounds matter; what the opening owes, including
that it has to carry the deck's point on its own; six ordered outline checks,
where a failure high on the list is not fixed by anything lower; and four
destinations for material the line left out.

Sources: 森畑明昌「良い発表をするために」(graco.c.u-tokyo.ac.jp) and 久松英治
「パワポ外科医が教えるスライドデザインのコツ」日児腎誌 2024;37:111-116. Every
point was checked against the bundled guides first — whitespace, colour count,
WCAG contrast, not relying on colour alone, type hierarchy and size floors are
already in design-rules, and the real font names are in workflows/style.md.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 24

* 📝 docs(guides-as-one-tagged-collection): say where a Japanese line may break

Japanese slides broke in the wrong places and writing-ja had no rule about it.
The builder already sets lang="ja-JP" on every CJK run, so kinsoku is automatic;
what the author controls is the length of a line and the breaks they insert, and
that is what the new section states. A manual break is tied to the font size and
box width it was written against, so it is sent to measure_slides.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 25

* 🔒 fix(guides-as-one-tagged-collection): mark the retired-path assert as not a /tmp use

The ASH scan job failed on this branch while passing on main. bandit B108 read
`assert "/tmp/sdpm" not in text` as hardcoded temp-directory usage; the line
asserts the path is absent from the guide. Inline nosec, as the repo does in 39
other places, keeps the suppression on the one line instead of the whole file.

Red: uvx bandit -q -r tests/test_bundled_guides_contract.py -f json
     -> B108 MEDIUM/MEDIUM at line 363; after: 0 non-B101 findings

SPEC: 20261127-1707_guides-as-one-tagged-collection

* 🔒 fix(guides-as-one-tagged-collection): keep a guide read inside the result budget

A guide bigger than one tool result was reported valid and then arrived
truncated, because the per-guide cap (64 KiB) was chosen without reference to
the budget (25,000) and the budget lived only in a test. Two routes hit it: a
user guide claiming always, and read_guides called with any big name — that
function had no size check at all.

The budget is now the engine's own constant and the per-guide cap is derived
from it, so a guide that passes validation fits one read by construction. The
read fills to the budget in spec-first order and names what it left, so a
caller can ask again instead of silently losing the format spec. One function
carries the rule for the local tools, the CLI and the remote server.

Red: read_guides(['grid','table','verify']) -> 2 guides + table deferred,
     18,756 chars; before: 3 guides, over 25,000 and filed away by the client

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 26

* 📝 docs(guides-as-one-tagged-collection): say what the size cap is for, and cut vs split

The cap was documented as 64 KiB "because its body goes into a system prompt",
which does not explain the number: the composing surfaces have no result limit,
the read does. The real reason is that a guide has to arrive in one read_guides
result, and stating it makes the number self-explaining.

Length also needed an answer. Cursor and Claude Code both answer it with
"split", and both have a cheap first read through progressive disclosure that a
guide does not: a guide is handed over whole. So here length is a reason to cut,
and an author arriving from either tool needs that difference said out loud.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 27

* 🔒 fix(guides-as-one-tagged-collection): warn on a lossy shadow, bound the read, refuse a bad body

Three gaps in code this SPEC added, all reachable from the user's own
directory or request.

Shadowing was the one way to make a role lose a guide with no error anywhere:
taking a bundled name without its always or one of its tags leaves the role
reading that name and no longer receiving what it asked for. The merge now
parses the shadowed entry to compare and reports what no role gets any more.
Saying the same thing differently, which is the point of the feature, stays
silent.

The reader took whole files before the size check saw them, so a stray file of
any size in the guides directory was read on every start_*. It now takes one
character past the cap, which is enough to reject it on size and reports the
same cause.

POST /guides/user read name and text off whatever arrived, so a JSON array or
string raised AttributeError and came back as a 500 instead of a 400.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 28

* 📝 docs(guides-as-one-tagged-collection): document user-local guides

The feature shipped with no user-facing documentation: a reader had no way to
learn where to put a guide, what the frontmatter accepts, or why one of theirs
was not being read.

It goes beside User-local styles and User-local templates, in the same shape, so
it reads as a sibling rather than a new dialect: the three-step search order,
both platforms' config directory, and shadowing by name.

Three things nothing else will tell a reader get their own space. An
unrecognised frontmatter key is an error here, which is the opposite of what a
reader arriving from a tool that ignores unknown keys expects. A field table
with required/default per key, because the closest comparable docs omit one and
leave the reader to infer it. And a table of always x tags against what the role
actually does, since those two keys are the whole loading rule.

A test pins the numbers and the tag vocabulary to the engine's own constants.
The cap moved once already in this branch, and a documented cap that is not the
cap is worse than none.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 29

* 📝 docs(guides-as-one-tagged-collection): record the size rule and the shadow warning

The CHANGELOG described the feature as reviewed, without the two rules the
review added: what bounds a guide's size and what happens when a shadow loses
something.

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 29

* 🔒 fix(guides-as-one-tagged-collection): carry what the budget shed into the text itself

The Agent surface composes a system prompt and keeps only guides_text, so the
note naming a shed guide reached that model as nothing at all. Before the read
had a budget it got every mandatory guide whole, so this round introduced it: a
model told to read a guide it never receives, with nothing saying so, is the
silence the budget work exists to end.

What was left out is now said twice — under not_included for a caller reading
the keys, and at the end of guides_text, so it travels wherever the text does.
The fill measures the complete payload, so the note is inside the budget it
reports.

Two more of the same class, both in code this SPEC added. A start_* listing
built its own dict and so never carried the shadow warning, which is the only
place that warning is ever seen: a role has no reason to call list_guides.
And the non-object body check was not enough for POST /guides/user, because
guide_meta works on the text, so a non-string field still reached it.

Red: composer-pptx prompt with a 13,400-byte always user guide -> house-rules
     absent from guides_text and unmentioned; after: named under # Not included

SPEC: 20261127-1707_guides-as-one-tagged-collection
Task: 30

* ✨ feat(guides-role-declares-what-to-read): declare each role's mandatory guides in its workflow document

A guide's frontmatter is a file a user can replace by taking its name, so
"every composer must read slide-json-spec" was a statement the project made
in a place the user owns. The workflow documents are static and
user-independent, so the declaration moves there, in one exact form a test
can read and tell apart from the conditional read_guides pointers the same
documents already carry.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 1

* ♻️ refactor(guides-role-declares-what-to-read): read guides on the Agent surface the way a client does

This surface used to resolve guide bodies into the system prompt from the
names start_* called mandatory, so a guide reached a hosted model as prompt
text and an interactive client as a tool result. The role document now names
what to read, so one mechanism serves both; the listing stays, because it is
the only thing that can name a guide the user wrote today.

read_guides joins the style role's tools: without the pre-load it was the one
role with no route to a guide at all.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 2

* 🔥 refactor(guides-role-declares-what-to-read): drop the nested-source support with its only caller

A Source.mcp's args could hold another Source, which existed so the Agent
surface could call read_guides with the names start_* reported mandatory.
That caller is gone, and nothing else in the tree nests a Source, so the
resolution, its cache-key branch and the use_process_cache escape hatch go
with it. The inner call also had to opt out of the process cache, or a failed
outer call pinned stale names; that hazard leaves too.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 3

* 💥 feat(guides-role-declares-what-to-read)!: stop returning must_read from start_*

BREAKING CHANGE: start_presentation, start_composing, start_style and
start_translation no longer return must_read. Their guide payload is listing
alone. What a role must read is named in its workflow document, which arrives
under static.workflow in the same return.

always_guides is deleted with it: nothing computes a mandatory set from the
collection any more, so a user guide cannot gain or lose that status by taking
a bundled name. context_size.py stops reporting a separate mandatory-bodies
item, because no role's prompt holds those bodies.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 4

* 💥 feat(guides-role-declares-what-to-read)!: remove always from the guide frontmatter contract

BREAKING CHANGE: a guide's frontmatter keys are description and tags. A guide
carrying always is invalid under unknown-key, so the author is told rather
than having the line silently ignored. Nothing was released with it.

Setting always on a bundled guide meant copying the whole file into your own
directory, which froze its body: one frontmatter line cost every upstream
change to that guide. With the key gone, the only reason left to take a
bundled name is to replace what it says.

read_guides fills by source instead: bundled guides first, then the user's,
each in name order. The reason is the one the always flag used to carry — a
bundled guide is the project's document and a user's is their preference, so a
preference is what sheds.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 5

* 💥 feat(guides-role-declares-what-to-read)!: show the user's own guides in their own listing block

BREAKING CHANGE: a listing returns user_guides and bundled_guides instead of
one guides list, and an entry no longer carries source — the block it is in
says it. list_guides, GET /guides and every start_* listing change shape.

A role reading 31 entries in name order could not see at a glance which three
were the user's, and those are the only ones no role document can name. The
user's block comes first for that reason. Dropping source also takes a field
off all 31 entries in a payload that rides inside every start_* return.

The CLI prints the two blocks under their own headings, with a test: nothing
covered that function before, so the field change would have broken it with
every other check still green.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 6

* 📝 docs(guides-role-declares-what-to-read): say how a guide of yours gets read

writing-a-guide pushed the opposite way: it told an author to take a bundled
guide's name rather than add a second name beside it. That is the expensive
move now — it replaces the text and every later change to it stops arriving,
with nothing reporting the fact. Both halves are stated, including the half
that does not freeze: the set of guides is recomputed every call, so a guide
the project adds later still arrives.

What makes a guide of yours reach a role is its description, so the section
says to write the condition into that line rather than only the subject.

docs/en drops the always row and the always behaviour table, and says where a
role's mandatory reading is declared instead — a reader who finds no flag
would otherwise go looking for the missing key.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 7

* 📝 docs(guides-role-declares-what-to-read): describe the shipped design in the tools and the CHANGELOG

read_guides told the reader its names come from a start_* call's must_read,
which no longer exists; they come from the role document or list_guides.
list_guides says it returns the user's guides first, which is what the two
blocks are for.

The CHANGELOG entry is rewritten rather than corrected, because none of this
was released. always and must_read now appear only under Changed, as keys that
are gone: a Breaking note has to name a key to say so, while a key named in
Added would read as part of the design.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 8

* 🔒 fix(guides-role-declares-what-to-read): close the cumulative code review

compliance and craft between them found seven places where the work did not
hold itself to its own design.

The declaration line was the worst: all four documents appended prose to it
and the regex had no end anchor, so the contract test could not enforce the
form it existed to enforce. The declaration now ends its line and the regex is
anchored at both ends. _declared also accepted unquoted names, which is not a
call any caller could copy, so it parses the list as JSON now.

The REQ-2.2 mapping had been copied into two more test modules, which is the
second source of truth design.md declines; both copies now read the real
declaration. _bundled_first's name tie-break was unpinned. The Agent fixtures
still returned the one-block listing, and one test asserted the obsolete key
reaches the prompt. Six contract statements still described the hand-over this
SPEC removed.

Every fix is verified by the mutation that exposed it: see fixes-code.md.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 8

* 🔒 fix(guides-role-declares-what-to-read): make the declaration one literal line, with no optional part

The adjudicator was right that round 1 only half-closed this. The prose moved
off the line, but two documents kept the `- ` list marker and the regex still
accepted it — so the pattern had an optional part REQ-2.4 does not define, and
the contract test went on accepting a form outside the recorded decision.

The declaration is now a standalone paragraph leading its section in all four
documents, and the regex is anchored start to end with nothing optional.
Verified: putting the marker back makes the contract test fail.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 8

* 📝 fix(guides-role-declares-what-to-read): stop describing the hand-over in writing-a-guide's own description

Its description still read "when a guide is handed over automatically" — the
mechanism this SPEC removed, in the frontmatter of the guide that teaches the
frontmatter. The body was rewritten in task 7; its own description was not.

Found by reading the 31 descriptions for the same stale references the code
review caught in the docstrings. No other description mentions must_read,
always or the hand-over.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 7

* ✨ feat(guides): put taste and engine facts on the right side of the line, and say which guide wins

Four things the design made visible once `always` was gone.

**Which guide wins was stated nowhere.** A bundled taste guide and a guide of
the user's own are both read, so a model reconciled a direct conflict with
nothing to go on — measured: `writing-ja` says to use 「。」 and a user guide
saying not to arrived in the same read_guides call. All five role documents now
say to follow the user's, excepting the slide format and verify's checks, which
are not preferences. Identical wording in all five, asserted.

**Note writing was taste inside the format spec.** "Use conversational
language", "include questions and calls to the audience" are preferences, and
they sat in `slide-json-spec` — 11 commits in 90 days — so disagreeing meant
taking that name and freezing the slide format. Worse, the HTML composer never
reads that guide, so an HTML deck got no note guidance at all. Now a
`speaker-notes` guide tagged composer and translate: both modes get it, and
replacing it costs nothing else. The spec keeps the two layers and the field.

**The wrapping facts were the same mistake pointing the other way.** Kinsoku
being the build's job and measuring a hand-written break are statements about
the code, and they sat in `writing-ja`, the guide that exists to be replaced.
They move to each format guide's **Where a line breaks**; the Japanese guide
keeps where to cut.

**An HTML deck did not carry its language.** `assemble_deck` has a `lang`
parameter and no caller passed it, so every HTML deck was emitted as `<html>`
whatever `deck.json` said — while the PPTX build sets a run's language for CJK
text. deck.json's `language` now becomes `<html lang>`.

writing-a-guide gains the step it never had: read the guides that cover your
ground, in full, before writing one — the listing's one line per guide is
written to help a caller decide whether to read, not to tell an author whether
the rule already exists. It also gains the case `always: true` used to serve (a
guide that applies to every deck gives no condition) and loses four stale
references to the hand-over.

SPEC: 20261201-0903_guides-role-declares-what-to-read
Task: 10

* 🐛 fix(guides): correct the facts a four-axis collection review found wrong

A review of the 32-guide collection on four axes — structure, duplication, description
and tags — returned 37 candidates. These are the factual errors among them; the ones
that ask for content to move between guides are a decision, not a correction, and are
not in this commit.

Two were introduced by the taste/engine split in 59d0d12a:

- `deck-json-spec` still said `language` was PPTX-only, one commit after the same
  branch wired it to `<html lang>`. The orchestrator writes that field and reads that
  guide, so an HTML deck in Japanese would have been emitted with no language for the
  browser to break lines by — the exact case the change was made for.
- `writing-ja` kept the generic "notes are a script read aloud" rule that `speaker-notes`
  now owns, in its opening and again under 文体. It keeps the Japanese narrowing (常体 /
  敬体, the spoken register) and points at `speaker-notes` for what notes are.
- `slide-json-elements` redefines `autoWidth` and `\n` that the new **Where a line
  breaks** section owns, in different words ("word_wrap disabled" against "the box grows
  instead"). It now names the fields and points there.

`verify` was named by every role document's precedence paragraph as non-overridable,
including translation's, while being tagged `composer` — which no translate listing
intersects. A translation can change a number, reword a quote or drop a hedge and still
build, so it is now on the translate role's mandatory line and tagged for it.
`test_a_role_can_reach_what_it_declares_mandatory` closes that hole: the declaration and
the tags live in different files, and nothing compared them.

`writing-ja` is listed for translation for the same reason. The role is told that
measurement does not catch unnatural line breaks in the target language, and the
collection's rules for where Japanese may break were unreachable from it.

`design-rules` put the 16:9 content area at y=143 where `grid` and `slide-json-spec` both
derive y=173 (title bottom 142 + margin 31). A composer reading the design guide placed
content 30px into the title margin.

* ✨ feat(guides): reserve the four names a guide of the user's own cannot take

Every role document says a guide of the user's own does not override the slide format or
`verify`'s checks. Nothing enforced it. Resolution is user-first for reading as well as
for listing, and `_shadowing_loss` only warns when the winner drops a tag — so a faithful
copy of `slide-json-spec` carrying the same tags was silent, won the name, and was what
the role's own mandatory read then returned. A stale copy would have outranked every later
correction to the format the build enforces, on the one read a role cannot skip.

`deck-json-spec`, `slide-html-spec`, `slide-json-spec` and `verify` are now refused from
any source but `builtin`: reported `reserved-name` in the listing, and refused at write
time by the API so the author hears it while they can still choose another name. The line
is the one the role documents already drew — the deck and slide formats, and the checks.
Replacing taste is untouched, `story-line` included: it is mandatory for the orchestrator
and a user who disagrees about how a deck should be structured may still say so.

Found by a four-axis review of the collection (structure #1, confidence 100).

`TestTheReservedNames` covers the case no warning could: the same text with the same tags
on both sides, which produces no shadowing warning at all. Mutation-checked — disabling
the branch fails 6 of its 9. Two existing shadowing tests used `verify` as their example
and now use `table`, which is the same shape and is taste a user may legitimately replace.

* ♻️ refactor(guides): give reading a style off a PPTX its own guide

`style.md` sent the style author to `read_guides(["import-pptx"])` "when the reference deck
should be inspected slide by slide". `import-pptx` opens by telling exactly that reader to
stop: it is the edit branch, and for reference material it says to go back to the briefing
flow. The lenses they actually needed sat 258 lines past that refusal.

And the style contract restated around them had drifted. Step 5 asked for "5-6 demonstration
slides (cover, palette / type ramp / component swatches)" with placeholder copy like
`Cover Title` / `Body sample`, while `style.md` requires Cover, Rules, Message & Outline,
seven named Patterns, a divider and Closing, and says in as many words that nothing in a
style is a specimen sheet. The same guide contradicted itself: its own 5-3 already said not
to write that placeholder copy. Following the parts a reader met first produced the wrong
`art-direction.html`.

New `style-from-pptx` (tags `style, orchestrator`) owns the part that is genuinely about
reading somebody else's deck: Lens B for what the theme declares, Lens A for what each thing
is for, Lens C for what the deck spends its surface on, and the table saying which lens a
given token may come from. Rewritten rather than moved — the extracted text referred to
"Step 2" and "Step 4" of a workflow its new reader never runs, and still called the style's
slides demonstration slides.

`import-pptx` Step 5 is now the two pointers and what is import-specific about them (the
bundle's template for Lens B, the previews Step 4 already built for A and C). It restates
none of the style contract, which took it from 22,375 bytes — 93% of the 24,000-byte
per-guide cap, with 1,625 to spare — to 11,645, and its tags drop `style`.

Found by a four-axis review of the collection (structure #4 ≡ duplication #8, both at
confidence 100).

* ♻️ refactor(guides): put each guide where its format applies, and taste where both modes see it

The taste/engine line this branch drew held in two places and not in ten more. A four-axis
review of the collection found them (structure #5-11,13 · duplication #1,4,5 · tags #1,2,3).

**A slide-JSON contract behind `composer`.** `table`, `arch-elements` and `arch-layout-engine`
describe a slide-JSON element or the `arch_diagram` tool's input, under descriptions that match
any HTML table or diagram, and `composer` is both composer modes. An HTML composer reading
`table`'s 287 lines gets `colWidths` and `cellOverrides` for a slide that has neither. All
three are `composer-pptx` now, with descriptions that say which format they are for.

**The mirror image in the chart guides.** `composer-pptx` hid what is true of any chart: six
pie slices, two unstacked area series, one scale per chart, three to eight radar spokes. An
HTML deck draws charts with the bundled ECharts and D3, so the HTML composer could produce a
valid chart nobody can read. New `chart-choice` (`composer`) owns which chart the data calls
for and where a chart stops being readable; the five type guides stay the slide-JSON field
reference and point at it. Both composer workflows now name it.

**Nine chart fields stated five times, already disagreeing.** `axisColor` and `axisWidth` were
listed under area and bar but not line or radar, so a composer could not tell an unsupported
field from an uncopied one. Read in the implementation: those nine are taken from `style` with
no `chart_type` guard at all, while `gapWidth`/`overlap` are guarded to bar and
`lineWidth`/`markerSize` to line and radar. The nine are now in `slide-json-media`, which owns
the `chart` element, saying in as many words that a per-type guide lists only its own.

**`design-rules` becomes the format-neutral design home.** It no longer says "pt is an absolute
unit … No scaling needed" — that is the PPTX build's behaviour, and this guide reaches the HTML
composer, where a point token needs `calc(var(--fs-x) * var(--sdpm-pt-scale))`. It gains the
table treatment that `table` stated through slide-JSON field names, and the block sizes and
vertical fill that `slide-json-spec` was carrying: now that the format spec's name is reserved,
a preference stated there is exempt from the precedence rule *and* impossible to replace.

**The four rules under any drawn diagram** — along a grid, symmetric where it branches, one
spacing value per kind of gap, hierarchy drawn rather than implied — move from `arch-elements`
to `visual-forms`, which the HTML composer and the style author also reach. `visual-forms` now
says outright that its recipes' geometry holds in either format while their preset names are
slide JSON's.

**Three more copies removed, each read by the same reader as its original.**
`slide-json-effects` recommended a use for every effect beside `design-rules`' own list;
`slide-json-media` restated `freeform`'s coordinate system and command set for a reader it
then sends to `freeform`; `source-material-guide` restated `attachments`' bundle paths and
return fields; `slide-html-spec` restated the interaction policy `composer-html.md` carries on
every job, inside a guide whose name is now reserved.

Declined, with reasons, in the SPEC notes: splitting `grid` (both its readers need both
halves — you call `grid()` because you are deciding a layout) and stripping the actor and
timing from `deck-json-spec`'s fields (a field reference saying who writes a field is part of
the field's meaning, and its other readers are the importer and the translator).

* 📝 docs(guides): make each description say what the guide decides and when to read it

The description is the whole of what a caller sees before spending a read. Nothing in the
code picks guides for them — not the deck's language, not its audience, not its template — so
a description that misleads costs either a wasted whole-file read or, worse, a guide that is
never read when it was needed. A four-axis review of the collection checked all 34 against
their bodies (description #1-9).

Five that named a situation that cannot happen, or none at all:

- `design-rules` and `design-vocabulary` said "read during art direction phase". Only
  composers can see `design-rules`, and a composer is handed an art direction already frozen
  — the phase has passed before its only reader exists. A composer following the description
  skips it on every slide that needs its colour, type, effect or whitespace decisions.
  `design-vocabulary` is also used while writing an outline's `visual`, which `orchestrator.md`
  says in as many words.
- `hand-edit-sync`: "Phase 4: Sync after hand-editing (only when requested)". The body
  requires the sync whenever the user hand-edited and then asks for more changes, before any
  further edit. Read as opt-in, the next build regenerates over their PowerPoint work.
- `grid`: "read before placing elements" for a guide that subdivides rectangles. A composer
  reads 356 lines before a freeform or a radial arrangement it cannot help with.
- `attachments`: a list of subjects with no situation, so an orchestrator can take attachment
  handling as covered by its workflow and miss the byte-offset paging, the immutable bundle
  path, and the retry an `IMPORT_INCOMPLETE` needs.
- `aws-design`: "AWS-specific design conventions" promises the whole topic; the body answers
  which asset source to search and which category colour to use.

`table` and the five `chart-*` descriptions now say which format they are the reference for,
which is what their retagging in the previous commit means for a caller reading the listing.

`writing-a-guide`'s own text on `management` is rewritten rather than its tags. The reviewer
read "No role picks it up … this guide is one" as saying its `orchestrator` tag was a mistake.
The sentence was about the tag, which is accurate — no role's set contains `management` — but
it reads as being about the guide. `hand-edit-sync` carries the same pair and needs its
orchestrator reach, so the rule is that `management` is carried beside the role tags of
whoever acts on the guide, and `test_management_is_carried_beside_a_role_tag_never_alone`
holds all three to it.

* 🐛 fix(guides): finish the moves the first review's fixes left half-done

A second four-axis review of the collection returned 21 findings, 18 of them marked
REGRESSION — introduced by round one's own fixes. That is the shape the SPEC review of this
branch took too, where all seven round-two findings were regressions. Every claim below was
checked against the file or the implementation before acting on it.

**The HTML composer could not reach what was moved for it.** The four diagram rules went into
`visual-forms` so both modes would see them, but that guide's description still said "in slide
JSON" and `composer-html.md` never named it, while `composer.md` did. A non-mandatory guide is
found by its description or by a pointer, so the one reader the move was for had both routes
closed. Description rewritten, pointer added.

**Retagging `arch-elements` to `composer-pptx` stranded rules that are not the format's.** Two
reviewers found it independently. Scale by node count, orthogonal-only routing, and a label
beside the connector rather than on it are about how a diagram reads; the AWS Cloud boundary,
its flush logo and the disc under a boundary-straddling icon are AWS conventions. An HTML
composer draws the same diagram in HTML and SVG and had none of them. The first two groups are
in `visual-forms` now, the AWS ones in `aws-design`, and `arch-elements` keeps the slide-JSON
form of each. Two of the four rules it had already handed over were still asserted in its own
text and checklist; those are gone.

**The chart extraction stopped halfway.** Every type guide still opened by choosing the chart
("Bar charts … for comparison data") for a reader who has just read `chart-choice`, and still
held the renderer-independent treatment: series order on an area, the small-segment threshold
on a stacked bar, whether a trend is smoothed, shares against amounts on a pie, the donut's
total, the radar's rings against the scoring scale. `chart-bar` claimed the readable limits
were in the guide HTML can reach while stating one itself. All six are in `chart-choice`;
each type guide now opens `Fields for chartType: "…"`.

`title`, `titleFontSize`, `titleFontColor` and `numberFormat` were copied into all five type
guides. Read in `sdpm/sdpm/engine/builder/elements/chart.py:86,217-218`: no `chart_type`
guard, exactly like the nine in `style`. Stated once in `slide-json-media`.

**`chart-choice` reaches the orchestrator now.** It writes the outline's `visual` naming the
chart — "a bar chart of X by Y" — so it makes this decision before any composer sees the
slide, and could prescribe a nine-slice pie. Its pointer for exact row-wise values said "the
format's table guide"; there is only one, tagged `composer-pptx`, so an HTML reader was sent
to a guide its listing does not contain. Now named per format.

**Reserving four names made two preferences unreplaceable.** "Write `notes` before `elements`"
is a way of working — key order means nothing to the build and `notes` is optional — and it
sat in `slide-json-spec`. Whether an audience handout carries the notes is the user's call,
and it sat in `deck-json-spec`. Both are in `speaker-notes`, which is tagged `composer` and
`translate` and can be replaced. The reviewer also named the test that was holding the first
one in place: `test_the_pptx_spec_keeps_the_two_layers_and_drops_the_writing_advice` asserted
the sentence was there. It now asserts the layers without the method, and two new tests assert
each preference is where it can be disagreed with.

**`grid`'s first step was PPTX-only** inside a guide that reaches both modes and the style
author. It said to call `analyze_template`; an HTML composer already holds `template_html`,
whose layout names are its source of truth, and a style author has a 1920×1080 canvas and no
deck template at all. Step 1 now branches three ways; steps 2 and 3 are unchanged, because
once you have an area its division is arithmetic.

**Four residues of the earlier moves, each read by the same reader as its original.**
`writing-ja` kept "notes are written in spoken sentences only, with no Markdown" — language-
neutral, and already contradicting `speaker-notes`, which requires a `---` separator before
the reference URLs, so a Japanese deck had to break one of the two. `slide-json-elements` kept
statement-plus-pointer where a pointer was the point. `import-pptx` restated `style.md`'s
skeleton and its save order, and restated `--color-bg`'s provenance **disagreeing** with
`style-from-pptx` (Lens A + C against Lens B confirmed by C) for a reader it sends to that
guide. `design-rules`' rewrite added a sixth copy of the user-guide precedence rule that the
five role documents own and a contract test holds identical; it now states only that the
applied style outranks it. `slide-json-media`'s description still promised the freeform
contract it had handed over and said nothing about the chart fields it had taken on.

**One factual correction on the way.** `composer.md` said "the renderer has no emoji fonts".
Commit `1cd551cf` says the opposite in its own message: the built file keeps the character and
the host rendering the preview is the one with no emoji face. Both that line and
`design-rules`' "render inconsistently across platforms" now say what was measured. The rule
stays where it is — a style's call, defaulting to none — which is the ownership already settled
in `39b49aee`.

Declined, with the reason in the SPEC notes: moving the no-emoji rule out of `design-rules`
into the role documents or the format specs (duplication #9). Its premise is that this is a
renderer limit; it is not, and that ownership question was settled against exactly this change.

* 🐛 fix(guides): close the write paths and the body path the reservation missed

A code review of the reserved-names change found 7 problems, 6 Major. Three were
demonstrated by mutations that survived the whole suite at 4,178 passed, which is the only
kind of test finding worth acting on without argument. All three now fail.

**The reservation covered one write path of four.** Cloud `POST /guides/user` refused a
reserved name; cloud `PATCH /guides/user/<name>` did not, and it put the new key and then
deleted the old one. Measured: renaming `mine` to `slide-json-spec` returned
`{"renamed": {...}}`, the working key was gone, and what was left was reported
`reserved-name` by every collection and read by none — a call that said it worked destroyed
the guide. The local Web UI's POST and PATCH accepted all four names the same way, and that
surface has no caller rendering the collection's `invalid` list, so the author heard nothing
at write time and nothing afterwards either.

All four paths refuse it now. The Web UI keeps its own list of the four, mirrored the way
`guideName.ts` already mirrors `is_guide_name` and compared against the Python tuple by
`TestTheWebUiMirrorsTheReservedList` — two lists that must agree with nothing comparing them
is how they come apart.

**`format_notes` was a guide-body read that bypassed the collection.** `init_deck_workspace`
returns the `html-deck` body as `format_notes`, read straight out of the bundled directory.
Measured with a user `html-deck` installed: `read_guides` returned theirs,
`collection_source` was `user`, and the init payload returned the bundled body. One payload
handed the orchestrator a body no other surface would give it, and nothing reported the
disagreement — the user-first rule this whole branch rests on, broken in the one place
nobody looked. It resolves through the caller's collection now.

The collection is passed as a callable, not as a value. Building one on the remote is an S3
listing, and a PPTX deck has no format notes at all; built as an argument it ran on every
init and broke seven remote tests that never touch guides, which is the same waste showing
up as a failure.

**The source label was trusted with no boundary.** `build_collection` refuses a reserved
name unless the group is labelled `"builtin"`, and `select_guides` shows a group as the
user's unless it is labelled `"user"` — two rules reading one free-form string. The
demonstrated mutation relabelled the remote's user group `"builtin"`, which makes the user's
copy of the slide format win, and the suite stayed green. `GUIDE_SOURCES` now bounds the
label, and `TestTheProductionBuildersLabelTheirGroups` asserts the three production builders
label their user group `"user"` and that a reserved name in a user's S3 prefix loses to the
bundled body.

**Two of the tests this branch added proved nothing.**
`test_a_role_can_reach_what_it_declares_mandatory` intersected `BUNDLED` with `_ROLE_TAGS`,
so it showed only that two constants agree: a mutation excluding `verify` inside `_selected`
itself — the actual listing path — passed the whole suite, which is exactly the failure the
test's own docstring describes. It asserts against the real `guide_payload` listing now.
`test_management_is_carried_beside_a_role_tag_never_alone` never looked at a role's tags, so
adding `management` to the orchestrator's set left it green; the premise is asserted first.

**Minor:** three statements still said 33 bundled guides against 34 on disk. The CHANGELOG
and the exact listing test keep the number, because there it is a release fact and a
contract. The authoring guide and two selector comments lose it — a role's listing is
filtered anyway, so a fixed count was never the right thing to say there.

* 🔒 fix(web-ui): assert on the directory listing instead of a built path

The two reserved-name route tests failed the `scan` gate, both at HIGH:
`javascript.lang.security.audit.path-traversal.path-join-resolve-traversal` on
`path.join(dir, `${name}.md`)`. The name comes from `RESERVED_GUIDES`, a hardcoded tuple, so
there is nothing to traverse — but the rule reads an interpolated `path.join` and the gate is
the gate.

Asserting on `fs.readdirSync(dir)` is outside the rule and says more than the original did:
that no file appeared under that name, rather than that one particular path is absent.
`toContain` rather than `toEqual` because `beforeAll` leaves the symlink fixtures in that
directory for the containment tests.

* 🐛 fix(guides): hand each moved rule over completely, and stop testing for old wording

A third four-axis review of the collection returned 21 content findings, 18 of them marked
REGRESSION. Round 1's fixes caused 18 of round 2's; round 2's caused these. The shape is the
same every time and it is now clear what causes it: **a move that rewrites the old home's
assertion as statement-plus-pointer leaves the rule in two places, and a test that rejects the
old sentence passes against the same rule in new words.** Both are fixed here, the second by
rewriting five tests to assert ownership instead of phrasing.

**The notes-first method was in three places, not one.** Three reviewers found it
independently. `slide-json-spec` — a reserved name — still endorsed an order ("why it is
*usually* the notes"), and `slide-json-elements` still gave it as an instruction ("In actual
slides, write them before `elements`"). So replacing `speaker-notes` to work the other way
round left a PPTX composer ordered anyway, by two guides it cannot replace. Both are gone, and
the test now sweeps every slide-JSON guide rather than the one reserved spec.

**The handout choice reached every role except the one that can act on it.** `speakerNotes`
lives in `deck.json`, which the orchestrator writes, and `speaker-notes` was tagged
`composer, translate`. Measured by the reviewer against the live collection:
`speaker-notes=False` for `orchestrator`. It carries `orchestrator` now and its description
names the delivery decision, because the description is all a caller sees before spending a read.

**The `flipV` workaround landed in the guide that forbids it.** `slide-json-elements` says
"Labeled shapes — use `text`, never overlay a textbox", "**Do NOT** add a separate `textbox`",
and that the build warns when it finds one. Round 2 moved the funnel workaround — which is
exactly that — into it. The exception is stated in the rule now, including why the inset box is
not what the warning detects.

**"Never diagonally" stopped being true when it moved.** It was an architecture-diagram rule in
`arch-elements`; in `visual-forms` it governs every form, and that guide's own cycle recipe is
an arc and its hub recipe places spokes along the centre-to-satellite vector. Readers could not
follow both. Scoped to forms laid out on rows and columns, with radial forms named as the
opposite case. The contract test required the unconditional phrase, so it was holding the
contradiction in place.

**The AWS convention was in both homes, and the two already disagreed.** `aws-design` says the
boundary takes the slide's text colour; `arch-elements` hard-coded `"line": "#FFFFFF"`, so a
light slide got two different diagrams. The logo offset and the disc's 72→66 sizing were
duplicated too. `arch-elements` keeps the field mapping and names the owner; its description no
longer promises the boundary or the scale that also moved out.

**Three more residues**, each the same shape: the donut-hole total still recommended in
`chart-pie`; the bar-legend rationale added to `slide-json-media` beside `chart-choice`'s copy —
and overstated there as every single-series chart, where the implementation guards it to bar
and honours an explicit `legend: true` (`chart.py:353-355`); `style-from-pptx` restating
`style.md`'s skeleton in a five-part summary that is already incomplete beside its seven
required patterns.

**`grid`'s worked example contradicted the branch above it.** Round 2 made Step 1 name a
different source per mode, including "Do not call `analyze_template` for this" for HTML. Forty
lines later the Gantt example told every reader to call it.

**And the emoji correction missed the disjoint copy.** Round 2 fixed the composer's rationale;
`style.md` still said "the PPTX renderer has no emoji fonts" — the claim `1cd551cf` measured
false — and required every style to state "no emoji", which contradicts the ownership `39b49aee`
settled, where emoji are the style's call. Corrected to the measured mechanism and to a
position the style states rather than a prohibition it inherits.

Five tests rewritten to assert ownership: each had been passing against the exact defect its
name describes. Mutation-checked — restoring the `arch-elements` paraphrase, the `chart-pie`
recommendation and the unscoped routing rule each now fails the test that named it.

Declined and raised with the owner instead: splitting `visual-forms` into a form-choice guide
for the orchestrator and a drawing guide for composers (structure #7, 95). The `tags` reviewer
argued the opposite case in the same round — `orchestrator.md` already carries the
content-shape-to-form decision — so it is a design question, not a correction.

* 🐛 fix(guides): close the last body bypass, order the fallible call, and test the call sites

A second code review of this work returned 5 Major and 1 Minor, four of them demonstrated by
mutations that survived the suite. Every one is a consequence of the previous round's fixes.

**The `format_notes` fallback was the bypass the fix existed to close.** Round 2 routed it
through the caller's collection and then added `except FileNotFoundError: return
_read_reference(_GUIDES_DIR, name)`. Measured by the reviewer: an empty collection still
returned the 1,520-character bundled body. The comment's justification was false too — it said
an invalid user guide under that name could hide the valid bundled one, and an invalid entry
never wins a name. So there is no case for a fallback: the bundled guide is always in the
collection, and a collection without it is a broken invariant that should surface. Removed.

**The fallible lookup ran after the deck was already written.** Making `format_notes` resolve
through the collection made it fail on the remote, where it reads the user's guide store — and
`init_deck_workspace` called it after the deck record, `deck.json`, `specs/brief.md` and
`specs/outline.md` were all persisted. Demonstrated with a raising callable: all four writes
happened, then the exception escaped, so the tool reports an error having created a deck and a
retry creates a second one. It now resolves beside `new_deck_json`, before anything is created.
The zero-call PPTX path and the at-most-once HTML path are unchanged.

**Three tests asserted the right things about the wrong layer.**

`TestTheProductionBuildersLabelTheirGroups` asserted that `"user"` appeared among the labels
and that every label was one of the two. Swapped labels satisfy both: mutating the remote's
bundled group to `("user", bundled_guide_entries())` left it green, and that makes all four
reserved guides invalid on that surface — the other half of the regression the test was added
for. It now binds each label to the expression it labels, and a companion case asserts the
consequence: a bundled group keeps the reserved names readable.

`test_a_role_can_reach_what_it_declares_mandatory` reached the selector in round 2 but not the
five `guide_payload(collection, _ROLE_TAGS[...])` expressions in `entry.py`. Mutating
`start_translation` to pass `_ROLE_TAGS["style"]` left the whole suite passing. New
`TestEachEntryPointAsksForItsOwnRole` in `tests/test_entry_tools.py` asserts the key at each
call site and then exercises the real `start_presentation` and both `start_composing` modes,
including that neither composer mode is handed the other format's spec.

`test_management_is_carried_beside_a_role_tag_never_alone` read `_ROLE_TAGS` and the guides'
tags, never the selector between them. Addi…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants