Repository navigation
fix(compat): D-002/D-003 name the offending widget type, pin the widget allowlists together, correct the docs that invented chart (#2110) - #2548
Conversation
…hat invented `chart` (#2110) The dashboard widget-type set is hand-copied into three code sites (backend `_WIDGET_TYPES`, agent-server `valid_types` — the gate that strips unknown widgets — and the DashboardPanel.vue render chain) and five contract docs, with no test tying any two together. Two user-docs pages advertised `chart`, `badge`, `countdown` (none ever existed) and omitted `markdown`, `divider`, `spacer`; both feed the docs Q&A index, which is the most plausible source of a fleet generator's belief in `type: chart`. New stdlib-only guard `tests/unit/test_2110_widget_type_parity.py`: - Tier A: backend tuple == agent-server list (members AND order, read by AST in source order, single binding, no AugAssign/.append after definition) == the Vue `widget.type === '…'` branches. - Tier B: five contract docs list exactly the backend set (extractors are `(text) -> set[str]` functions with named anchors that fail loudly). - Tier C: regression signature — no "widget type(s)" line in docs/user-docs, the agent guide (Revision History sliced off) or the spec may backtick chart/badge/countdown. - Meta: planted-violation tests prove every checker bites on every run. Red before the docs fix (3 failed, 13 passed): the two user-docs pins and the signature check, each naming file:line and token. Green after. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…real YAML; sink belt (#2110) `D-002` failed with the bare string "unsupported dashboard widget type(s)": the offending types were computed into `detail.types`, but the Overview panel renders `c.message` only, so the operator saw a label with no cause and no fix. The message now carries the specifics — and because `_check_dict` copies it verbatim into the report dict, one string change reaches the UI row, the `CompatibilityReport` JSON (and therefore MCP `get_agent_compatibility_report`), and the persisted `checks_json`, with zero frontend/MCP/schema changes: unsupported dashboard widget type(s): 'chart' ×5 — not rendered; supported: metric, status, progress, text, markdown, table, list, link, image, divider, spacer (there is no chart widget — trend lines come from metric/progress history: give those widgets a stable id and the platform draws the sparkline) Quoted names with counts, alphabetical, ≤5 named then "+N more", each clipped to 40 printable chars BEFORE it becomes the counting key so message and `detail` show the same bounded string; the trend hint only when `chart` is among the bad types; the supported list generated from the tuple so it cannot drift. `_WIDGET_TYPES` becomes a tuple in the agent-server's order (its sole consumer is `c_d002`). D-003 (HARD, the identical "which widget?" pain) gains the same shape after its unchanged prefix: "'list' needs items, 'text' needs content". Hardening against the YAML the D block actually receives (all reproduced at HEAD by the new tests): `type: 5` beside `type: chart` raised in D-002's set-sort, `type: {a: 1}` raised in D-003's `req.get` (a spurious HARD "check could not be evaluated"), `color: 5` beside `color: teal` raised in D-005's sort — and the hardened loader constructs `date` objects, so a progress widget with `label: 2026-01-01` and an out-of-range value put a `date` into `detail` and `json.dumps(checks)` in `upsert_result` raised, failing persistence of the WHOLE 89-check report. D-004/D-005 keep their message text and gain bounded, JSON-safe `detail`; `upsert_result` serialises with `default=str` as the belt so one check can never take the report's persistence down again. Tests: +13 in test_compatibility_checks.py (98 → 111); red before the change was 11 failed / 3 passed (the two pins pass at HEAD by design). Co-Authored-By: Claude Fable 5.1 <[email protected]>
…requirements, area files (#2110) - agent-validation-spec.md D-002: `Allowed types:` kept byte-identical (it is the parity anchor); "Unknown types are silently ignored by the UI" was false — the agent server strips the widget and the Dashboard tab lists it (a file with no `sections:` is rejected whole), and D-002 now names each offending type with its count. States the list is closed. - TRINITY_COMPATIBLE_AGENT_GUIDE.md (served verbatim by MCP `get_agent_requirements` — the guide IS the MCP surface for the widget contract): closed-set paragraph after the Widget Types table (fictional names in plain prose, per the parity guard's authoring rule) + a Revision History row. - requirements/content-files.md §13.4: the closed set spelled out, the no-chart/badge/countdown note, and the allowlist-parity bullet. - architecture/agent-lifecycle.md: Checks bullet records that D-002/D-003 carry specifics in `message` and the D-block detail/sink JSON-safety; `requirements §41` → `requirements/lifecycle-observability.md §42.1` (stale since the #1406 split). - architecture/agent-runtime.md: `valid_types` is a semantic twin of `_WIDGET_TYPES`, parity-tested, change both together. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… for #2110 - agent-compatibility-validation.md: one Backend bullet on the self-explaining D-002/D-003 message shape, the D-block hardening (non-string type/color, YAML dates) and the `default=str` sink belt; the new tests under Testing; both stale `requirements §41` pointers → `requirements/lifecycle-observability.md` §42.1 (post-#1406 split). - agent-dashboard.md: the closed-set paragraph after the Widget Renderers table (parity guard; no chart/badge/countdown widget ever existed; trends via DASH-001 history on metric/progress widgets keyed by a stable id); the table's line numbers refreshed against DashboardPanel.vue at HEAD; a Revision History row. No index change (feature-flows.md) — no flow was added or renamed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…a fictional widget type (#2110) Review-stage tightening of the parity guard's regression-signature check. The token regex matched only a bare backticked `chart`/`badge`/`countdown` on a "widget type(s)" line — the observed regression. The other way a doc presents a name AS a type is the YAML-key spelling `type: chart`, which escaped the guard. The regex now accepts an optional `type:` prefix inside the code span; zero hits over the live corpus (139 user-docs pages, the guide outside Revision History, the spec). Deliberately NOT widened to "any code span containing the word": the spec's D-002 prose quotes the check's own output (`… 'chart' ×5 …`) and must stay truthful and un-flagged. The meta-test now pins both sides of that line — a planted `type: chart` line is flagged, the quoted-output line is spared — and the docstring's authoring rule names the YAML-key form. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ledger entry (#2110) Stage-4 review artefacts. The /cso --diff audit of the branch (same shape and location as the #2544 precedent): no findings at the daily gate, four INFO observations, every sink of the agent-authored string traced (text interpolation, JSON, bound-parameter upsert) and the enterprise submodule grepped read-only for consumers of the changed message text — none. The learnings entry records the class the branch closed: the hardened YAML loader hands checks `datetime.date` for unquoted ISO scalars, one such value in a check's `detail` made `json.dumps(checks)` raise inside a best-effort `except`, and the whole report silently stopped persisting. Written for the next author of static checks over dashboard.yaml/template.yaml (#2527). Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # docs/memory/learnings.md
vybe
left a comment
There was a problem hiding this comment.
Validated via /validate-pr: Fixes #2110 (P2 type-bug), targets dev, 16 files. D-002/D-003 now carry the offending type(s) in the message every surface renders; D-block values are clipped and str-coerced at the origin and upsert_result serialises with default=str, so a YAML date can no longer drop the whole report's persistence. New stdlib AST parity guard pins the backend allowlist, the agent-server gate, the Vue render chain and five contract docs, with planted-violation meta-tests. Requirements, architecture (agent-lifecycle, agent-runtime), two feature flows and user docs updated; learnings entry added. Security greps clean. Merged current dev to resolve the learnings.md conflict; CI fully green on the merged head after one hung runner job was re-run.
Summary
D-002(all widget types are supported) failed permanently for agents whoseupdate-dashboardgenerator emitstype: chart, and the operator saw only the bare labelunsupported dashboard widget type(s)— the offending types were computed intodetail.types, but the Overview panel rendersc.messagealone, so the UI dropped the cause and the fix.chartwas never a Trinity widget type: the agent server strips it before render,DashboardPanel.vuehas no branch for it, and the fleet generator was fixed upstream (abilitiesb19ccc8,create-dashboardv1.2: "there is nocharttype"). Two user-docs pages nevertheless advertisedchart/badge/countdownas supported and omittedmarkdown/divider/spacer— those pages feed the public docs Q&A index, the most plausible origin of the generator's belief.This PR takes the issue's second arm. D-002 and D-003 now name the offending type(s) on every surface (UI row, report JSON / MCP, persisted
checks_json) together with the supported list and — whenchartis involved — where trends actually come from. The D block is hardened against the real YAML natives the hardened loader hands it (date,int,bool,dict— three of which crashed a check, or the whole report's persistence, at HEAD). A stdlib parity guard pins the backend / agent-server / Vue / docs widget-type sets together, and the docs that inventedchartare corrected. No frontend bytes, no base-image bytes, no schema change.Closes
Fixes #2110
What changed
03ec3023test(compat): pin the widget-type allowlists together; fix the docs that inventedchart— newtests/unit/test_2110_widget_type_parity.py(stdlib only; Tier A:_WIDGET_TYPES≡ agent-servervalid_types≡DashboardPanel.vuerender chain, order included, with a single-binding / no-AugAssign/ no-.appendassertion onvalid_types; Tier B: the five contract docs; Tier C: a signature scan that fails on a fictional name near "widget type(s)"; three planted-violation meta-tests so the guard is provably non-vacuous).docs/user-docs/advanced/dynamic-dashboards.mdanddocs/user-docs/faq/advanced-features.mdcorrected to the real 11-type set, plus a "No chart widget" line saying where trends come from.92659f12fix(compat): D-002/D-003 name the offending widget; D block survives real YAML; sink belt —static_checks.py:_WIDGET_TYPESbecomes an ordered tuple (agent-server order); D-002 counts each unsupported type ('chart' ×5), names up to 5 in the message (detail.typeskeeps ≤ 25), appendssupported: …and achart-conditional trend hint; membership is tested on the raw string, message anddetailare keyed on the_clipped form (str()-coerced, non-printables dropped, 40 chars); a non-stringtypeis a finding, not a check error. D-003 keeps its prefix and appends'table' needs rows, …. D-004/D-005 message text unchanged;_clipon labels/colors so a YAMLdatelabel orcolor: 5no longer crashes.db/compatibility.py::upsert_result:json.dumps(checks, default=str)belt. 13 new tests intest_compatibility_checks.py.d0765f55docs(dashboard): the widget set is closed —docs/agent-validation-spec.md(Allowed types:byte-identical; the "silently ignored by the UI" sentence corrected to what actually happens),docs/TRINITY_COMPATIBLE_AGENT_GUIDE.md(closed-set paragraph + revision row),docs/memory/requirements/content-files.md§13.4,docs/memory/architecture/agent-lifecycle.md(§41 → §42.1 pointer, persistence note),docs/memory/architecture/agent-runtime.md(parity note on the agent-server gate).20932440docs(feature-flows): sync compat-validation and agent-dashboard flows.79905fc0test(compat): Tier-C signature also catches the YAML-key spelling (`type: chart`) — a real guard escape found in review.63e96162docs(review):/cso --diffreport +docs/memory/learnings.mdentry (YAML natives at a JSON sink; cites the feat(workspace): loops, canvas and files dock into the rail; the strip and the drawer are gone (abilityai/trinity-enterprise#475) #2544 precedent).Proof
13928 passed, 32 skipped(= base 13899 + this lane's 29), integration70 passed, 13 skipped, 2 deselected, build + import-smoke OK (the backend change is inside the real image), boot + health OK, venv Python 3.13.5.cd tests && python3 -m pytest unit/test_compatibility_checks.py unit/test_2110_widget_type_parity.py -q -p no:cacheprovider→127 passed(111 + 16). Re-run after rebasing onto6e5a60b1(feat(workspace): the scanline is for charts, and the conversation gets its rail (#2540, ent#474) #2543, feat(workspace): loops, canvas and files dock into the rail; the strip and the drawer are gone (abilityai/trinity-enterprise#475) #2544 — the Tier-B anchors read the live docs):127 passed, 15 warnings in 0.70s.3 failed, 13 passed— the guard vs the two lying user-docs pages:invented=['badge','chart','countdown'], omitted=['divider','markdown','spacer'].11 failed, 100 passed— each HEAD defect confirmed live:cannot use 'dict' as a set element, the'date' and 'str'sort crash,Object of type date is not JSON serializableatupsert_result."chart"appended to_WIDGET_TYPES→ parity file8 failed, 8 passed.79905fc0):1 failed, 15 passed./cso --diffPASS; enterprise submodule at90f2f2chas 0 consumers of the changed message text; both message PREFIXES byte-identical toorigin/dev;git diff --quiet origin/dev...HEAD -- src/frontendsilent (no frontend bytes changed);tests/lint_root_test_placement.pyandtests/lint_sys_modules.pyOK./validate-prAPPROVE. CI-identicalenterprise-docs-guardgrep: no hits.scripts/ci/check_alembic_parity.pyagainst the PR base/head SHAs: pass (no net-new migration entry);scripts/ci/check_alembic_heads.py: 52 revisions, 1 head.Decisions for the reviewer
ESCALATED PRODUCT DECISION — the
type: chartrenderer is deliberately NOT built. From the plan, verbatim:D-003 got the same self-explaining treatment (it is HARD, and the same one-string-reaches-three-surfaces argument applies). D-004/D-005 kept their message text and got hardening only: a YAML
datelabel crashedjson.dumpsat the persistence sink, which silently dropped the persistence of the whole report — thedefault=strbelt inupsert_resultcloses that class for every check, not just the D block.Audit artefacts are committed. The review committed
docs/security-reports/cso-diff-2026-09-06-2110-d002-self-explaining.{md,json}and adocs/memory/learnings.mdentry (63e96162, pre-rebase52753fef) citing the feat(workspace): loops, canvas and files dock into the rail; the strip and the drawer are gone (abilityai/trinity-enterprise#475) #2544 precedent. The two sibling PRs of this run did not commit audit artefacts — say the word and I drop that commit.tests/test_agent_dashboard.py's decorativeVALID_WIDGET_TYPESis intentionally left alone (it asserts nothing about production code; the parity guard is the real pin).Not in this PR / follow-ups (not filed)
From the plan (§12), verbatim:
chartwidget type — escalated (§2).detailgenerically inCompatibilityPanel.vue— UI affordance, product call.req≠ agent-server required fields (table: columns, rows;image: src, alt) — a HARD verdict change; pin with the parity guard when fixed. Also: no D check covers a missingtype,title, orsections.chart.js/vue-chartjsinsrc/frontend/package.json(zero imports)._WIDGET_COLORS(7) vs the guide's inline color comment (:1511, 6, missingpurple).docs/archive/memory/changelog.md:460-466phantom "chart shipped" entry — archive.tests/test_agent_dashboard.pydecorativeVALID_WIDGET_TYPES._dashboardreads top-levelwidgets:only whensections:is absent, while the agent server rejects a file withoutsections:— a backend-only leniency; harmless, noted.docs/memory/feature-flows/agent-dashboard.md:105-130(/sync-feature-flowsmay refresh them).Found in review:
_clipcollapses whitespace before rendering, so"metric "(trailing space — correctly not a member, and the agent server strips it too) renders as'metric' ×1besidesupported: metric, …, a puzzling row; show the raw-vs-clipped delta or say "whitespace" when clipping changed membership._literal_assignin the parity guard is blind to a subscript assignment (valid_types[0] = …) or mutation through an aliased parameter; the single-binding / no-AugAssign/ no-.appendassertion covers the realistic edits only./update-testscatalog sync (.claude/agents/test-runner.md) lives in the private submodule and was not touched from this lane.Notes
main(sync-docs-to-vertex.yml); until then the public bot may still answer thatchartis supported.spec.py/static_checks.pyin another region — rebase-only risk, no semantic overlap.6e5a60b1(feat(workspace): the scanline is for charts, and the conversation gets its rail (#2540, ent#474) #2543, feat(workspace): loops, canvas and files dock into the rail; the strip and the drawer are gone (abilityai/trinity-enterprise#475) #2544); the only conflict was the add/add tail ofdocs/memory/learnings.md— both 2026-09-06 entries kept, upstream's first.🤖 Generated with Claude Code