Skip to content

The Report headline states what it counted - #280

Merged
node9ai merged 1 commit into
mainfrom
dev
Sep 2, 2026
Merged

The Report headline states what it counted#280
node9ai merged 1 commit into
mainfrom
dev

Conversation

@node9ai

@node9ai node9ai commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The monitor's Report headline 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 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 perSession through 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_USD now 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.00 with 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 scan still reports $48.69, so the correct number was not touched while the wrong one was removed.

🤖 Generated with Claude Code

…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.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🛡️ node9 agent-security · ✅

No agent-security findings — no injectable workflows, unsafe agent configs, or unpinned MCP servers.

@node9ai
node9ai merged commit a31ca71 into main Sep 2, 2026
14 checks passed
@node9ai

node9ai commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 2.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant