feat: Statskontoret agency-capacity enrichment layer#2043
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 |
…ex, gate, skill, tests) Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/d7491d0e-52a8-4f75-b4e8-e6a6b1c0afdb Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…e gate, grade notes) Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/d7491d0e-52a8-4f75-b4e8-e6a6b1c0afdb 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 |
|
@copilot resolve the merge conflicts in this pull request |
Merge conflicts are already resolved — commit |
|
@copilot resolve the merge conflicts in this pull request |
…Check 9 (PIR sidecar) Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Resolved in |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
| When an agency is named in `implementation-feasibility.md`: | ||
| - The **Feasibility Context** table MUST include a populated `Statskontoret relevance` row (URL or `"none found"`). | ||
| - The **Administrative feasibility** section MUST cite the Statskontoret entry or explicitly state no relevant report was found. | ||
| - Both fields are enforced by the analysis gate (`05-analysis-gate.md` Check 9). |
There was a problem hiding this comment.
This section says the Statskontoret fields are enforced by 05-analysis-gate.md “Check 9”, but the gate currently labels the Statskontoret enforcement as “Check 9b”. This inconsistency makes it harder to follow/enforce the process.
Suggestion: update this reference to the correct check identifier (and keep numbering consistent with the gate document).
| - Both fields are enforced by the analysis gate (`05-analysis-gate.md` Check 9). | |
| - Both fields are enforced by the analysis gate (`05-analysis-gate.md` Check 9b). |
| ## Implementation | ||
|
|
||
| No dedicated validator script exists yet — implement the checks as an inline bash gate. Full implementation (covers checks 1–9, with check 9 conditional where applicable): | ||
| No dedicated validator script exists yet — implement the checks as an inline bash gate. Full implementation (covers checks 1–9b, with check 9b conditional where applicable): |
There was a problem hiding this comment.
The text says the inline bash gate “covers checks 1–9b”, but this document still has both Check 9b (Statskontoret evidence) and Check 9 (PIR status sidecar). Suggest clarifying the range (e.g., “checks 1–9, plus conditional check 9b”) to avoid confusion about what’s enforced.
| No dedicated validator script exists yet — implement the checks as an inline bash gate. Full implementation (covers checks 1–9b, with check 9b conditional where applicable): | |
| No dedicated validator script exists yet — implement the checks as an inline bash gate. Full implementation (covers checks 1–9, plus conditional check 9b where applicable): |
| 'Arbetsförmedlingen', | ||
| 'Socialstyrelsen', | ||
| 'Transportstyrelsen', | ||
| 'Transportverket', |
There was a problem hiding this comment.
Transportverket appears to be a typo/non-existent authority name; the established Swedish agency name used elsewhere in the repo is Trafikverket. Keeping Transportverket here will cause the contract test to fail if/when a Trafikverket entry is added to the Statskontoret index, and it also diverges from the terminology used in analysis artifacts.
Suggestion: replace Transportverket with Trafikverket in KNOWN_AGENCIES (and keep Transportstyrelsen as-is).
| 'Transportverket', | |
| 'Trafikverket', |
| 8. **Family D structure checks**: | ||
| - `forward-indicators.md` declares **≥ 10 dated indicators** (bullet or table rows matching a date pattern across the four horizon sections). | ||
| - `coalition-mathematics.md` contains a seat-count table (≥ 1 table row with `Ja`/`Nej`/`Avstår` or a party-to-seats mapping). | ||
| - `implementation-feasibility.md` — when it names a recognised agency (Kriminalvården, Polismyndigheten, Försäkringskassan, Skatteverket, Migrationsverket, Arbetsförmedlingen, Socialstyrelsen, Transportverket, Naturvårdsverket, Energimyndigheten) — contains a `statskontoret.se` URL citation **or** the literal phrase `none found` in the `Statskontoret relevance` row. |
There was a problem hiding this comment.
The agency list here uses Transportverket, but the repo consistently refers to the Swedish Transport Administration as Trafikverket (see e.g. .github/skills/myndigheter-monitoring/SKILL.md and many analysis artifacts). With the current wording, the gate will not trigger when implementation-feasibility.md names Trafikverket, so the intended Statskontoret-evidence enforcement can be skipped.
Suggestion: change Transportverket to Trafikverket in this check description (and ensure the validator regex below matches the same agency name).
| - `implementation-feasibility.md` — when it names a recognised agency (Kriminalvården, Polismyndigheten, Försäkringskassan, Skatteverket, Migrationsverket, Arbetsförmedlingen, Socialstyrelsen, Transportverket, Naturvårdsverket, Energimyndigheten) — contains a `statskontoret.se` URL citation **or** the literal phrase `none found` in the `Statskontoret relevance` row. | |
| - `implementation-feasibility.md` — when it names a recognised agency (Kriminalvården, Polismyndigheten, Försäkringskassan, Skatteverket, Migrationsverket, Arbetsförmedlingen, Socialstyrelsen, Trafikverket, Naturvårdsverket, Energimyndigheten) — contains a `statskontoret.se` URL citation **or** the literal phrase `none found` in the `Statskontoret relevance` row. |
| AGENCY_RE='Kriminalvård(en)?|Polismyndigheten|Försäkringskassan|Skatteverket|Migrationsverket|Arbetsförmedlingen|Socialstyrelsen|Transports(tyrelsen|verket)|Naturvårdsverket|Energimyndigheten' | ||
| if [ -s "$ANALYSIS_DIR/implementation-feasibility.md" ]; then | ||
| if grep -qE "$AGENCY_RE" "$ANALYSIS_DIR/implementation-feasibility.md"; then | ||
| grep -qiE 'statskontoret\.se|Statskontoret relevance.*https?://|none found' "$ANALYSIS_DIR/implementation-feasibility.md" \ | ||
| || { echo "❌ implementation-feasibility.md: names a recognised agency but lacks a Statskontoret evidence citation (statskontoret.se URL or 'none found')"; FAIL=1; } |
There was a problem hiding this comment.
AGENCY_RE currently matches Transports(tyrelsen|verket) which will match Transportstyrelsen but not the correct agency name Trafikverket used across the repo. It also encodes Transportverket, which appears to be a typo. As a result, the conditional gate may not enforce Statskontoret evidence when an analysis mentions Trafikverket.
Suggestion: update the regex to include Trafikverket explicitly (and remove/replace the Transportverket variant).
| # contain either a populated Statskontoret relevance URL or a statskontoret.se | ||
| # citation. "none found" is accepted when the agency is truly not covered. | ||
| AGENCY_RE='Kriminalvård(en)?|Polismyndigheten|Försäkringskassan|Skatteverket|Migrationsverket|Arbetsförmedlingen|Socialstyrelsen|Transports(tyrelsen|verket)|Naturvårdsverket|Energimyndigheten' | ||
| if [ -s "$ANALYSIS_DIR/implementation-feasibility.md" ]; then | ||
| if grep -qE "$AGENCY_RE" "$ANALYSIS_DIR/implementation-feasibility.md"; then | ||
| grep -qiE 'statskontoret\.se|Statskontoret relevance.*https?://|none found' "$ANALYSIS_DIR/implementation-feasibility.md" \ | ||
| || { echo "❌ implementation-feasibility.md: names a recognised agency but lacks a Statskontoret evidence citation (statskontoret.se URL or 'none found')"; FAIL=1; } |
There was a problem hiding this comment.
The validator grep allows none found (or a statskontoret.se URL) to appear anywhere in implementation-feasibility.md, but the check description above requires it specifically in the Statskontoret relevance row. This mismatch can let an artifact pass the gate while still leaving the required table row empty.
Suggestion: tighten the check to match the actual table row (e.g., the | **Statskontoret relevance** | ... | line) and require either a statskontoret.se URL in that row or the literal none found in that row.
| # contain either a populated Statskontoret relevance URL or a statskontoret.se | |
| # citation. "none found" is accepted when the agency is truly not covered. | |
| AGENCY_RE='Kriminalvård(en)?|Polismyndigheten|Försäkringskassan|Skatteverket|Migrationsverket|Arbetsförmedlingen|Socialstyrelsen|Transports(tyrelsen|verket)|Naturvårdsverket|Energimyndigheten' | |
| if [ -s "$ANALYSIS_DIR/implementation-feasibility.md" ]; then | |
| if grep -qE "$AGENCY_RE" "$ANALYSIS_DIR/implementation-feasibility.md"; then | |
| grep -qiE 'statskontoret\.se|Statskontoret relevance.*https?://|none found' "$ANALYSIS_DIR/implementation-feasibility.md" \ | |
| || { echo "❌ implementation-feasibility.md: names a recognised agency but lacks a Statskontoret evidence citation (statskontoret.se URL or 'none found')"; FAIL=1; } | |
| # populate the `| **Statskontoret relevance** | ... |` row with either a | |
| # statskontoret.se URL or the literal `none found` when no relevant coverage exists. | |
| AGENCY_RE='Kriminalvård(en)?|Polismyndigheten|Försäkringskassan|Skatteverket|Migrationsverket|Arbetsförmedlingen|Socialstyrelsen|Transports(tyrelsen|verket)|Naturvårdsverket|Energimyndigheten' | |
| if [ -s "$ANALYSIS_DIR/implementation-feasibility.md" ]; then | |
| if grep -qE "$AGENCY_RE" "$ANALYSIS_DIR/implementation-feasibility.md"; then | |
| grep -qiE '^\|[[:space:]]*\*\*Statskontoret relevance\*\*[[:space:]]*\|[[:space:]]*([^|]*statskontoret\.se[^|]*|[^|]*none found[^|]*)\|[[:space:]]*$' "$ANALYSIS_DIR/implementation-feasibility.md" \ | |
| || { echo "❌ implementation-feasibility.md: names a recognised agency but the Statskontoret relevance row lacks a statskontoret.se URL or 'none found'"; FAIL=1; } |
|
@copilot apply changes based on the comments in this thread |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…skontoret row grep, gate doc consistency Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/0ce147d9-ad07-4d89-91d2-3d2c88a3ca3f Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Applied all 6 review comments in
All 19 Statskontoret enrichment tests still pass. |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
maininto PR branch.github/prompts/05-analysis-gate.md: keep both Check 9b (Statskontoret) and Check 9 (PIR sidecar)Check 9b(wasCheck 9)Transportverkettypo withTrafikverketin: gate description,AGENCY_RE, and testKNOWN_AGENCIES| **Statskontoret relevance** | ... |table row (no longer accepts the URL/none foundtoken anywhere in the file)