Skip to content

brief --include coverage returns coverage (the MCP shape), not the REST name stances - #33

Merged
makriman merged 2 commits into
mainfrom
fix/27-brief-include-coverage
Dec 5, 2026
Merged

makriman merged 2 commits into
mainfrom
fix/27-brief-include-coverage

Conversation

@makriman

@makriman makriman commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The README and the --include check both say brief --include takes coverage, but the output never has a coverage key. A caller following the README sees the brief text go and no coverage come back.

What is actually happening

The data is not lost. The REST payload calls the per-outlet framing stances (outlet, stance, note), and cmdBrief used coverage only as the switch that kept stances. So --include coverage returned the coverage data under the REST name stances. The issue's own key list shows stances in the output. The MCP get_brief tool returns the same data as coverage, [{outlet, framing, note}], so the CLI and MCP disagreed on the name for the same request. The issue got the naming mismatch right. "Always returns nothing" overstates it: the data came back, under a name nothing documented.

Change

This is the smallest honest fix on the CLI side: map the name and leave the API alone.

  • With --include coverage, the CLI and io.sh return coverage built from stances exactly as the MCP server builds it (IndianOpinion/mcp, src/tools.js: {outlet, framing: stance, note: note || null}).
  • With any --include, stances is dropped, so the output holds only the parts that were named, under their documented names.
  • Without --include, nothing changes: the REST payload comes through as it is, stances included.
  • The text view (--text) lists the coverage in both cases, as before.
  • README explains which name appears when. CHANGELOG.md has an Unreleased entry.

Tests

  • test/brief-coverage.test.mjs (CLI, and io.sh with jq): --include coverage gives coverage equal to the MCP mapping of the stub's stances, with no stances, brief, analysis or sources. Combined includes keep exactly what was named. --include brief has neither name. Without --include the payload equals the REST body. Before the fix the first test fails.
  • test/fixes.test.mjs #7: this test asserted the old behaviour (brief,coverage returns stances). It now expects coverage and no stances.

Commands run on this branch:

  • npm test (Node 22.23.4, jq 1.7, ../mcp installed): 34 tests, 34 pass, 0 skipped.
  • npm pack --dry-run: the same 6 files.
  • Not run: shellcheck, Node 20 and 24, and the live API. The REST field names come from the repo's stub and the MCP source, not from a fresh live call.

For the reviewer

  • This changes output for anyone who already used --include coverage and read stances. The documented name was always coverage, and the package is pre-1.0 and not yet on npm, so I think the fix is right. It is still a behaviour change, so it is called out in the CHANGELOG.
  • The other route is to expose coverage in the REST API itself. That is a server change, outside this repository, and the CLI mapping does not block it.

Fixes #27

…#27)

The REST payload carries the per-outlet framing as stances ({outlet,
stance, note}). --include coverage kept that array under its REST name,
so a caller following the README found no coverage key. With --include,
the CLI and io.sh now return it as coverage, [{outlet, framing, note}],
the shape the MCP get_brief tool uses, and drop stances. Without
--include the REST payload is unchanged. README says which name appears
when.

Test: test/brief-coverage.test.mjs; the #7 test now expects coverage.
@makriman

makriman commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

Review by Grok Bot (Indian Opinion QA agent)

Tested at head 5ffc33e. Verdict: works.

Fixes: #27. brief --include coverage now returns coverage as [{outlet, framing, note}], the same shape as the MCP get_brief tool, instead of the REST name stances.

What I checked

  • npm test: this head 34 tests, 33 pass, 0 fail, 1 skipped (the MCP bridge test, which skips on main too). Main: 32 tests, 31 pass.
  • Failing first: I copied test/brief-coverage.test.mjs onto main. 1 of 2 fails.
  • I compared with the MCP repo: IndianOpinion/mcp main src/tools.js:296 maps { outlet: s.outlet, framing: s.stance, note: s.note || null }. That is the same mapping this PR uses in the CLI and in io.sh.
  • Against the live public API (read-only GETs; brief id 1120696 was the newest at test time):
    • brief 1120696 --include coverage, CLI and io.sh: main returns stances ({"outlet":"ndtv.com","stance":"neutral-report",...}) and no coverage. This head returns coverage ({"outlet":"ndtv.com","framing":"neutral-report",...}) and no stances.
    • brief 1120696 with no --include: the same key list on main and this head, stances included.

Review

  • Small README nit, not blocking. The new paragraph says "With --include, only the named parts are kept". Live, --include coverage still returns about 40 other metadata keys (id, title, url, published, qa_state and so on). Only brief, analysis, sources and stances are dropped. Something like "the parts you did not name (brief, analysis, sources, coverage) are dropped; the brief's metadata stays" would be exact.

Automated checks (this head vs current main)

Command This PR main
npm ci exit 0 exit 0
npm test exit 0: ℹ tests 34; ℹ pass 33; ℹ fail 0 exit 0: ℹ tests 32; ℹ pass 31; ℹ fail 0
npm audit --omit=dev found 0 vulnerabilities found 0 vulnerabilities

I'm Grok Bot, the automated QA agent for Indian Opinion. This is a comment-only review. I don't approve, request changes or merge. Local stack: PHP 8.4.28, Composer 2.11.3, MariaDB 11.8.9, Node 24.22.1, WordPress 7.1.5.

@makriman
makriman marked this pull request as ready for review December 5, 2026 20:12
@makriman
makriman merged commit c0302ae into main Dec 5, 2026
4 checks passed
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.

brief --include coverage is documented and validated but always returns nothing (REST calls it stances)

1 participant