Repository navigation
Conversation
Culled a candidate list of possibly-redundant tests down to only the ones individually verified as fully subsumed elsewhere by comparing exact input/output assertions against their claimed survivors. Two deletions required porting a missing assertion into the surviving test first (format_tokens' k->M boundary case, and _build_payload's span-name propagation) so no coverage was lost. The majority of candidates did not hold up under verification and were left in place. Co-Authored-By: Claude <[email protected]>
|
| Filename | Overview |
|---|---|
| tests/integration/test_api.py | Removes several API smoke and duplicate framing tests; the /status plan-tier matrix was not fully redundant with the separately wired /traces route. |
| tests/unit/test_demo_live.py | Moves span-name payload coverage into the stronger end-to-end LiveSink.flush() test. |
| tests/unit/test_formatting.py | Adds the missing just-below-million boundary before duplicate humanize tests are removed. |
| tests/unit/test_export_claude_code.py | Removes mode-specific cases whose asserted figure selection is unconditional in the renderer. |
| tests/unit/test_export_route_generators.py | Removes subscription and unknown cases that traverse the same unconditional shared figure-selection helper. |
| tests/unit/test_time_parse.py | Removes a multi-digit-hour case that follows the same regex and conversion path as the surviving hour test. |
Comments Outside Diff (1)
-
tests/integration/test_api.py, line 637-640 (link)Preserve status framing coverage
The removed plan-tier matrix covered
/status's independently maintained framing wiring, while this surviving test only checks key presence for an API plan. Retaining a/statuspricing-mode assertion protects against status-specific wiring regressions that make the UI frame subscription, local, or unknown costs incorrectly even when the separate/tracesmatrix passes.Prompt To Fix With AI
This is a comment left during a code review. Path: tests/integration/test_api.py Line: 637-640 Comment: **Preserve status framing coverage** The removed plan-tier matrix covered `/status`'s independently maintained framing wiring, while this surviving test only checks key presence for an API plan. Retaining a `/status` pricing-mode assertion protects against status-specific wiring regressions that make the UI frame subscription, local, or unknown costs incorrectly even when the separate `/traces` matrix passes. --- For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
### Issue 1
tests/integration/test_api.py:637-640
**Preserve status framing coverage**
The removed plan-tier matrix covered `/status`'s independently maintained framing wiring, while this surviving test only checks key presence for an API plan. Retaining a `/status` pricing-mode assertion protects against status-specific wiring regressions that make the UI frame subscription, local, or unknown costs incorrectly even when the separate `/traces` matrix passes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "test: remove verified-redundant test cas..." | Re-trigger Greptile
Summary
Verified a list of 45 candidate tests flagged by a prior file-level audit as possibly redundant, and deleted only the ones I could prove were fully subsumed elsewhere by comparing exact input/output assertions. 16 of the 45 candidates verified as genuinely redundant and were deleted (21 pytest test-IDs once parametrize expansion is counted); the other 29 did not hold up under verification and were left in place. Two deletions required porting one assertion each into the surviving test first, to avoid losing coverage.
This is a test-only change. No product source under
tokenjam/was touched.Deleted (16 candidates, 21 test-IDs)
tests/unit/test_humanize.py(3):test_format_tokens_sub_thousand_is_raw,test_format_tokens_thousands_use_k,test_format_tokens_millions_use_m—tokenjam/utils/formatting.pyre-exports the identicalformat_tokensfunction object, already covered bytest_formatting.py::TestFormatTokens. Ported: that survivor was missing the k→M upper boundary (999_000 == "999.0k"), so I addedTestFormatTokens.test_just_below_millionbefore deleting.tests/integration/test_api.py(3 functions / 6 test-IDs):test_status_framing_reflects_plan_tier(a 4-case parametrize) — the/statusand/tracesroutes wirecompute_framingvia byte-identical code, the/tracesversion of this matrix survives, andstatus_response_includes_framing_blockstill guards/status's own key presence;test_docs_endpoint_is_accessible— a bare FastAPI/docs200 check with no product logic;test_optimize_response_includes_framing_block— a strict subset oftest_optimize_chain_framing_and_recoverable_fields(identical setup, plus more assertions).tests/integration/test_demos.py(1):test_demo_list_shows_descriptions— strictly weaker thantest_demo_list_shows_all_scenarios(same invocation,len(output) > 0vs. specific substrings).tests/integration/test_tokenmaxx_serve.py(1):test_tokenmaxx_cli_errors_cleanly_without_serve_or_conn— subsumed bytests/unit/test_cmd_tokenmaxx.py::test_requires_direct_db_connection, whose own comment cross-references this file.tests/unit/test_demo_live.py(1):test_build_payload_shape. Ported: its only assertion not covered elsewhere (spans[0]["name"]propagating through_build_payload) was added as a new assertion insidetest_live_sink_buffers_and_flushes, which exercises the same payload construction through the realflush()path.tests/unit/test_export_claude_code.py(2):test_render_subscription_user_carries_usd_savings_too,test_render_unknown_plan_carries_usd_savings_too— verified against source thatrender_claude_code_snippetno longer branches onpricing_mode/plan_tierfor which fields appear (product decision); added a short comment documenting the invariant in place of the deleted docstrings.tests/unit/test_export_route_generators.py(2 functions / 4 test-IDs, each parametrized over both renderers):test_subscription_user_carries_usd_savings_too,test_unknown_plan_carries_usd_savings_too— same invariant, verified against bothrender_ccr_configandrender_litellm_configsource.tests/unit/test_harness_setup.py(1):test_helper_relpath_is_under_tj—HELPER_RELPATH's exact value is verified more strongly (exact-match, not just prefix) bytests/unit/test_mcp_server.py:409via a real MCP-tool code path.tests/unit/test_models.py(1):test_alert_type_values— all three asserted enum spellings (cost_budget_daily,retry_loop,drift_detected) are independently verified via real serialization intest_mcp_server.py,test_demo_live.py, andtest_demos.py.tests/unit/test_time_parse.py(1):test_hours_large— verified in source thatparse_sincehas no branch on digit count; identical regex path totest_hours.Skipped as unverifiable (29 candidates)
The verification bar was: prove every assertion is checked elsewhere, or leave the test in place. 29 of the 45 candidates did not clear that bar. Notable findings where the original audit's premise turned out to be factually wrong on inspection:
tests/integration/test_cli.py(2):test_doctor_onboarding_signal_info_when_silent/_ok_with_spansare the only tests provingcmd_doctor.py'schecks.append(_check_onboarding_first_signal(...))line is wired intotj doctor --json's output — the claimed unit-test survivors only call the check function directly, never through the CLI's ~20-line manually-maintained checks list.tests/integration/test_summarize_cli.py(5): each "human-output" test exercises a distinct call site of a shared print helper (_print_verdict,_print_amortization) with its own independent wiring; no unit test covers the actual rendered text at all. One candidate (test_prep_via_api_unknown_model_labels_estimate) covers a fallback branch (rates_known=False) that literally no other test reaches.tests/unit/test_drift.py(1): the claimed synthetic-test survivor always registers an explicitAgentConfigfor the test agent, so it never exercisesdrift.py:232'sself.config.agents.get(agent_id) or AgentConfig()fallback that the candidate is testing.tests/unit/test_onboard_first_run.py(4): one candidate's own docstring starts with "Regression:" — a hard no-touch per this suite's convention regardless of audit findings — and it uniquely guards four legacy-panel strings. A second candidate's claimed premise ("prompt was permanently removed") is false; I read the source and the guarded code is still live, gated by anif persona == "claude-code": returnthat this test protects.tests/unit/test_formatting.py(4): the audit's own stated reasoning ("one representative + fallback is enough") contradicts its "drop all 4" instruction, and no other test anywhere referencesseverity_colour.tests/unit/test_models.py(5 of 6): onlyAlertType's literal spelling is verified elsewhere via real JSON output;Severity,SpanStatus.UNSET,SpanKind, and bothisinstance(_, str)checks are only ever compared enum-to-enum elsewhere, never enum-to-literal.Full per-file reasoning is in the worker session; ask if you want it broken out further.
Test plan
tests/unit/ tests/synthetic/ tests/agents/ tests/integration/,-n auto) before (viagit stash) and after: 5196 total test-IDs before, 5176 after — a net of -20, reconciling exactly against the ledger above (21 deleted, 1 ported/added).test_onboard_first_run.py::test_home_when_db_populated_but_no_config_is_set_up) reproduces identically on unmodifiedmainand in a file this PR never touches — confirmed flaky/order-dependent, out of scope here.🤖 Generated with Claude Code