Conversation
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…tion config, add dashboard-CSV integrity tests - deploy-s3.sh: Add explicit text/csv content-type pass for CSV files with 24hr cache - deploy-s3.sh: Exclude *.csv from catch-all sync pass to prevent MIME type guessing - coalition-dashboard.ts: Remove unused anomalyClassification config pointing to empty CSV - Add comprehensive dashboard-csv-integrity.test.js validating all 12 dashboards have valid CSV data Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/80568c4f-c571-41b4-b8ef-3260e1f988c3 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
- Fix countDataRows to handle empty files and blank lines safely - Use substring instead of string concatenation for cross-platform path handling Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/80568c4f-c571-41b4-b8ef-3260e1f988c3 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…dashboard tests Update coalition-dashboard.test.js and risk-dashboard.test.js to remove references to the header-only distribution_voting_anomaly_classification.csv that was removed from coalition-dashboard.ts DATA_CONFIG in the previous commit. All 650 dashboard-related tests pass (12 test files). Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2b4e21c7-c214-4ca2-a018-e76ccb0fd1f6 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2b4e21c7-c214-4ca2-a018-e76ccb0fd1f6 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Add comprehensive column-level validation ensuring every CSV column accessed by dashboard code (row['col']) actually exists in the CSV headers. Add extraction summary validation confirming all 16 source views have success status and correct row counts. 261 tests in dashboard-csv-integrity.test.js (was 180), 731 total pass. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2b4e21c7-c214-4ca2-a018-e76ccb0fd1f6 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Avoid brittle exact-count test (200) that would break on legitimate data changes. Use >= 100 lower bound instead. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2b4e21c7-c214-4ca2-a018-e76ccb0fd1f6 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 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 improves dashboard data reliability by removing a dashboard reference to a header-only CSV, adding comprehensive Dashboard↔CSV integrity tests, and ensuring CSVs are deployed to S3 with an explicit text/csv; charset=utf-8 content-type (avoiding MIME guessing).
Changes:
- Remove
anomalyClassificationdataset reference from the coalition dashboard and align related tests. - Add
tests/dashboard-csv-integrity.test.jsto validate dashboard CSV existence, non-empty data rows, column/header expectations, extraction summary health, and presence of translated HTML pages. - Update
scripts/deploy-s3.shto upload CSVs with explicit content-type and exclude*.csvfrom the catch-all sync; update.gitignorefor Playwright MCP snapshot artifacts.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/risk-dashboard.test.js | Updates expectations after removing a dataset URL. |
| tests/dashboard-csv-integrity.test.js | Adds new integrity test suite enforcing dashboard↔CSV correctness and data presence checks. |
| tests/coalition-dashboard.test.js | Removes anomalyClassification expectations from coalition dashboard tests. |
| src/browser/dashboards/coalition-dashboard.ts | Removes anomalyClassification from DATA_CONFIG. |
| scripts/deploy-s3.sh | Ensures CSVs get explicit text/csv; charset=utf-8 and excludes *.csv from catch-all sync to prevent MIME guessing. |
| .gitignore | Ignores Playwright MCP snapshot directory and generated PNG artifacts. |
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import { readFileSync, existsSync, readdirSync, statSync } from 'fs'; |
There was a problem hiding this comment.
statSync is imported but never used in this test file. Please remove the unused import to keep the test code clean and avoid unnecessary ESLint warnings.
| import { readFileSync, existsSync, readdirSync, statSync } from 'fs'; | |
| import { readFileSync, existsSync, readdirSync } from 'fs'; |
| }, | ||
| 'risk-dashboard': { | ||
| columns: ['party'], | ||
| }, | ||
| 'politician-dashboard': { | ||
| columns: ['person_id', 'first_name', 'last_name', 'risk_level', 'risk_score', | ||
| 'experience_level', 'politician_count', 'influence_classification'], | ||
| }, |
There was a problem hiding this comment.
The risk-dashboard column requirements list only party, but src/browser/dashboards/risk-dashboard.ts clearly reads additional CSV fields (e.g. person_id, first_name, last_name, risk_score, risk_level). This makes the column-integrity test under-report missing headers for that dashboard; please expand the required column list to match the fields actually accessed by the dashboard code.
| function collectEmptyCsvFiles(dir) { | ||
| const entries = readdirSync(dir, { withFileTypes: true }); | ||
| for (const entry of entries) { | ||
| const fullPath = join(dir, entry.name); | ||
| if (entry.isDirectory()) { | ||
| collectEmptyCsvFiles(fullPath); | ||
| } else if (entry.name.endsWith('.csv')) { | ||
| const rows = countDataRows(fullPath); | ||
| if (rows === 0) { | ||
| const relative = fullPath.substring(CIA_DATA_DIR.length + 1); | ||
| emptyFiles.push(relative); | ||
| } | ||
| } |
There was a problem hiding this comment.
collectEmptyCsvFiles calls countDataRows() for every CSV under cia-data/, which readFileSyncs the entire file into memory. This can be expensive because the repo contains multi‑MB CSVs (e.g. large committee/politician samples). Consider optimizing the empty/header-only detection to avoid full-file reads (e.g., read just enough bytes/lines to determine whether there is at least one data row, or stream and early-exit after the second non-empty line).
| @@ -213,7 +212,6 @@ describe('Risk Dashboard', () => { | |||
| }); | |||
|
|
|||
| it('should include anomaly datasets', () => { | |||
There was a problem hiding this comment.
This test name/intent now refers to “datasets” but only validates anomalyDetection after removing anomalyClassification. Renaming the test (or adjusting the wording) would avoid confusion about what is still expected to be present.
| it('should include anomaly datasets', () => { | |
| it('should include anomaly detection dataset', () => { |
Audit all 12 dashboards against 139 CSV files in
cia-data/to ensure every dashboard references CSVs with actual data rows and correct column headers. Cross-referenced againstextraction_summary_report.csv(200 rows, 16 source views all success).Dead config removal
anomalyClassificationfromcoalition-dashboard.tsDATA_CONFIG— pointed todistribution_voting_anomaly_classification.csvwhich is header-only (0 data rows)coalition-dashboard.test.jsandrisk-dashboard.test.jsto matchS3 deployment fix
text/csv; charset=utf-8content-type pass indeploy-s3.shwith 24hr cache*.csvfrom catch-all sync to prevent MIME guessingNew test coverage (261 tests)
tests/dashboard-csv-integrity.test.jsvalidates:successstatusFindings
All 12 dashboards have valid data — no dashboards needed removal. 10 header-only CSVs exist in
cia-data/but none are referenced by active dashboards.