Skip to content

fix(compat): D-002/D-003 name the offending widget type, pin the widget allowlists together, correct the docs that invented chart (#2110) - #2548

Merged
vybe merged 7 commits into
devfrom
vybe/issue-2110
Sep 7, 2026
Merged

vybe merged 7 commits into
devfrom
vybe/issue-2110

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Summary

D-002 (all widget types are supported) failed permanently for agents whose update-dashboard generator emits type: chart, and the operator saw only the bare label unsupported dashboard widget type(s) — the offending types were computed into detail.types, but the Overview panel renders c.message alone, so the UI dropped the cause and the fix. chart was never a Trinity widget type: the agent server strips it before render, DashboardPanel.vue has no branch for it, and the fleet generator was fixed upstream (abilities b19ccc8, create-dashboard v1.2: "there is no chart type"). Two user-docs pages nevertheless advertised chart / badge / countdown as supported and omitted markdown / 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 — when chart is 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 invented chart are corrected. No frontend bytes, no base-image bytes, no schema change.

Closes

Fixes #2110

What changed

  • 03ec3023 test(compat): pin the widget-type allowlists together; fix the docs that invented chart — new tests/unit/test_2110_widget_type_parity.py (stdlib only; Tier A: _WIDGET_TYPES ≡ agent-server valid_types ≡ DashboardPanel.vue render chain, order included, with a single-binding / no-AugAssign / no-.append assertion on valid_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.md and docs/user-docs/faq/advanced-features.md corrected to the real 11-type set, plus a "No chart widget" line saying where trends come from.
  • 92659f12 fix(compat): D-002/D-003 name the offending widget; D block survives real YAML; sink belt — static_checks.py: _WIDGET_TYPES becomes an ordered tuple (agent-server order); D-002 counts each unsupported type ('chart' ×5), names up to 5 in the message (detail.types keeps ≤ 25), appends supported: … and a chart-conditional trend hint; membership is tested on the raw string, message and detail are keyed on the _clipped form (str()-coerced, non-printables dropped, 40 chars); a non-string type is a finding, not a check error. D-003 keeps its prefix and appends 'table' needs rows, …. D-004/D-005 message text unchanged; _clip on labels/colors so a YAML date label or color: 5 no longer crashes. db/compatibility.py::upsert_result: json.dumps(checks, default=str) belt. 13 new tests in test_compatibility_checks.py.
  • d0765f55 docs(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).
  • 20932440 docs(feature-flows): sync compat-validation and agent-dashboard flows.
  • 79905fc0 test(compat): Tier-C signature also catches the YAML-key spelling (`type: chart`) — a real guard escape found in review.
  • 63e96162 docs(review): /cso --diff report + docs/memory/learnings.md entry (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

  • verify-local PASS on this branch — unit 13928 passed, 32 skipped (= base 13899 + this lane's 29), integration 70 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.
  • Lane suite 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 onto 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 Tier-B anchors read the live docs): 127 passed, 15 warnings in 0.70s.
  • Commit-1 red (guard before the doc fix): 3 failed, 13 passed — the guard vs the two lying user-docs pages: invented=['badge','chart','countdown'], omitted=['divider','markdown','spacer'].
  • Commit-2 red (tests before the fix): 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 serializable at upsert_result.
  • Mutation: "chart" appended to _WIDGET_TYPES → parity file 8 failed, 8 passed.
  • Planted violation after the Tier-C fix (79905fc0): 1 failed, 15 passed.
  • /cso --diff PASS; enterprise submodule at 90f2f2c has 0 consumers of the changed message text; both message PREFIXES byte-identical to origin/dev; git diff --quiet origin/dev...HEAD -- src/frontend silent (no frontend bytes changed); tests/lint_root_test_placement.py and tests/lint_sys_modules.py OK.
  • /validate-pr APPROVE. CI-identical enterprise-docs-guard grep: no hits. scripts/ci/check_alembic_parity.py against 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

  1. ESCALATED PRODUCT DECISION — the type: chart renderer is deliberately NOT built. From the plan, verbatim:

    Not in this PR — escalated: the issue's first arm, a type: chart dashboard widget (renderer in DashboardPanel.vue + chart in _WIDGET_TYPES).

    For: it is the issue's first suggestion; agents scaffolded from create-dashboard ≤ v1.1.3 already emit a de-facto schema (chart_type: line|bar|area|pie|donut, series[] / segments[]); Canvas (ent#438) already renders agent-supplied series through TrendLineChart, so line/bar/area has a precedent.

    Against: chart never shipped — the only in-repo claim (docs/archive/memory/changelog.md:460-466) names a DashboardChart.vue that exists in no git ref, and chart.js/vue-chartjs sit unused in package.json; docs/requirements/DYNAMIC_DASHBOARDS.md:33 records "Complex charting (sparklines only, full analytics elsewhere)" as a non-goal; ent#479 (open, status-ready) cites bug: DashboardPanel.vue has no type: chart renderer, so D-002 is unfixable for agents whose generator emits chart widgets #2110 and designs trends as declared-metric tiles on SparklineChart + history, not agent-authored series; pie/donut would need a chart primitive that does not exist (design-system contract: primitives, never lookalikes); and it is a new capability (Rule Fix: Add missing Docker labels to system agent container #1: requirements + feature flow first) that must also change the agent server's valid_types — which strips unknown widgets before the frontend sees them — so it forces a base-image rebuild and FULL verify-local.

    If chosen, it is a type-feature in the enterprise tracker with its own requirements entry, not an extension of this bug fix. This PR is a prerequisite under either answer: D-002 must name the type whatever the type set becomes.

  2. 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 date label crashed json.dumps at the persistence sink, which silently dropped the persistence of the whole report — the default=str belt in upsert_result closes that class for every check, not just the D block.

  3. Audit artefacts are committed. The review committed docs/security-reports/cso-diff-2026-09-06-2110-d002-self-explaining.{md,json} and a docs/memory/learnings.md entry (63e96162, pre-rebase 52753fef) 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.

  4. tests/test_agent_dashboard.py's decorative VALID_WIDGET_TYPES is 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:

  • A chart widget type — escalated (§2).
  • Rendering detail generically in CompatibilityPanel.vue — UI affordance, product call.
  • D-003 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 missing type, title, or sections.
  • Extending the self-explaining message to D-004/D-005 (one line each) if the team wants full D-block consistency.
  • Dead chart.js / vue-chartjs in src/frontend/package.json (zero imports).
  • _WIDGET_COLORS (7) vs the guide's inline color comment (:1511, 6, missing purple).
  • docs/archive/memory/changelog.md:460-466 phantom "chart shipped" entry — archive.
  • tests/test_agent_dashboard.py decorative VALID_WIDGET_TYPES.
  • _dashboard reads top-level widgets: only when sections: is absent, while the agent server rejects a file without sections: — a backend-only leniency; harmless, noted.
  • Stale line numbers in docs/memory/feature-flows/agent-dashboard.md:105-130 (/sync-feature-flows may refresh them).

Found in review:

  • _clip collapses whitespace before rendering, so "metric " (trailing space — correctly not a member, and the agent server strips it too) renders as 'metric' ×1 beside supported: metric, …, a puzzling row; show the raw-vs-clipped delta or say "whitespace" when clipping changed membership.
  • _literal_assign in the parity guard is blind to a subscript assignment (valid_types[0] = …) or mutation through an aliased parameter; the single-binding / no-AugAssign / no-.append assertion covers the realistic edits only.
  • The /update-tests catalog sync (.claude/agents/test-runner.md) lives in the private submodule and was not touched from this lane.

Notes

🤖 Generated with Claude Code

vybe and others added 6 commits September 6, 2026 18:31
…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]>
@trinity-ability
trinity-ability marked this pull request as ready for review September 6, 2026 17:40

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vybe
vybe merged commit c5f89d0 into dev Sep 7, 2026
37 of 38 checks passed
@vybe
vybe deleted the vybe/issue-2110 branch September 7, 2026 09:17
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