MCP cost rows: derive the asserted field list from CostRow so a dropped field fails
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read tokenjam/mcp/server.py and the parity tests, especially test_get_cost_summary_http_mode_preserves_complete_rows and _proj_cost. Start by examining how those tests currently enumerate CostRow fields; use dataclasses.fields(CostRow) as the issue directs. Done when adding a field to CostRow and the REST route but omitting it from the MCP serializer makes at least one test fail.
Written by the indexing model from the issue text.
Description
tokenjam/mcp/server.py's cost-row serializer and _HttpDB both enumerate CostRow's fields by hand, so a field added to CostRow and to the REST route can be dropped by MCP with nothing failing. That is the exact shape of #565, which this would let recur.
Established by experiment during the #751 review. Two directions:
A — the _HttpDB half IS gated. Added reasoning_tokens: int = 0 to CostRow, wired it into the REST /cost row dict and the MCP serializer, deliberately not into _HttpDB. Result: test_get_cost_summary_http_mode_preserves_complete_rows fails. Good.
B — the serializer half is NOT. Same field on CostRow and the REST route, omitted from the MCP serializer (and _HttpDB). Result: 80 passed across test_mcp_server.py, test_storage_backend_parity.py and test_data_access_parity.py. Nothing fails, and MCP silently under-reports.
B is #565 happening again. The reason A catches anything is incidental — the hand-written fake_response lacks the field, so _HttpDB not setting it makes the serializer raise. Neither test is actually checking coverage of CostRow.
_proj_cost in the parity test has the same weakness: r.call_count is appended by hand, so it drifts identically.
Fix direction: derive the asserted field list from dataclasses.fields(CostRow) in both test_get_cost_summary_http_mode_preserves_complete_rows and _proj_cost, so adding a field to the dataclass forces every serializer along the path to carry it or fail.
Done when: adding a field to CostRow and to the REST route, while omitting it from the MCP serializer, fails at least one test. Verify by doing exactly that, not by inspection — the point of this issue is that inspection said the gate existed and experiment said it did not.
Surfaced while verifying #751, which fixed the immediate _HttpDB breakage; this is the recurrence gate that PR could not reasonably be held for.
- Dominant language
- Python
- Stars
- 122
- Forks
- 35
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 8
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Metabuilder-Labs/tokenjam
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Metabuilder-Labs/tokenjam#786 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Metabuilder-Labs/tokenjam#728 ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Metabuilder-Labs/tokenjam#591 ·
Maintainers usually reply within 1 day
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Metabuilder-Labs/tokenjam#559 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Metabuilder-Labs/tokenjam#332 ·
Maintainers usually reply within 1 day
All issues in Metabuilder-Labs/tokenjam
Similar issues
-
[Bug]: IndexHandler.post crashes with HTTP 500 on malformed payloads, missing credentials, or when login is disabledPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 6 days
-
github_actions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
collective/icalendar#2003 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openzim/python-scraperlib#360 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
volcengine/OpenViking#6445 ·
Maintainers usually reply within 1 day