feat(OPE-29): wire captureRisk integer 1-5 and captureRiskReasoning from XLSX #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/OPE-29-schema-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replaces AI-invented low/medium/high string enum with real 1-5 integer
sourced from the master XLSX. Adds captureRiskReasoning freetext field.
Schema: captureRisk → z.number().int().min(1).max(5).nullable()
Pipeline: reads Capture Risk + Capture Risk Assessment columns; removes
captureRisk from ENRICHMENT_FIELDS so XLSX value wins on merge; fixes
pre-existing OUT_DIR bug (was writing to non-existent products/website/
path); exact-match-first in get() helper eliminates column prefix shadowing
CSS: replaces 3 risk tokens with 5 distinct numeric vars (--color-risk-1
through --color-risk-5): green → yellow → orange → orange-red → red
i18n: numeric string keys 1-5 in badge.captureRisk + badge.captureRiskLabel
(en + pt-BR); tooltips updated to reference 5-tier scale
UI: all display sites (MatrixTable, ProtocolCard, ComparisonView, both
[id].astro) updated — color dots, filter, sort (null-safe), labels
Data: 162 protocols regenerated with integer captureRisk (1→23, 2→93,
3→41, 4→5) and captureRiskReasoning freetext where authored
Unblocks OPE-16 (4.5 capture-risk reasoning display) and OPE-17 (4.6
inline challenge button).
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Summary
Data origin attestation
Protocol.entityType now carries the entity-type ID (e.g. "p2p-protocol") instead of the XLSX display name ("P2P Protocols"), eliminating the two-place hardcoded display-name mapping this was drifting from (convert-xlsx.py's unused id parameter, protocols/[id].astro's ENTITY_TYPE_DISPLAY_TO_ID map). Display everywhere now resolves through entity-types.json's fullName via a shared entityTypeMap lookup. Schema: entityType: z.string() -> z.enum([13 canonical IDs]) Pipeline: extract_sheet() writes entity_type_id instead of entity_type_name (the id was already being passed in, just unused) Data: 162 protocols.json entries migrated from display-name to ID (pipeline unrunnable in dev environment; deterministic scripted key-transform used instead, verified exact-count per ID) UI: MatrixTable, ComparisonView, ProtocolCard, both protocols/[id].astro pages (en + pt-BR) all resolve display via entityTypeMap.get(id).fullName; entityTypes prop threaded through NavigatorSection -> ProtocolResults -> ProtocolCard and 8 Astro page call sites (4 pages x en/pt-BR) Tests: updated 2 Playwright assertions for the resulting display-text change (e.g. "P2P Protocols" -> "P2P Protocol", now matching the canonical fullName instead of the old XLSX tab name) 10 of 13 entity-type labels change sitewide as an intended effect of this refactor (full before/after table in the story doc) -- fixes a pre-existing badge/heading display inconsistency on the detail page as a side effect. Verified zero regressions via a baseline-worktree comparison against the pre-story commit (45 failures baseline vs 47 after, net +2 being browser-timing flakes in code this change didn't touch). Code-reviewed (3-layer adversarial); 1 patch applied (entity filter dropdown sort order), 2 items deferred to deferred-work.md (DD Pro/DM Pro enum gap already being addressed via OPE-28/OPE-32; URL filter back-compat, same class as the existing capture-risk deferred item). Story: _bmad-output/implementation-artifacts/3-5-entitytype-id-refactor.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>Data origin attestation
entityTypeon all 162 entries insrc/data/protocols.json(display-name string → canonical entity-type ID);entityTypeschema type insrc/lib/schemas.ts(z.string()→z.enum([...13 IDs]))entity-types.json/ the XLSXEntity Type Defssheet — no new values inventedView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.