Skip to content

feat: Statskontoret agency-capacity enrichment layer#2043

Merged
pethers merged 6 commits intomainfrom
copilot/add-statskontoret-enrichment-layer
Apr 27, 2026
Merged

feat: Statskontoret agency-capacity enrichment layer#2043
pethers merged 6 commits intomainfrom
copilot/add-statskontoret-enrichment-layer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

  • Merge latest main into PR branch
  • Resolve conflict in .github/prompts/05-analysis-gate.md: keep both Check 9b (Statskontoret) and Check 9 (PIR sidecar)
  • Apply review feedback (PR thread #4180171617):
    • SKILL.md → reference Check 9b (was Check 9)
    • Gate intro → "checks 1–9, plus conditional check 9b"
    • Replace Transportverket typo with Trafikverket in: gate description, AGENCY_RE, and test KNOWN_AGENCIES
    • Tighten gate grep to match the actual | **Statskontoret relevance** | ... | table row (no longer accepts the URL/none found token anywhere in the file)
  • Verify all 19 Statskontoret enrichment tests pass

Copilot AI linked an issue Apr 27, 2026 that may be closed by this pull request
5 tasks
@github-actions github-actions Bot added the size-xs Extra small change (< 10 lines) label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…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>
@github-actions github-actions Bot added documentation Documentation updates testing Test coverage refactor Code refactoring skill Skill configuration size-l Large change (250-1000 lines) labels Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…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>
Copilot AI changed the title [WIP] Add Statskontoret enrichment layer for agency capacity evidence feat: Statskontoret agency-capacity enrichment layer Apr 27, 2026
Copilot AI requested a review from pethers April 27, 2026 01:01
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers marked this pull request as ready for review April 27, 2026 08:05
Copilot AI review requested due to automatic review settings April 27, 2026 08:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 27, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot resolve the merge conflicts in this pull request

Merge conflicts are already resolved — commit d7fc56af8 ("Merge branch 'main' into copilot/add-statskontoret-enrichment-layer") successfully merged the latest main into this branch. Working tree is clean, no conflict markers remain, and all 45 related tests pass.

@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 27, 2026

@copilot resolve the merge conflicts in this pull request

…Check 9 (PIR sidecar)

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 2db75db. The conflict in .github/prompts/05-analysis-gate.md was between Check 9b (Statskontoret agency evidence, from this PR) and Check 9 (PIR status sidecar, added on main). Both checks are retained in the merged result.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

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).
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
- 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).

Copilot uses AI. Check for mistakes.
Comment thread .github/prompts/05-analysis-gate.md Outdated
## 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):
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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):

Copilot uses AI. Check for mistakes.
'Arbetsförmedlingen',
'Socialstyrelsen',
'Transportstyrelsen',
'Transportverket',
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
'Transportverket',
'Trafikverket',

Copilot uses AI. Check for mistakes.
Comment thread .github/prompts/05-analysis-gate.md Outdated
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.
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
- `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.

Copilot uses AI. Check for mistakes.
Comment thread .github/prompts/05-analysis-gate.md Outdated
Comment on lines +240 to +244
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; }
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment thread .github/prompts/05-analysis-gate.md Outdated
Comment on lines +238 to +244
# 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; }
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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 uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 27, 2026

@copilot apply changes based on the comments in this thread

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot apply changes based on the comments in this thread

Applied all 6 review comments in 6c0fa13:

  • SKILL.md → references Check 9b (was Check 9)
  • Gate intro → "checks 1–9, plus conditional check 9b where applicable"
  • Replaced Transportverket typo with Trafikverket in the gate's agency list, AGENCY_RE, and the test's KNOWN_AGENCIES
  • Tightened the gate's grep to match the actual | **Statskontoret relevance** | … | row, so the URL/none found token must appear in that row specifically — not anywhere in the file

All 19 Statskontoret enrichment tests still pass.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers merged commit 1858f03 into main Apr 27, 2026
16 checks passed
@pethers pethers deleted the copilot/add-statskontoret-enrichment-layer branch April 27, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates refactor Code refactoring size-l Large change (250-1000 lines) size-xs Extra small change (< 10 lines) skill Skill configuration testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Methodology] Add Statskontoret enrichment layer (agency-capacity ground truth)

3 participants