Skip to content

feat: ai@2026-07-03-beta schema (affected category) + power-flow prototype - #314

Open
pichot wants to merge 20 commits into
mainfrom
feat/power-flow-graph-canvas
Open

feat: ai@2026-07-03-beta schema (affected category) + power-flow prototype#314
pichot wants to merge 20 commits into
mainfrom
feat/power-flow-graph-canvas

Conversation

@pichot

@pichot pichot commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

Introduces the ai@2026-07-03-beta schema version, whose headline change is a new required "affected" category ("People affected", canvas label "Used on") — the counterpart to accountable that names who a system is used on or impacted by, carrying a relationship discriminator (subject / bystander / community), a generic people seed element so required: true is satisfiable, and shifted downstream category order values to open the slot. CI now also validates the new beta. Alongside the schema, this branch lands the research grounding for the graph/"power flow" model (Bovens accountability theory, W3C PROV/ODRL, Net-Map/RACI power-mapping, graph-vs-list comprehension evidence) and three standalone HTML power-flow graph-canvas prototypes (index, canvas, boardgame).

Validation

pnpm --filter ./api schema:validate ai@2026-07-03-beta passes (12 categories, 109 elements); schema:build stamps a real content_hash and composes the people icon across all three discriminator variants; a minimal instance placing people in affected validates ok: true (no REQUIRED_CATEGORY_MISSING); api tests (444+64) and typecheck are green.

pichot and others added 3 commits July 17, 2026 11:41
Add the "People affected" category (canvas label "Used on") — the
counterpart to `accountable` that names who a system is used on or
impacted by. Required, with a `relationship` element_context
discriminator (subject / bystander / community) and a generic `people`
seed element so `required: true` is satisfiable. Shift downstream
category `order` values to open the slot, and gate the new beta in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Capture prior art (Bovens accountability theory, W3C PROV/ODRL,
Net-Map/RACI power-mapping, graph-vs-list comprehension evidence) for
reshaping a DTPR datachain into a typed relationship graph — the
grounding for the "affected" category and the power-flow prototype.
Standalone HTML explorations of a "power flow" graph view that renders
who does what to whom over a DTPR datachain (index, canvas, boardgame).
@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown

Too many files changed for review. (218 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

pichot and others added 17 commits July 18, 2026 16:44
Add canvas-affected disclosure-board prototypes (incl. v5 with a
neutral, non-alarming "Used on" seat), a boardgame variant, and a
boardgame.io-based power-flow game with content, logic, UI, and tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fork canvas-affected-v5 into v6: replace the three uncohering per-seat
value treatments (title / instance / qualifier tags) with one generative
composition model. Every board piece renders from a typed source
{ icon, type, instance, classification, facts } through a per-category
GRAMMAR registry, at two densities — compact stack (A) and composed
sentence (C).

- Marker/colour primitives: mk() highlighter wraps every deployment fill;
  colour spent only on the six published schema classifications (PII +
  autonomy). Autonomy underline retired; the system-sentence autonomy
  phrase now renders as a coloured marker.
- A-stack renderer: headline (lead slot) / type·classification / facts;
  data/people/org lead with the specific, processing degrades to
  headline+type when it has no classification.
- C-sentence renderer: per-category, per-locale templates; instance in
  parens, classification em-dash set-off, facts joined via Intl.ListFormat;
  A-only categories (risk) skip C.
- Risk grammar: harm type leads, required narrative, optional mitigation as
  a paired response; missing mitigation raises the one earned alarm; list of
  pairs; seat omitted when empty.
- EN/FR toggle: four systems re-authored per-locale; Intl number/list
  formatting; no runtime inflection.

Verified in-browser: no console errors, AE1-AE5 all pass (fr data C matches
'Biométrie (votre visage) — données identifiables — conservées 24 h et sur
le cloud d'un fournisseur'; label localizes to 'Atténuation').

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Every DTPR icon (purpose, org, data-flow, processing, risk, people,
mode, and rights icons) now carries a localized data-tip and shows a
title popup instantly on hover — no native-title delay. A single
delegated mouseover/mouseout handler on document positions a shared
tooltip above (or below, near the top edge) the icon and survives every
locale re-render. Tips localize with the EN/FR toggle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add facilitation canvas/workshop prototypes (v1-v4) and their plan docs.
Split the risks_mitigation element_variables into separate required
`risk` and optional `mitigation` fields. Move the affected-seat
relationship onto a PII-style badge in canvas-affected-v5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New root-level canvas/ app for the DTPR AI register + feedback layer.
Mirrors dtpr-ai/docs-site: cloudflare-module Nitro preset under
$production, wrangler.jsonc with a FEEDBACK_DB D1 binding (distinct
from @nuxt/content's DB), @nuxt/ui + Tailwind v4, @nuxtjs/i18n en/fr.
Registered in pnpm-workspace.yaml with root dev/build/deploy/test
scripts. Boots in dev (200) and builds for Cloudflare (.output emitted).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lift v6's SYSTEMS/PII/REL into typed, versioned, bilingual in-repo
modules keyed by (system, variant, version) with a live flag and stable
seat keys. Registry (SYSTEMS) plus resolvers: resolveCanvas defaults to
the live variant + current version, liveCanvases surfaces only live
variants for the register. Registry integrity + resolution covered by
vitest; canvas-data typechecks under strict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Port v6's grammar/mk/clsMarker/renderPiece/sentence into a pure
grammar.ts (structured marks + segments, not HTML strings) plus Vue
components (CanvasBoard, PieceStack, Marker) and canvas.css. Preserves
the v6 marker/colour policy — colour only on PII + autonomy, neutral for
relationships/harm — and the immediate hover tooltip. Every seat wrapper
carries a stable data-seat key for per-piece feedback anchoring (U6).
Grammar characterized by vitest (colours, tiers, degradation, sentence);
verified live rendering the face-gates canvas with correct markers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
D1 schema (respondent + feedback_response, indexed on the canvas keys)
and two Nitro routes: POST /api/feedback (validate + persist) and
GET /api/feedback/summary (segmented aggregate feeding compare). The
data layer (server/utils/db.ts) is pure and D1-typed so vitest exercises
the real SQL through a better-sqlite3 D1 shim — covering seat vs canvas
scope (AE4), public/professional never merged (AE3), self-tag set once,
and 400 on invalid input. Routes reach FEEDBACK_DB via the Cloudflare
env; bundle cleanly into .output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
useRespondent composable: a localStorage respondent_id generated once
and stable across reloads, a one-time public/professional self-tag, and
optional contact (never required). Pure storage helpers are vitest-
covered for AE1 — first visit creates+persists the id and leaves the tag
unset, a return visit reuses it, the tag is asked exactly once, contact
stays optional. SelfTag.vue presents the one-time choice + optional
contact (wired into the feedback flow in U6).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CanvasFeedbackLayer wraps CanvasBoard and delegates seat clicks to a
SeatReact popover (clear/confusing/unsure + optional note); ClarityRating
covers canvas-level overall clarity. useFeedback posts the full tag
(system, variant, version, seat?, scope, respondent) and gates the first
submit from an untagged respondent behind the one-time SelfTag. Verified
live against workerd + local D1: seat and canvas POSTs persist, an
invalid reaction is 400, and the summary keeps public/professional
segmented (AE3) with seat-vs-canvas scope (AE4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Register index lists live variants only (R16), each linking to its SSR
canvas page. The s/[system]/[[variant]]/[[version]] route resolves keys
to a canvas (defaulting to the live variant + current version), renders
CanvasBoard + the feedback layer, and emits OG/Twitter/canonical meta via
useHead so LinkedIn/newsletter deep links preview (R15). Unknown keys
404. A default layout adds the EN/FR toggle driving both chrome and
canvas content. Verified live: register lists 4 systems, deep link shows
OG tags + 10 feedback seats, specific variant/version resolves, unknown
system/version 404. share-meta is pure + vitest-covered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per-system compare: fetches /api/feedback/summary and aggregates into
(variant, version) columns via a pure, tested aggregator. Each column
shows overall clarity segmented public/professional (never merged, AE3),
per-seat confusion ranked by where it clusters, and a thin-sample flag
below the response threshold; a restyle appears as its own column while
the prior version persists (AE2). VariantColumn + SeatConfusion
components; a compare link is surfaced on each canvas page. Verified live
against local D1 with segmented feedback; unknown system 404s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Post-implementation simplify (3-reviewer pass): drop unused
PEOPLE_HEX_PATH/PEOPLE_SYMBOL exports (CanvasBoard inlines the SVG) and
the unreferenced relationshipLegend/relationshipLabel + REL tail/legend
fields; extract the duplicated D1-binding lookup + 503 guard into a
shared requireFeedbackDb server util; memoize per-risk riskView() once
per render instead of 4× per binding; trim unused composable returns.
Behavior preserved — 46 tests pass, build clean, live D1 roundtrip and
risk rendering re-verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…, coverage

Correctness + security + testing findings from review:
- validateFeedback enforces per-field length caps (keys/id <=128 hard
  reject; note<=2000, contact<=256 truncated) so an anonymous public POST
  can't persist multi-megabyte values into D1 (storage-abuse guard).
- feedback.post wraps insertFeedback so a D1 error returns a shaped 500
  instead of leaking internals.
- respondent contact is now fill-once (COALESCE(existing, new)) — a return
  visit fills an empty contact but never overwrites one, since the id is a
  client-supplied key.
- register list keys by full (system,variant,version) coords, not systemKey
  alone, so a system with >1 live variant renders correctly.
- Added coverage: length caps + contact fill-once (real SQL), useFeedback
  self-tag gating/flush (R12), reactive useRespondent forSubmit, resolve-
  layer currentVersion/defaultVariant fallbacks (AE2/R16), multi-mode
  sentence; removed a trivially-true assertion. 55 tests pass; hardening
  re-verified live against local D1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace per-system compare page with a single CanvasMatrix compare view,
add Tag component and shared rightActions util, and extend grammar with
system-data updates and expanded test coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
dtpr-ai 0fe6014 Jul 22 2026, 01:21 PM

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