Repository navigation
fix(adsense): show report warnings and truncation in table output - #1324
saariuslystoned wants to merge 4 commits into
Conversation
adsense reports query JSON output includes the API's warnings and totalMatchedRows, but table and --plain output dropped both, so a report cut short by --max or the 100,000-row limit looked complete. Print them on stderr, keeping stdout parseable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The empty-report early return ran before the new stderr notes, so warnings explaining an empty report were still dropped in table and --plain output. Print the notes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThe PR shows AdSense report warnings and truncation counts on stderr in table and plain output. Example: A report for pub-123 returns 2 rows, 250000 matched rows, and an API warning.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a real omission still present on main. The prior saved-report hint finding is resolved, and no actionable defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAd hoc and saved-report commands retrieve AdSense API responses and pass them to a shared writer that produces JSON or table stdout and human diagnostics on stderr. flowchart TD
A[Ad hoc report command] --> C[AdSense API client]
B[Saved report command] --> C
C --> D[Shared report writer]
D --> E[JSON stdout]
D --> F[Table stdout]
D --> G[Diagnostic stderr]
Technical reviewBest possible solution: Retain the shared-writer fix with command-specific recovery advice and diagnostics confined to stderr. Do we have a high-confidence way to reproduce the issue? Current-main source directly shows the omission, and the contributor supplies matching before/after CLI output; no target code or tests were run during this read-only review. Is this the best way to solve the issue? The existing shared writer is the smallest complete owner for both report paths, and its early JSON return preserves structured output. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 9, 2026, 11:34 AM ET / 16:34 UTC (Revision 2). |
Saved reports have no --max flag, so suggest narrowing the saved report instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thank you for the fix. I reproduced the claim and consolidated showing AdSense warnings and truncation hints on stderr into #1336, with regression coverage and your coauthor credit retained. The full |
What problem this solves
adsense reports queryJSON output includes the API'swarningsandtotal_matched_rows. Table and--plainoutput drop both.Per the AdSense limits and the reports.generate reference, a report is truncated at
limit(default and maximum 100,000 rows). Truncation can only be detected by comparing the rows returned withtotalMatchedRows. In table and--plainmode, a report cut short by--maxor by the 100,000-row limit therefore looks complete, and any API warnings are never shown.Change
In table and
--plainoutput,writeAdSenseReportResultnow prints these on stderr, so stdout stays parseable. They also print for a report with no rows, where a warning may be the only explanation:# Warning: …;totalMatchedRowsexceeds the rows returned,# Showing N of M matched rows; … to see more. Ad hoc reports suggest raising--max(up to 100000) or narrowing the report.adsense reports saved query, which has no--max, suggests narrowing the saved report, for example its date range.JSON output is unchanged.
Evidence
TestExecute_AdSenseReportsQuery_TableShowsTruncationAndWarningsrunsadsense reports queryin text and--plainmode against anhttptestserver. The server returns 2 rows,totalMatchedRows: 250000and one warning.main(e8428c3), stderr is empty.TestExecute_AdSenseReportsQuery_EmptyTableStillShowsWarningsreturnsrows: []with one warning. Onmainstderr is onlyNo AdSense report rows; with this change the warning is shown as well.The existing AdSense tests pass.
TestExecute_AdSenseSavedReportTruncationHintHasNoMaxFlagchecks that the saved-report note doesn't mention--max.Built
gogbinaries frommainand from this branch were run against a local AdSense stand-in throughGOG_GOOGLE_API_BASE_URL. The stand-in is not Google:Every
make cistep passed on44384da(go1.27.3). The Go test suite ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.☁️
🤖 Generated with Claude Code