Repository navigation
feat(artifacts): a validated, versioned dashboard layout package - #18705
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that #18760's renderer accepts the same block catalog, [DESIGN-REVIEWED] 7410774 Description read[DESCRIPTION-READ] 86453b23a708fed6ac43a7539976cfa2251ca90ce8ff6dbcb9efeb2050987582 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (8 items) — 4 justifiedIntent: an agent stores a crewmate's dashboard layout as an artifact that is validated and versioned. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 7410774 Description read[DESCRIPTION-READ] 967bbf512a788ffa67f77e9677a35ed3e1a20956996e8431d492ece258c267e6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsOne advisory finding. FINDING — src/kiro_crew/artifact_store/dashboard_package.py:447 — [OPUS-REVIEWED] 7410774 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
75e221f to
af22465
Compare
Disposition: the Opus 5.5 advisory finding is FIXED at the rootNew head The finding was correct and reachable.
Fix. Test. Gates re-run on this head, all exit 0: The other two lanes on the previous head
|
af22465 to
3cb3da4
Compare
3cb3da4 to
f31db48
Compare
Disposition: the surrogate class is FIXED at parse time, not per siteNew head The finding is correct, and it is a class rather than a site. Reproduced Patching that one line would have left the next site. So the fix is the
The walk visits every string at every depth, keys as well as values, and Every encode site, enumerated and accounted for
The per-site guard that was in Tests, red-first
Removing the two scan calls turns all five surrogate tests red A sweep over seven positions returns a 400 at every one, with nothing stored Each refusal is also checked on the revert path, which parses both sides. Suite and gates on this head
No override is requested for this finding. It was a real reachable defect |
|
This PR adds a new |
f31db48 to
a3979d5
Compare
d8cd133 to
06e0f4b
Compare
06e0f4b to
ca5851c
Compare
ca5851c to
e310ee9
Compare
A dynamic dashboard is stored as an artifact whose content is a JSON package -- bound_to, model, view, theme -- and never as data. Values stay in the crew log and reach the page through the fold / bus / controller path, which is what lets a package stay small and version only when the layout itself changes. The new artifact_store.dashboard_package module owns the shape and the rules; ArtifactStore.create / update call it, so the dashboard tool path, the browser PATCH handler and a plain artifact_update all pass the same gate rather than each carrying its own copy of the contract: - the data types a model field may declare and the block types a view may place each live behind ONE function (data_type_catalog / view_block_catalog), both stubs the data and display lines fill, and an unknown type or an unknown key inside either is refused; - a values-shaped key anywhere is refused naming the rule, so data cannot drift into the package; - a snapshot is taken exactly when model/view/theme changed, overriding the caller either way: an MCP write would otherwise version every no-op recompose and a browser write would leave a real layout change with no history to revert to. bound_to is outside that comparison -- a rebind says where the page hangs, not what it looks like; - a revert restores layout and keeps the LIVE bound_to, so rolling back past a rebind cannot hand one crewmate's page to another. read_dashboard_model(bound_to) is the single entry point the data line calls to learn which fields a page has a home for and which blocks subscribe to each. Part of #18642.
Every field in a dashboard package declares its own source: a crew-log fold and a path into it, or the crewmate's own write. The data line reads that declaration rather than guessing from the field name, so a value has one home and a page cannot be fed from a fold nobody declared. A layout change also forces a version snapshot either way, overriding the caller: an MCP write defaults snapshot on and would version every no-op recompose, while a browser PATCH defaults it off and would leave a real layout change with nothing to revert to. That forced snapshot is what makes the update path's event_type check reach a case it could not before, so the check moves ahead of every side effect. A rejected request must change nothing, and the content token rotation, the current.html write and the comment-anchor rescan all run before the version block the check used to guard. Moving it out of that block also means an event type that is not a real lifecycle event is refused on every update rather than only on one that versions. Refs #18642
e310ee9 to
7410774
Compare
Problem / Motivation
Goal: an agent can store a crewmate's dashboard layout as a first-class artifact, validated on every write and versioned only when the layout actually changes.
The dynamic dashboard has no home for the thing it renders. A layout -- the data types a page declares, the blocks showing them, the theme tokens styling them, the crewmate or slot it hangs off -- has no artifact kind, so an agent would hide the package in a free-form
markdownorjsonartifact and nothing would check it: an unknown block type, a block naming an undeclared field, a theme token whose;closes its own CSS declaration, all handed to the page unchallenged. Versioning would be wrong both ways too: the two writers defaultsnapshotin opposite directions.Why it matters
The page renders whatever is stored, so the first bad package reaches a browser iframe as an empty or broken page, with no message naming the rule it broke.
Two are worse than cosmetic. A theme token that can terminate its own CSS declaration is a style-injection seam on a page whose safety argument is that the agent authors data, never code. And
bound_tolives in the package, so a restore from before a rebind would hand this crewmate's page to whoever the old binding names.Not a goal
Artifact['kind']union are feat(dashboard): the Dashboard tab renders the package, with no default page #18760's.--kind dashboard, so nothing can mint one by hand.bound_tosays where the page hangs, not how it looks.What changed (motivation -> approach -> change)
Goal: give a layout a validated, versioned home. The gate sits at the one choke point every write passes through --
ArtifactStore.createand.update-- rather than at each caller, which would be three places to keep in step and a fourth caller away from a hole.artifact_store/dashboard_package.py(new, 801 lines) owns the shape and the rules. A package is{kind, bound_to, model{types}, view{blocks}, theme{tokens, css?}}, and each field'ssourceis REQUIRED --{"fold", "path"}or{"agentic": true}-- because it decides whether an agent may write that field: a default would make a whole page agent-writable.artifact_store/rules.pyadds"dashboard"toALLOWED_KINDSand deliberately NOT toUSER_SELECTABLE_KINDS: a prose document hand-flipped to it would hold content no reader can parse.artifacts.pycalls the gate fromcreateandupdate.createalso refuses asource_path: a linked file is re-read from disk on every get, so an edit outside the store would reach the page unchecked.layout_changed()compares the canonicalmodel+view+theme, and the store overrides the caller'ssnapshoteither way, making both defaults correct.revert_package()takes those three from the target version and keeps the LIVEbound_to, so a rollback past a rebind cannot move the page.dump_package, an unpaired surrogate inparse_package, and JSON too deep to decode. Asource's fold NAME is checked against the manifest's ownFOLD_NAMES, shared not copied. Reasoning in a comment below.Not
dashboard_templates/instance.py: that store is keyed by a TEMPLATE --template_id,template_version, the copiedmanifest-- so a Model/View package has no template to copy and no manifest its parity check can read, and would sit there as opaque content. The harm that leaves is the one above: an unvalidated package reaching a page. drop-templates also retires that store. First non-test caller:dashboard_savein #18851 (mcp_panel.pytool,api_dashboard_saveroute), landing in this stack: #18705 -> #18707 -> #18784 -> #18760 -> #18847 -> #18851.Every public symbol here has a caller here. Why the package's field types are deliberately NOT
manifest.FIELD_TYPESis in a comment below.Backwards compatibility
Compatible:
"dashboard"is a kind main does not accept, so the validator can only refuse writes that are already impossible.Tightened, once, and this is the only one.
ArtifactStore.updatevalidatesevent_typeahead of its first side effect rather than inside the version block. Two consequences, the second a behaviour change.A refusal raised from the version block arrives after the content token has rotated,
current.htmlhas been replaced and the comment anchors rescanned -- a 400 for a write that already landed, with no version entry naming it. This diff makes that reachable on a new path, because a dashboard layout change FORCES the snapshot on.Outside the version block, an
event_typethat is not a real lifecycle event is now refused on EVERY update, where a write that happens not to version used to skip the check and accept it silently.Noneis unchanged and still means "decide from the actor". The app's writers are unaffected: the website client types the field to'edited' | 'iterated' | 'reverted'and the MCP tool sends"reverted".Nothing else: the change adds a kind, a module and two call sites, and hides, deletes, renames or migrates nothing.
Tests
test_artifact_dashboard_package.py(new) covers the kind's reachability, canonical storage, every refusal by rule, the cap on both paths, surrogates at any depth, over-deep JSON, the version rule, the revert binding and the shared fold names. Class-by-class list in a comment below.TestARefusedWriteChangesNothingis new and was red before the move: a bogusevent_typeleaves content, version,content_tokenandeventsuntouched; the refusal does not depend on whether the write would version; a metadata-only write is refused too; and a control covers the three event types the app sends.Gates on the changed files all exit 0:
flake8,isort --check-only,black --check,mypy,docs-lint, plus the diff-scoped gates against the base.Manual verification
Each refusal was reproduced against the running code before its fix was written. Unfixed: 290,274 bytes stored over the cap; a
theme.csssurrogate raisesUnicodeEncodeErrorthroughstore.create, a 500; over-deep JSON raisesRecursionError. Fixed, each answersArtifactValidationErrornaming the rule and the JSON path.Shown able to fail: forcing
layout_changed()to returnTruegives3 failed, 63 passed-- exactly the three tests asserting no version appears. Every mutation was reverted and the tree re-verified. The other mutations and the.encode("utf-8")audit are in a comment below.Screenshots / video
N/A -- Python only; nothing under
website/src/is modified.Related Issues
Refs #18642. Its T3 one-pager is approved.
Pattern harvest
Not generalizable: a new capability, not a fix.
Checklist
Contribution License Agreement
Made under Apache-2.0, per CONTRIBUTING.md.