Skip to content

feat(dashboard): serve the package page and push what moved - #18847

Closed
chenmingwei23 wants to merge 1 commit into
feat/18642-dashboard-frontendfrom
feat/18642-dashboard-block-push
Closed

chenmingwei23 wants to merge 1 commit into
feat/18642-dashboard-frontendfrom
feat/18642-dashboard-block-push

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a crewmate's dashboard page shows fresh numbers the moment a fold advances, without repainting the page or leaking another crewmate's values.

The stack below renders a package to a document, but nothing serves it and nothing keeps it current. The only refresh is the full read, which re-initialises every block, so a canvas-owning block gets a second one.

Why it matters

Every failure mode here is silent: a stale dashboard reads as current, and a frame sent after a rebind hands one crewmate's crew-log values to whoever the page belongs to now.

Not a goal

What changed (motivation -> approach -> change)

Goal: serve the package page, and push only what moved. Assembling the patch here would put the formatting and redaction rules in two places, so this forwards the renderer's block_patch() output.

The dashboard route serves the package page. GET /api/members/{slug}/dashboard reads the binding first: a crewmate with a readable package gets a branch carrying the full read, the blocks and the minted document under rendered_html; one without falls through to the template branch. On this route rather than its own, so the owner gate and the redaction keep one home each.

That document is refused unless it may execute. It runs script-src 'unsafe-inline', so the handler verifies the composed CSP and re-checks every block type against the catalogue, serving no rendered_html if either fails.

A package-bound crewmate is served from it. The empty-record template fallback stays, scoped -- see Backwards compatibility.

Its write is checked once and kept. The display-pending refusal is lifted: this route composes the page from the same package the write is checked against, so one declaration decides both halves. The package-to-manifest translation arrives with it -- _manifest_of, its type mapping, the package manifest source -- held out of the write-model PR as unreachable behind that refusal, since the lift is the first place its output is checked against anything.

Two fold feeds, deliberately. LivePage and dashboard_feed.py:151 resolve a field from different documents, so neither builds on the other; they converge with the template line.

The push narrows in the renderer. send() patches through block_patch, which resolves blocks by blocks_reading, the one place that mapping lives. No second copy of a value: blocks names which moved, read carries each once.

  • Every push carries a version, so the page tells the next frame from a replay and re-reads a gap. A rebind arrives as a frame with no values on it.
  • A layout change swaps the Model, the package AND the subscriptions together, since the refetch reuses this page and a subscription left behind would belong to a dead layout.
  • The push subscribes by the crewmate's DM slot, resolved off-loop by the derivation that creates the thread; the slug names a different, empty slot.
  • dashboard_block_patch is classified owner-only in ws_event_scope; it ships through broadcast_ws_owners, so the classification stops a later literal broadcast reaching an app token.
  • The renderer is imported directly, so a rename is an ImportError rather than a silently empty page.
  • The docs/feature-map/README.md row names both branches, the new frame and the tab that draws them.

Backwards compatibility

Compatible for a crewmate with no package and no scan failure: the template branch answers the same body. member_dashboard_push.py is new with no prior callers.

The builtin-template fallback is SCOPED, not removed. member_dashboard.py:271 is fallback = None if packaged.bound else ..., so a package-bound crewmate gets no template composed under it. Removing it outright was tried and reverted: FOUR readers resolve an empty record to the default, and removing two is worse than all four agreeing.

The scope includes a failed scan, so _read_package answers bound=True when the store scan raises and a crewmate who may have no package gets the empty state; the trade is stated in that branch. The other three readers keep the unscoped rule, so on a scan failure the four disagree, and all four leave with the template line (drop-templates).

Redaction covers the formatter's OUTPUT, and a NAME it would rewrite refuses the read. A display string is built from the field's SPEC as well as its value, and a spec is agent-authored -- format_value appends a unit -- so read() and patch() pass the formatted payload through the redactor too -- necessary and NOT sufficient: the pattern for an assignment does not match what the join produces, so the SPEC is redacted before the renderer reads it too. A declared name is the other half: [a-z][a-z0-9_]{0,63} admits ghp_ plus 36 lowercase characters, and names travel as KEYS -- missing, read.agentic, blocks, a manifest's own -- the identifiers the page joins its cells by. So both reads refuse whole rather than rewrite one. Both, because the template manifest's grammar is the same.

Removed, all unreachable and all shipped in this stack: DashboardModel.declares, .subscribers, .block_folds and LivePage.blocks()'s folds=, all with zero callers; the lazy renderer seam and its six names; a duplicate _Cell; and close_all and live_page, re-implemented in the test that wanted them.

The display-pending refusal is lifted here, with the factory behind it.
Reader: src/kiro_crew/dashboard_agentic.py:display_pending_refusal -- crew page -- absent from origin/main, and its one caller is the gate this change lifts -- test_a_live_package_write_lands_because_the_display_reads_that_package

Tests

pytest -n 2 -q -p no:cacheprovider test/test_{member_dashboard_block_push,\
agent_panel_routes,member_dashboard_routes,dashboard_tools,ws_event_scoping,\
dashboard_contract_pins,dashboard_frame,dashboard_package_render,\
artifact_dashboard_package,dynamic_dashboard}.py
944 passed      (exit 0)

Added: a credential planted in a field's unit reaches neither the document nor the response, asserted on the key BODY alone; a package-bound write is CHECKED against the package's own declaration, a string refused against a declared number through the mapping; a credential-shaped name is refused rather than served, from a package AND from a template manifest; a package-bound write lands and its value is on the served page; the field the tab mounts, scraped out of the component, is a key this read carries; a page with no resolved DM slot is refused.

Changed or deleted, each because it asserted what the design reversed: one pinned parse_package at two calls, one required the bus key to BE the slug, two seam tests collapse into one calling the real renderer, and the write route's package case asserts the write is kept.

Gates all exit 0: flake8, black, isort, mypy, comment-history with its self-test, feature-map, fold-catalogue, take-away.

Manual verification

N/A -- unit coverage is sufficient.

Screenshots / video

N/A -- no website/src/ change.

Related Issues

Refs #18642. Depends on #18784 (base) and #18760 (merge order); the T3 one-pager is approved.

Checklist

  • At most two commits, with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; documentation updated
  • No secrets, credentials or internal references in the diff

Contribution License Agreement

Made under Apache-2.0, per CONTRIBUTING.md.

@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 10, 2026 12:19
@chenmingwei23
chenmingwei23 requested review from bolichen97 and removed request for a team October 10, 2026 12:19
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 28145637ac5e569eecec8d7bc108c97cb052eb03 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 28145637ac5e569eecec8d7bc108c97cb052eb03 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

The goal ("fresh numbers the moment a fold advances") depends on server pushes reaching an already-mounted tab, and no one has watched that happen in a browser.

Watch

  • The live path is only unit-tested, and the PR says it needs nothing more. Before this PR, nothing served rendered_html for a package-bound crewmate. Now _package_body serves the page and arm_block_push sends dashboard_block_patch frames to the frontend from feat(dashboard): the Dashboard tab renders the package, with no default page #18760 (CrewDynamicDashboard.tsx:452, dashboardBlockPush.ts). The backend is tested alone and the frontend is tested against mocked frames. Nothing runs the two together, so a mismatch between them would leave the dashboard silently stale. The description itself calls that kind of failure the worst one ("a stale dashboard reads as current"), yet it still says "Manual verification: N/A".
    Clears when: the description shows a package-bound tab on an isolated gateway taking one block patch after a fold advance, with the frame log or screenshot, and also refetching after a layout change.
  • Each push page stays live until LRU eviction, not until its tab closes. It is created on GET (open_page, MAX_LIVE_PAGES = 32). Only close_page from a rebind tears one down. So every fold advance keeps building and broadcasting patches for up to 32 crewmates whose tab may have been closed long ago. Past 32, the oldest page is evicted and a tab that is still open stops getting pushes, with nothing to show it.
    Clears when: a page is released when its last viewer goes away (a WS unsubscribe or an idle TTL), or the description states the always-on cost and the silent eviction as accepted trade-offs.

[DESIGN-REVIEWED] 2814563

Description read

[DESCRIPTION-READ] 695fe6c78698fc336fc01a749dcc238c2eb4c670b9ca04fae0d6e8d9f660c0d6

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 28145637ac5e569eecec8d7bc108c97cb052eb03 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The package page re-runs checks this same request already ran, and LivePage rebuilds DashboardFeed's fold cache even though _manifest_of now produces the manifest it takes.

Not justified as shipped

  • Item 3 — duplicate of artifact_store/dashboard_package.py:805 (validate_package, reached through parse_package in _read_package): the block-type re-check comment says "rather than trusted from the write path". But _read_package already ran parse_package → validate_package on this request, which refuses a type missing from view_block_catalog(). The CSP check is also a duplicate: _csp_problems re-parses RENDER_CSP, a constant interpolated with no input, and test_dashboard_package_render.py:535-538 already pins it.
    Subtraction: delete the unknown loop in _minted_package_page, plus _REQUIRED_CSP_DIRECTIVES, _FORBIDDEN_CSP_SOURCES, _CSP_META_RE and _csp_problems.
    Clears when: the checks are deleted, or an input path to the renderer is named that bypasses parse_package or changes RENDER_CSP.
  • Item 4 — duplicate of dashboard_feed.DashboardFeed (dashboard_feed.py:151): the module docstring argues "Rebuilding this push on the feed would mean teaching the feed to read a package". Yet this diff's _manifest_of turns a package into the exact TemplateManifest that DashboardFeed.subscribe takes.
    Subtraction: replace LivePage's per-fold subscribe/cache (subscribe, _subscribe_each, bus_key, _snapshot) with a DashboardFeed fed _manifest_of(model). Keep only the version counter and the call to block_patch.
    Clears when: the cache is shared, or a fold-keying difference _manifest_of cannot express is named.

What this change ships

Inventory (8 items) — 6 justified

Intent: a crewmate's package dashboard is served and stays current over the WebSocket without a repaint or a cross-crewmate leak. ADDITION.

  1. The Dashboard tab is served the package page (rendered_html, read, blocks) — justified
  2. A package-bound crewmate gets no builtin template fallback, including when the scan fails — justified
  3. The served document is refused on an unknown block type or a weak CSP — duplicate of validate_package and a test pin
  4. A fold that moves pushes dashboard_block_patch frames carrying a version and refetch-on-layout — duplicate of DashboardFeed (cache half)
  5. A package-bound write is checked and accepted instead of being refused as display-pending — justified
  6. The package manifest source and the package→manifest type mapping — justified
  7. A credential-shaped field name or block id refuses the read, on both the package and the template line — justified
  8. dashboard_block_patch is classified owner-only — justified

[FIRST-PRINCIPLES-REVIEWED] 2814563

Description read

[DESCRIPTION-READ] 58de0445f352c4bb4dde68e0ffe17c060ce3058a6c981436d136377999a76726

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 28145637ac5e569eecec8d7bc108c97cb052eb03 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2814563

Verdict parsed from the review's SHA-scoped output markers for commit 28145637ac5e569eecec8d7bc108c97cb052eb03.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 28145637ac5e569eecec8d7bc108c97cb052eb03: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 28145637ac5e569eecec8d7bc108c97cb052eb03. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/dashboard/handlers/member_dashboard.py:378 -- Credential-shaped artifact slugs bypass dashboard redaction

"slug": str(getattr(model, "slug", "") or ""),
A bound package with a lowercase xoxp- credential as its artifact slug passes slug validation -> _read_package checks only field/block names -> HTTP package.slug and WebSocket dashboard expose it unredacted, including refetch frames.
Anchor: backend-security-controls
Fix: Refuse loaded artifact slugs that redact_via_context would rewrite in _read_package, before serving or arming the page; apply the same check on rereads.
[BLOCK-MERGE] 2814563
[GPT-REVIEWED] 2814563

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

No findings were adjudicable (total=0). I ruled UPHOLD-FENCED on the one fenced finding, F1. The artifact slug check (^[a-z0-9](?:[a-z0-9-]{0,78}[a-z0-9])?\Z, src/kiro_crew/artifact_store/rules.py:188) accepts a lowercase xoxp-… string. That slug reaches member_dashboard.py:378 unredacted, because _read_package only screens declared names (member_dashboard.py:770). The system's own writer can produce the input, so this is not an extreme combination, and I could not show a recovery path or rarity argument from code. That is not enough for a FLAG.

[ADJUDICATION] 28145637ac5e569eecec8d7bc108c97cb052eb03 total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 28145637ac5e569eecec8d7bc108c97cb052eb03

[ADJUDICATION-FENCED] 28145637ac5e569eecec8d7bc108c97cb052eb03 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/dashboard/handlers/member_dashboard.py:378 -- The slug validator at artifact_store/rules.py:188 accepts a credential-shaped lowercase slug and _read_package (member_dashboard.py:770) screens only declared names, so a writer-producible input reaches the page unredacted with no recovery path I could confirm.
[GPT-ADJUDICATED-FENCED] 28145637ac5e569eecec8d7bc108c97cb052eb03

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 28145637ac5e569eecec8d7bc108c97cb052eb03: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 34162a1 to 014b357 Compare October 10, 2026 13:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 014b357 to 5c8b966 Compare October 10, 2026 14:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@chenmingwei23 chenmingwei23 changed the title feat(dashboard): push only the blocks that heard the fold feat(dashboard): serve the package page and push what moved Oct 10, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-renderers branch from c553bb1 to 6aeec47 Compare October 10, 2026 15:30
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 5c8b966 to c75e19e Compare October 10, 2026 15:46
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-frontend branch from 75fc29d to 2f6be4e Compare October 10, 2026 18:13
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 3a556b4 to 9ecbdbf Compare October 10, 2026 18:30
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-frontend branch from 2f6be4e to bc1d575 Compare October 10, 2026 21:49
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 9ecbdbf to 64fa858 Compare October 10, 2026 21:51
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from 64fa858 to b1330da Compare October 10, 2026 22:28
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-frontend branch from bc1d575 to a192e65 Compare October 11, 2026 00:58
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 11, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-block-push branch from b1330da to d9ec8cb Compare October 11, 2026 01:07
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 11, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Fixed on 955394e07166db6f78f7caae291241b3262eeca7, not overridden. The finding was right and the mechanism is worth stating exactly, because it is narrower than "JSON escaping defeats the redactor".

Reproduced first: a number field's unit set to SecretAccessKey="<40-char key>" passes validation, and the served document carried

"display": {"open_prs": "4 [REDACTED: credential]\"abcdefghij...0123456789\\\""}

So the egress scrub DID run and DID match -- it masked the KEY= prefix and left the 40-character key body in the page, because format_value had already joined the unit onto the value and the assignment pattern no longer fits what that join produces.

The fix is the one you named: _minted_package_page now passes _manifest_text_safe(package) to render_dashboard, so the only bytes the renderer can concatenate are already masked. The final _template_text_safe on the composed document stays, because it covers the theme's CSS and every other string the document is built from, which the spec pass does not reach.

Test: test_a_credential_in_a_unit_does_not_reach_the_served_document in test/test_member_dashboard_block_push.py. It asserts on the key BODY alone, never the wrapper -- a page that masks the prefix and keeps the secret would pass a check written against the whole string. Red on d9ec8cbc8d with "the credential body reached the document", green with the fix.

945 passed across the ten related files; flake8, isort, black, mypy, comment-history, feature-map, fold-catalogue, docs-lint and gen:ui --check all exit 0.

A crewmate bound to a dashboard package is served from the existing
dashboard route: the full read, which blocks hold which fields, and the
minted document under rendered_html -- refused unless its CSP carries the
required directives and every block type is in the catalogue. A crewmate
with no package takes the unchanged template branch; one bound to a package
is no longer handed a builtin template instance, not even when its package
is bound but unreadable. Mounting that document in the tab, and listening
for its patches, are still to come, so the feature-map row marks both
pending.

Each fold advance sends a dashboard_block_patch frame built by the
renderer's own block_patch, which narrows to the blocks reading the moved
fields through blocks_reading -- the one place that mapping lives. Every
frame carries a version, so a replay and a gap are distinguishable; a
rebind or a layout change sends a refetch with no values, and a layout
change drops the replaced Model's subscriptions with it. The push
subscribes by the crewmate's DM slot, resolved off-loop by the derivation
that creates the thread: the slug names a different, empty slot, and two
names that slugify together would read one. At most 32 pages push at once,
least recently armed evicted first, and dashboard_block_patch is
classified owner-only.

LivePage and DashboardFeed stay separate feeds, because they resolve a
field from different documents -- a TemplateManifest and the package
DashboardModel -- and the template line is being retired. What they
genuinely share, the per-fold cache cell and the revision rule ordering
it, is imported rather than copied. The renderer is imported directly
instead of resolved by name: it ships on this branch's base, so the
absent-renderer fallbacks were unreachable and a rename is now an
ImportError rather than a silently empty page.

Refs #18642
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Superseded by #19060: the page host now serves agent-written pages on the dashboard_frame contract and pushes fields by subscription, which covers this PR. The one remaining piece (the Artifacts library badge) moves to the library PR. Branch kept. See #18642.

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.

1 participant