Conversation
…up cost It read `272 loops · ~$9.73 wasted`, from Σ(count) × COST_PER_LOOP_ITER_USD. Wrong three ways at once: - billed the first, legitimate call as waste (no threshold) - counted long-iteration findings as loops — 174 of the 272 are sustained work on one file - used the flat constant, measured ~170x below real per-session rates Two of those inflate and one deflates, so they partly cancel and land on $9.73 — while `node9 scan` reports $48.66 from exactly the same data. A number that looks reasonable and is built from three mistakes does not invite the scrutiny a visibly wrong one would. Now: `272 repeated patterns · 98 stuck`. Both figures are counts, both are true, and "loops" is dropped because most of these are not loops. Consistent with the `repeat calls` rename already shipped — say what was measured, not what someone might infer. Pricing it properly needs per-session rates, and this screen has no access to them. Threading perSession through three dashboard layers for one headline buys a third dollar figure in a product where two already exist and agree; a third is a third chance to disagree. The money stays on the screen that computes it correctly. Side effect worth naming: COST_PER_LOOP_ITER_USD now has ZERO production consumers. It is still exported from the engine, but "one place money is attached to a count" is enforced by the compiler rather than by discipline for the first time. The existing test asserted `$9.00` with the old arithmetic spelled out in a comment — flagged yesterday as pinning the bug. Rewritten to assert counts and the absence of a cost, scoped to the headline since the banner has its own spend indicator. Mutation-tested: dropping the long-iteration filter or moving the >100 threshold both turn the new tests red.
Contributor
🛡️ node9 agent-security · ✅No agent-security findings — no injectable workflows, unsafe agent configs, or unpinned MCP servers. |
Contributor
Author
|
🎉 This PR is included in version 2.7.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The monitor's Report headline read
272 loops · ~$9.73 wasted, fromΣ(count) × COST_PER_LOOP_ITER_USD. Wrong three ways at once:long-iterationfindings as loops; 174 of the 272 are sustained work on one fileTwo of those inflate and one deflates, so they partly cancel and land on
$9.73— whilenode9 scanreports$48.66from exactly the same data. A number that looks reasonable and is built from three mistakes does not invite the scrutiny a visibly wrong one would.Now
272 repeated patterns · 98 stuck. Both counts, both true, and "loops" is dropped because most of these are not loops.Pricing it properly needs per-session rates, which this screen has no access to. Threading
perSessionthrough three dashboard layers buys a third dollar figure in a product where two already exist and agree to the cent; a third is a third chance to disagree with itself. The money stays where it is computed correctly.Side effect worth naming:
COST_PER_LOOP_ITER_USDnow has zero production consumers. Still exported from the engine, but "one place money is attached to a count" is enforced by the compiler rather than by discipline for the first time.The existing test asserted
$9.00with the old arithmetic spelled out in its comment. Rewritten to assert counts and the absence of a cost, scoped to the headline since the banner has its own spend indicator.4,285 tests, typecheck, lint, format clean. Mutation-tested: dropping the long-iteration filter or moving the >100 threshold both turn the new tests red. Verified on real data —
node9 scanstill reports$48.69, so the correct number was not touched while the wrong one was removed.🤖 Generated with Claude Code