Conversation
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/c39c65e1-6fab-4d6d-9068-0d6dbb0684df Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…s + tests Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/23f0a61f-57e7-4520-85fd-bc5b44855114 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/23f0a61f-57e7-4520-85fd-bc5b44855114 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…nk API docs Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/e5f675e3-1618-4fb1-b6a1-7be13b196992 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: documentation,dashboard,visualization,html-css,javascript,workflow,ci-cd,testing,refactor,size-xl,news,agentic-workflow Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
This PR bundles repo hygiene + policy compliance updates by removing legacy dashboard JS modules already migrated to TypeScript, restoring Vitest coverage thresholds to the ISMS floor, and linking generated TypeDoc docs from the public English landing page. It also updates analysis/prompt methodology docs and widens workflow network allowlists to include Statskontoret as a public evidence source.
Changes:
- Removed legacy
js/*-dashboard.js+dashboard/*.jsmodules (and related tests) that were already migrated intosrc/browser/**. - Raised Vitest coverage thresholds to ISMS policy floors and rewrote coverage include/exclude scoping.
- Surfaced TypeDoc from the site footer; updated TypeDoc configs and extended methodology/workflow docs for Statskontoret + SEO handoff rules.
Reviewed changes
Copilot reviewed 63 out of 74 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.js |
Raises coverage thresholds to ISMS floors; re-scopes include/exclude lists for unit-testable surface. |
typedoc.json |
Removes dashboard entry point from TypeDoc generation. |
tsconfig.typedoc.json |
Removes dashboard/**/*.js from include/exclude to reflect legacy purge. |
tests/parse-csv.test.ts |
Removes any global access by using a typed globalThis shim. |
tests/dashboard-csv-integrity.test.js |
Removes unused fs imports after legacy changes. |
tests/chart-utils.test.js |
Deletes now-orphaned tests tied to removed legacy js/chart-utils.js. |
src/browser/shared/types.ts |
Adds structural Chart.js types (ChartTooltipContext, ChartDatasetSpec, ChartLike) to reduce any usage. |
src/browser/dashboards/seasonal-patterns.ts |
Replaces global any usage with typed shims; uses new Chart.js structural types. |
src/browser/dashboards/risk-dashboard.ts |
Tightens types for PapaParse usage, D3 handlers, and Chart.js tooltip callbacks; reduces any casting. |
scripts/coalition-dashboard.ts |
Adds local structural Chart.js types and narrows some D3 generics. |
js/stats-loader.js |
Deletes legacy IIFE stats loader (migrated to TS dashboards). |
js/logger.js |
Deletes legacy JS logger module. |
js/dashboard-integration-example.js |
Deletes legacy example integration module. |
js/chart-utils.js |
Deletes legacy ChartUtils IIFE module. |
index.html |
Adds footer quick-link to TypeDoc output. |
dashboard/i18n-translations.js |
Deletes legacy dashboard translation dictionary module (migrated). |
dashboard/election-predictions.js |
Deletes legacy election predictions module (migrated). |
dashboard/dashboard-init.js |
Deletes legacy dashboard bootstrap module (migrated). |
dashboard/cia-visualizations.js |
Deletes legacy dashboard renderer module (migrated). |
analysis/templates/synthesis-summary.md |
Adds explicit SEO contract note for metadata handoff consistency. |
analysis/templates/methodology-reflection.md |
Adds requirement to include IMF provenance and Statskontoret coverage when relevant. |
analysis/templates/implementation-feasibility.md |
Adds Statskontoret fields/notes for agency-capacity evidence expectations. |
analysis/templates/executive-brief.md |
Tightens BLUF/H1 SEO handoff rules and IMF-first guidance wording. |
analysis/templates/data-download-manifest.md |
Adds Statskontoret as an explicit provenance/enrichment source. |
analysis/templates/comparative-international.md |
Updates guidance for IMF-first + Statskontoret overlay + WB residue use. |
analysis/methodologies/structural-metadata-methodology.md |
Adds Statskontoret as a provenance input/source node. |
analysis/methodologies/per-artifact-methodologies.md |
Adds Statskontoret expectations to comparative/implementation methodologies and evidence rules. |
analysis/methodologies/electoral-domain-methodology.md |
Adds Statskontoret references for historical/implementation framing inputs. |
analysis/methodologies/artifact-catalog.md |
Adds Statskontoret (web_fetch) as an allowed evidence source category. |
analysis/methodologies/ai-driven-analysis-guide.md |
Adds SEO handoff checklist and Statskontoret/IMF-first pass-2 requirements. |
WORKFLOWS.md |
Updates workflow inventory counts and build/test gate description to reflect ISMS coverage floors. |
TESTING.md |
Documents enforced coverage thresholds and measured baseline; updates test metrics section. |
Article-Generation.md |
Documents Statskontoret enrichment role and clarifies evidence URL requirements. |
.github/workflows/news-weekly-review.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-week-ahead.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-translate.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-translate.lock.yml |
Compiled lock update reflecting added Statskontoret domains and prompt hash changes. |
.github/workflows/news-realtime-monitor.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-propositions.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-motions.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-monthly-review.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-month-ahead.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-interpellations.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-evening-analysis.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/workflows/news-committee-reports.md |
Adds statskontoret.se domains to allowlists and diagnostics. |
.github/prompts/seo-metadata-contract.md |
Clarifies relation to Article-Generation.md as the SEO companion contract. |
.github/prompts/README.md |
Links to Article-Generation.md as the end-to-end architecture reference. |
.github/prompts/06-article-generation.md |
Adds explicit references to SEO contract and Article-Generation.md. |
.github/prompts/05-analysis-gate.md |
Extends evidence host allowlist regex to include statskontoret.se. |
.github/prompts/04-analysis-pipeline.md |
Adds Statskontoret overlay expectations and includes statskontoret.se in evidence host list. |
.github/prompts/03-data-download.md |
Adds explicit Statskontoret enrichment collection instructions. |
.github/prompts/02-mcp-access.md |
Documents Statskontoret as a non-MCP public web enrichment source. |
.github/prompts/00-base-contract.md |
Adds Statskontoret to allowed public sources and required reading list. |
| const row: CSVRow = {}; | ||
| headers.forEach((header, index) => { | ||
| const value = values[index]; | ||
| if (typeof value === 'string' && /^-?\d+(\.\d+)?$/.test(value.trim())) { (row as any)[header] = parseFloat(value); } | ||
| else { (row as any)[header] = value; } | ||
| if (typeof value === 'string' && /^-?\d+(\.\d+)?$/.test(value.trim())) { (row as Record<string, unknown>)[header] = parseFloat(value); } | ||
| else { (row as Record<string, unknown>)[header] = value; } | ||
| }); |
There was a problem hiding this comment.
CSVRow is defined as a string-valued map ([key: string]: string), but this parser stores non-string values (PapaParse dynamicTyping: true and the fallback parseFloat(...)). That makes the declared type misleading and can cause downstream code to accidentally call string-only operations on numbers/booleans. Consider either (a) widening the row type used here (and/or the shared CSVRow) to Record<string, string | number | boolean | null> (or unknown), or (b) disabling dynamicTyping and removing numeric coercion so the runtime matches the current CSVRow contract.
| <li><a href="dashboard/index.html">Dashboard</a></li> | ||
| <li><a href="political-intelligence.html"><span aria-hidden="true">🧠</span> Political Intelligence</a></li> | ||
| <li><a href="sitemap.html"><span aria-hidden="true">🗺️</span> Sitemap</a></li> | ||
| <li><a href="api/index.html"><span aria-hidden="true">📚</span> API Documentation (TypeDoc)</a></li> |
There was a problem hiding this comment.
The footer link points to api/index.html, but the repo’s release workflow syncs TypeDoc output into docs/api/ (and documentation URLs elsewhere reference /docs/api/). If api/ isn’t deployed at the site root, this will be a broken link. Consider linking to docs/api/index.html (or whatever the deployed TypeDoc path is) to match the deployment layout.
| ## 🔧 Complete Workflow Inventory (43 Files — 21 standard `.yml` + 11 agentic `.md` + 11 compiled `.lock.yml`) | ||
|
|
||
| > **Verification:** `ls .github/workflows/` yields 45 entries. This matches 21 standard workflow files + 12 agentic Markdown sources + 12 corresponding compiled lock files. Badges and PR checks are driven by the 21 standard `.yml` plus the 12 compiled `.lock.yml` (GitHub Actions only executes the compiled artifacts). | ||
| > **Verification:** `ls .github/workflows/` yields 43 workflow files (44 entries including the directory README.md). This matches 21 standard workflow files + 11 agentic Markdown sources + 12 corresponding compiled lock files. Badges and PR checks are driven by the 21 standard `.yml` plus the 11 compiled `.lock.yml` (GitHub Actions only executes the compiled artifacts). |
There was a problem hiding this comment.
This section says there are 43 workflow files with 11 agentic .md sources, but the verification sentence still claims there are 12 corresponding compiled lock files. That’s internally inconsistent (and contradicts the earlier 21+11+11 breakdown). Please correct the lock-file count so the inventory math is self-consistent.
Three orthogonal cleanups bundled into one branch: drop the migrated-but-still-committed legacy IIFE modules, restore the coverage gate to the Hack23 Secure Development Policy floor, and surface the generated TypeDoc reference from the public site. Also includes the originally-planned
anycleanup in three dashboards.Legacy module purge (~17.8k LOC removed)
js/*-dashboard.js/ helper IIFEs (anomaly-detection,coalition-loader,dashboard-integration-example,election-cycle,logger,ministry,party,politician,pre-election,risk,seasonal-patterns,stats-loader,chart-utils) — all already migrated tosrc/browser/dashboards/**.dashboard/*.jsmodules — migrated tosrc/browser/cia/**.tests/chart-utils.test.js,tests/coalition-loader.test.js).dashboard/fromtypedoc.jsonentry points and fromtsconfig.typedoc.jsonincludes.js/back-to-top.js,js/theme-toggle.js,js/chart-init.js,js/theme-init.js,js/lib/**remain wired in).Coverage gate restored to ISMS floor
vitest.config.jsthresholds raised from a placeholder 22/22/20/23 to the policy floor. Exclude list rewritten to clearly separate unit-testable surface from Cypress-E2E surface and CLI-entry surface (with comments explaining each bucket), so the gate measures only what unit tests can realistically protect.TypeDoc surfaced from English site
npm run typedoccontinues to emit intoapi/; added a footer Quick-Links entry inindex.html:Originally-planned
anycleanup (prior commits on the branch)ChartTooltipContext,ChartDatasetSpec,ChartLikeinsrc/browser/shared/types.ts.scripts/coalition-dashboard.ts,src/browser/dashboards/risk-dashboard.ts,src/browser/dashboards/seasonal-patterns.ts,tests/parse-csv.test.ts, and the unused-var intests/dashboard-csv-integrity.test.js. Lint went from 271 warnings → 226, still 0 errors.Docs synced with the new state
TESTING.md— ISMS floor + measured baseline table, citation toSecure_Development_Policy.md.WORKFLOWS.md— Build & Test row reflects the new gate.Notes for reviewers
parallel_validationtimed out; Code Review pass returned no comments. The change is overwhelmingly deletions + config + one anchor — no new executable paths added.typedoc:validatescript inpackage.jsonreferences a non-existenttests/jsdoc-validation.test.js; pre-existing, left untouched.FUTURE_*docs andanalysis/daily/**deliberately untouched per the original scope.