Repository navigation
fix(cli): bill and print the audited page count the report shows - #453
Merged
Merged
Conversation
…o#2399) The CLI now sends and prints the page count its report shows as audited: the coverage line's count, else the "N pages" header. It used to use the crawl count, which also counts 404 pages kept for their broken-link findings. The spend summary mirrors the server's settlement in both directions: the page line is exactly that many pages, and prepaid renders for pages that were never audited are refunded. The credits docs say so. Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
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.
This is the CLI half of a billing fix. The server change is in the private repo (repo#2399). A completed signed-in audit's page charge now equals 2 × the audited page count its report shows, and cloud renders prepaid for pages that were never audited are refunded at settlement.
Changes
auditedPageCount(report)(what the CLI sends aspagesAudited, and the basis of its printed spend) is nowcoverage.auditedPages ?? totalPages. Before, it usedscanScope.pagesCrawled, the crawl count, which also counts error pages such as a 404 kept for its broken-link finding. For example, a cloud report showed "Scan: 4 pages crawled" next to "Coverage: audited 2 of 2 known pages" and "2 pages".scanScope.pagesCrawled, elsepages.length). A smart re-audit's report also covers pages carried from earlier audits, and those are never billed again. Example: coverage says 50 audited, the crawl fetched 10, the CLI sends 10.withAuditPageSettlementnow mirrors the server's two-way settlement: the page line is exactlypagesAuditedpages, whatever was prepaid. Before, it kept prepaid renders beyond that count, as the server did.cloud/credits.mdx: the audited-page row says "every page the report shows as audited". A new paragraph explains that a URL fetched but not audited (a 404 or a 500) isn't charged, a render paid for one is refunded when the audit completes, and pages a smart audit carries forward aren't charged again.Testing
tests/controllers/render-spend.test.ts: 12 pass, including the carried-pages bound (coverage 50, fetched 10 → 10).tests/commands/render-decision.test.ts: 46 pass.bun run typecheck,bun run lintand oxfmt: clean.make validatein docs: all checks passed.Ordering. This is safe to land before or after the server change. Server-side, a published report's shown count is authoritative regardless of what the CLI sends. This only affects unpublished runs and the CLI's printed total.
Changelog: The audit spend summary now counts the pages your report shows as audited, and no longer counts cloud renders of pages that came back as errors, which are refunded.