Skip to content

Enforce methodology-reflection contract: 9 required sections + gate/test validation for KJ coverage, posterior confidence, and re-run schema#2496

Merged
pethers merged 6 commits into
mainfrom
copilot/improve-analysis-templates-coverage
May 15, 2026
Merged

Enforce methodology-reflection contract: 9 required sections + gate/test validation for KJ coverage, posterior confidence, and re-run schema#2496
pethers merged 6 commits into
mainfrom
copilot/improve-analysis-templates-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

  • Anchor required-section checks in scripts/agentic/analysis-gate.ts to ## markdown headings (with optional leading emoji) instead of loose phrase-anywhere matches
  • Validate Devil's-Advocate KJ Coverage Matrix content in methodology-reflection.md: no rows and no OPEN statuses on KJ rows (100% coverage enforced)
  • Validate Confidence Distribution content: every KJ row has a filled Posterior cell (no [REQUIRED] placeholder, no empty cell, locates Posterior column from header)
  • Validate Re-run Log unified schema as a markdown table header row inside the Re-run Log section (not anywhere in the file)
  • Extend checkDevilsAdvocate to require ## Key Judgment Coverage Matrix heading with 100% KJ coverage (no rows)
  • Mirror all heading-anchored / content-quality checks in inline bash gate at .github/prompts/05-analysis-gate.md (including awk-based posterior column validation)
  • Align methodology-reflection.md template: contract now matches actual emoji headings used in the template; add Impact note column to Lagrådet table to match canonical lagradet-tracking.md fragment
  • Update structural gate spec text in 05-analysis-gate.md to document the new content-quality requirements
  • Add 7 new tests covering emoji headings, phrase-only-body rejection, ❌ rows, empty/placeholder Posterior cells, Re-run Log section-scoping, and Devil's-Advocate KJ matrix enforcement (84/84 tests pass)

@github-actions github-actions Bot added the size-xs Extra small change (< 10 lines) label May 14, 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

Copilot AI changed the title [WIP] Enforce 100% KJ coverage and unify templates Enforce methodology-reflection contract: 9 required sections + gate/test validation for KJ coverage, posterior confidence, and re-run schema May 15, 2026
@github-actions github-actions Bot added documentation Documentation updates testing Test coverage refactor Code refactoring size-l Large change (250-1000 lines) labels May 15, 2026
Copilot AI requested a review from pethers May 15, 2026 00:18
@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 May 15, 2026 06:12
Copilot AI review requested due to automatic review settings May 15, 2026 06:12
@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

This PR hardens the agentic analysis gate and templates around methodology-reflection.md, making previously informal run-audit requirements explicit across templates, prompt documentation, gate logic, and tests.

Changes:

  • Expands methodology-reflection requirements to nine required sections.
  • Adds related template guidance for KJ coverage, posterior confidence, and Lagrådet/Statskontoret/SKR tracking.
  • Updates TypeScript and prompt-level gate checks plus unit tests for the new methodology-reflection contract.

Reviewed changes

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

Show a summary per file
File Description
tests/agentic-analysis-gate.test.ts Adds shared valid methodology-reflection fixture and updates Family C tests.
scripts/agentic/analysis-gate.ts Replaces loose methodology-reflection check with nine required-section predicates.
analysis/templates/methodology-reflection.md Adds gate-enforced required-section contract and supporting tables.
analysis/templates/lagradet-tracking.md Adds reusable tracking fragment for legal/implementation signals.
analysis/templates/intelligence-assessment.md Adds posterior confidence distribution table guidance.
analysis/templates/devils-advocate.md Adds required KJ coverage matrix guidance.
.github/prompts/05-analysis-gate.md Updates analysis gate prompt and inline shell checks for the new contract.
.github/prompts/04-analysis-pipeline.md Updates artifact catalogue expectations for methodology-reflection.


## 🎯 Key Judgment Coverage Matrix (Required)

> **[REQUIRED]** Before writing hypotheses, list **every** KJ from `intelligence-assessment.md` and map it to at least one challenge row. Gate expectation: **100% KJ coverage**.
Comment on lines +797 to +835
const requiredSectionChecks: Array<{ label: string; present: boolean }> = [
{ label: 'ICD 203 audit checklist', present: /ICD\s+203/i.test(content) },
{
label: "Devil's-Advocate KJ coverage matrix",
present: /Devil'?s[-\s]Advocate.*(KJ|Key\s+Judgment).*Coverage/i.test(content),
},
{
label: 'Confidence distribution with posterior',
present: /Confidence\s+Distribution/i.test(content) && /Posterior/i.test(content),
},
{
label: 'Lagrådet / Statskontoret / SKR tracking',
present: lower.includes('lagrådet') &&
lower.includes('statskontoret') &&
(lower.includes('skr') || lower.includes('sveriges kommuner')),
},
{
label: 'Sibling-folder ingestion record',
present: /Sibling[-\s]?Folder\s+Ingestion/i.test(content),
},
{
label: 'Re-run log unified schema',
present: hasReRunColumns,
},
{
label: 'Banned-phrase audit grid',
present: /Banned[-\s]?Phrase\s+Audit/i.test(content),
},
{
label: 'Pass 1 to Pass 2 delta table',
present: lower.includes('pass 1') && lower.includes('pass 2') && lower.includes('delta'),
},
{
label: 'Improvement opportunities linked to PIR roll-forward',
present: lower.includes('improvement opportunities') &&
lower.includes('pir') &&
lower.includes('roll-forward'),
},
];
Comment thread .github/prompts/05-analysis-gate.md Outdated
Comment on lines +233 to +238
grep -qiE 'Banned[-[:space:]]?Phrase[[:space:]]+Audit' "$REF" \
|| { echo "❌ methodology-reflection.md: missing banned-phrase audit grid"; FAIL=1; }
grep -qiE 'Pass[[:space:]]*1.*Pass[[:space:]]*2.*Delta' "$REF" \
|| { echo "❌ methodology-reflection.md: missing Pass 1→Pass 2 delta table"; FAIL=1; }
grep -qiE 'Improvement[[:space:]]+Opportunities.*PIR[[:space:]]+Roll[-[:space:]]?Forward' "$REF" \
|| { echo "❌ methodology-reflection.md: missing improvement opportunities to PIR roll-forward section"; FAIL=1; }

---

## 🎯 Devil's-Advocate Key Judgment Coverage Matrix
Comment on lines +140 to +144
| Track | Applicability | Status | Latest evidence (URL + date) | Next check |
|-------|:-------------:|--------|-------------------------------|------------|
| Lagrådet yttrande | Y/N | `not applicable / referral pending / yttrande published` | `[REQUIRED]` | `[REQUIRED]` |
| Statskontoret implementation signal | Y/N | `found / none found / not triggered` | `[REQUIRED]` | `[REQUIRED]` |
| SKR operational impact signal | Y/N | `found / none found / not triggered` | `[REQUIRED]` | `[REQUIRED]` |
Comment thread scripts/agentic/analysis-gate.ts Outdated
Comment on lines +797 to +801
const requiredSectionChecks: Array<{ label: string; present: boolean }> = [
{ label: 'ICD 203 audit checklist', present: /ICD\s+203/i.test(content) },
{
label: "Devil's-Advocate KJ coverage matrix",
present: /Devil'?s[-\s]Advocate.*(KJ|Key\s+Judgment).*Coverage/i.test(content),
Comment on lines +803 to +806
{
label: 'Confidence distribution with posterior',
present: /Confidence\s+Distribution/i.test(content) && /Posterior/i.test(content),
},
Comment thread .github/prompts/05-analysis-gate.md Outdated
grep -qiE "Devil'?s[-[:space:]]Advocate.*(KJ|Key[[:space:]]+Judgment).*Coverage" "$REF" \
|| { echo "❌ methodology-reflection.md: missing Devil's-Advocate KJ-coverage matrix"; FAIL=1; }
grep -qiE 'Confidence[[:space:]]+Distribution' "$REF" || { echo "❌ methodology-reflection.md: missing confidence distribution section"; FAIL=1; }
grep -qiE 'Posterior' "$REF" || { echo "❌ methodology-reflection.md: missing Posterior column/marker"; FAIL=1; }
@pethers
Copy link
Copy Markdown
Member

pethers commented May 15, 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

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot apply changes based on the comments in this thread

Addressed all 8 review-thread findings in 8019abe:

  • Gate checks (both analysis-gate.ts and inline bash in 05-analysis-gate.md) are now anchored to ## markdown headings with optional leading emoji, so phrase-anywhere matches no longer pass.
  • New content-quality checks: Devil's-Advocate KJ Coverage Matrix must have no /OPEN rows (100% coverage), and every KJ row in the Confidence Distribution table must have a filled Posterior cell (no [REQUIRED] placeholder, no empty cell). Re-run log unified schema must appear as a table header inside the Re-run Log section.
  • checkDevilsAdvocate now enforces the ## Key Judgment Coverage Matrix section with 100% coverage in devils-advocate.md itself.
  • methodology-reflection.md template: contract entries now match the actual emoji headings; Lagrådet table gained the Impact note column to match the canonical lagradet-tracking.md fragment.
  • 7 new tests cover emoji headings, phrase-only-body rejection, /OPEN rows, empty/placeholder Posterior cells, and Re-run Log section scoping — 84/84 gate tests pass.

@github-actions github-actions Bot added the html-css HTML/CSS changes label May 15, 2026
@github-actions github-actions Bot added translation Translation updates html-css HTML/CSS changes rtl RTL language support (Arabic, Hebrew) news News articles and content generation size-xl Extra large change (> 1000 lines) labels May 15, 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

@pethers pethers requested a review from Copilot May 15, 2026 13:07
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 wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@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 18d17e2 into main May 15, 2026
16 checks passed
@pethers pethers deleted the copilot/improve-analysis-templates-coverage branch May 15, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates html-css HTML/CSS changes news News articles and content generation refactor Code refactoring rtl RTL language support (Arabic, Hebrew) size-l Large change (250-1000 lines) size-xl Extra large change (> 1000 lines) size-xs Extra small change (< 10 lines) testing Test coverage translation Translation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Analysis Templates] Enforce 100% KJ coverage, complete Family-E per-document, and unify re-run / confidence templates

3 participants