Skip to content

[dashboard-components] Extract dashboard metadata section helper - #373

Merged
pelikhan merged 2 commits into
mainfrom
refactor/metadata-section-helper-199e2242a263bb9c
Aug 31, 2026
Merged

[dashboard-components] Extract dashboard metadata section helper#373
pelikhan merged 2 commits into
mainfrom
refactor/metadata-section-helper-199e2242a263bb9c

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

  • Extract renderMetadataSection(...) into pages/dashboard/src/components/view-chrome.js.
  • Reuse the shared metadata section helper in pages/dashboard/src/components/outcome-detail.js.
  • Update pages/dashboard/PLAN.md component inventory and run log for this bounded refactor.

Duplication evidence

  • Repeated metadata section DOM assembly existed in pages/dashboard/src/components/outcome-detail.js:152 as local <section><h2>...</h2>...</section> construction.
  • The same section-chrome family already lived in pages/dashboard/src/components/view-chrome.js, making metadata sections the best remaining small presentation-only extraction for this run.

Call sites collapsed

  • Replaced the local helper in pages/dashboard/src/components/outcome-detail.js with the shared renderMetadataSection(...) export from pages/dashboard/src/components/view-chrome.js.
  • No duplicate metadata-section helper remains at the identified call site.

Tests added

  • Added unit coverage in pages/dashboard/test/unit/view-chrome.test.js for default h2 metadata headings and custom heading-tag rendering.

Behavior preservation evidence

  • Preserved the existing pages/dashboard/test/unit/outcome-detail.test.js assertions covering metadata headings, badges, links, and sanitized Markdown for the affected outcome detail route.
  • Rendered the affected outcome-detail fixture after the refactor with a jsdom harness to confirm the refactor remained structural-only.

Gates

  • cd pages/dashboard && npm install
  • cd pages/dashboard && npm run build
  • cd pages/dashboard && npm run typecheck
  • cd pages/dashboard && npm run lint
  • cd pages/dashboard && npm test
  • Playwright not rerun for this bounded helper extraction because no browser-only behavior changed; current browser-gate status remains tracked in pages/dashboard/PLAN.md infrastructure blockers.

Blockers

  • None for this refactor.

Next candidates

  • Extract the repeated definitions/observations dual-region composition in pages/dashboard/src/presenter.js.
  • Extract the repeated summary-plus-trend section composition in pages/dashboard/src/presenter.js.
  • Extract the next shared pure helpers around subject/provenance/count formatting in pages/dashboard/src/presenter.js.

Generated by ♻️ Daily Dashboard Component Refactorer · pi · gpt54 · 51.4 AIC · ⌖ 6.66 AIC · ⊞ 6.2K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@copilot fix https://github.com/githubnext/central-agentic-ops/actions/runs/33443472884/job/99657280440#step:9:1

Fixed in a97e... — test/e2e/smoke.spec.js's buildPresenterModuleUrl() was missing the .replace("'./view-chrome.js'", ...) substitution for outcome-detail.js's new import of renderMetadataSection, so the inlined module still had the bare './view-chrome.js' specifier and failed to resolve in the data: URL harness, breaking all 13 e2e tests. Added the missing replace and verified all 14 e2e tests, lint, typecheck, and unit tests pass.

Copilot AI requested a review from pelikhan August 31, 2026 22:03
@pelikhan
pelikhan merged commit b494e55 into main Aug 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants