Skip to content

Comments

fix: mcp-client json resilience, monthly-review step docs, month-ahead REQUIRED_TOOLS conditional annotation#443

Merged
pethers merged 2 commits intonews-generation/weekly-review-2026-02-22-25732d3df5a3d00ffrom
copilot/sub-pr-433
Feb 22, 2026
Merged

fix: mcp-client json resilience, monthly-review step docs, month-ahead REQUIRED_TOOLS conditional annotation#443
pethers merged 2 commits intonews-generation/weekly-review-2026-02-22-25732d3df5a3d00ffrom
copilot/sub-pr-433

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

Three code-quality issues from review thread 3838367404 plus stale generated files from a concurrent article merge.

Code fixes

  • mcp-client.tsperformPost().json() non-JSON resilience
    JSON.parse(responseBody) was called unconditionally on non-2xx responses. If the server returns HTML/plain-text (e.g. rate-limit page), callers got an opaque SyntaxError. Now wrapped in try/catch with a structured error including status code and body snippet:

    json: async () => {
      try {
        return JSON.parse(responseBody) as unknown;
      } catch {
        throw new Error(`HTTP ${raw.status} ${raw.statusText}: non-JSON response body: ${responseBody.slice(0, 200)}`);
      }
    },
  • monthly-review.ts — fix JSDoc step order
    Header comment described the 5-step pipeline with steps 2 (get_dokument_innehall) and 3 (search_anforanden) swapped relative to the implementation. Updated to match actual execution: Step 2 = typed metadata fetchers, Step 3 = get_dokument_innehall, Step 4 = search_anforanden.

  • month-ahead.ts — document search_dokument as conditional in REQUIRED_TOOLS
    REQUIRED_TOOLS listed search_dokument unconditionally, but it is only invoked when get_calendar_events returns empty. Added inline comment and JSDoc note to prevent false validation failures on calendar-populated runs.

Generated file sync

Regenerated data/news-articles.json, all 14 news/index*.html files, and sitemap.xml to reflect articles on this branch after a concurrent article merge to the base affected those files.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ahead REQUIRED_TOOLS comment + regen indexes

Co-authored-by: pethers <[email protected]>
Copilot AI changed the title [WIP] Automate weekly review for parliamentary activity fix: mcp-client json resilience, monthly-review step docs, month-ahead REQUIRED_TOOLS conditional annotation Feb 22, 2026
Copilot AI requested a review from pethers February 22, 2026 17:34
@pethers pethers marked this pull request as ready for review February 22, 2026 18:00
@pethers pethers merged commit b98f709 into news-generation/weekly-review-2026-02-22-25732d3df5a3d00f Feb 22, 2026
@pethers pethers deleted the copilot/sub-pr-433 branch February 22, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants