Add report_error log frequency mode#11971
Conversation
Co-Authored-By: Oz <oz-agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
Adds ReportErrorLogMode so report_error! and report_if_error! callers can opt into per-run log suppression while preserving the default every-time behavior. The implementation is small, localized to warp_core error reporting, and includes a focused logger-based test for the direct report_error! behavior.
Concerns
- No blocking correctness, security, or spec-alignment concerns found.
- One non-blocking test coverage suggestion is noted inline for the new macro surface.
Verdict
Found: 0 critical, 0 important, 1 suggestions
Approve with nits
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Co-Authored-By: Oz <oz-agent@warp.dev> Co-Authored-By: Aloke Desai <alokedesai@users.noreply.github.com>
Co-Authored-By: Aloke Desai <alokedesai@users.noreply.github.com>
## Description Updates the GraphQL client type drift error reports that end with `Make sure to update client GraphQL types!` to use the `ReportErrorLogMode::OncePerRun` option introduced by #11971. This applies to 12 enum-conversion fallback paths across: - `app/src/server/server_api/ai.rs` - `app/src/workspaces/gql_convert.rs` Each matching `report_error!` call now passes `warp_core::errors::ReportErrorLogMode::OncePerRun`, so repeated hits from the same call site are logged only once per app run instead of on every invocation. ## Linked Issue N/A — Slack follow-up. - [ ] The linked issue is labeled `ready-to-spec` or `ready-to-implement`. - [ ] Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). ## Testing - [x] `./script/format` - [x] `./script/format --check` - [x] Evidence script: checked 12 `Make sure to update client GraphQL types!` call sites and confirmed all use `warp_core::errors::ReportErrorLogMode::OncePerRun` - [x] `cargo clippy -p warp --all-targets --tests -- -D warnings` - [x] `cargo nextest run -p warp_core -E 'test(report_error_log_mode_controls_log_frequency)'` — passed, proving the once-per-run mode logs once across two hits of the same call site - [ ] I have manually tested my changes locally with `./script/run` ### Screenshots / Videos N/A — no UI change. ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-NONE Co-Authored-By: Oz <oz-agent@warp.dev> _Conversation: https://staging.warp.dev/conversation/b3b97505-1e9f-427c-b87d-7f8757773bd3_ _Run: https://oz.staging.warp.dev/runs/019e7f0b-9f95-72e6-bb15-5b5b3ad074db_ _This PR was generated with [Oz](https://warp.dev/oz)._ Co-authored-by: Oz <oz-agent@warp.dev>
Description
Adds a
ReportErrorLogModeenum forreport_error!so call sites can choose between the existing defaultEveryTimebehavior and a newOncePerRunmode.The
OncePerRunmode uses a per-macro-invocationstatic AtomicBool, so each call site logs the first time it is reached during the app run and suppresses later hits. The default one-argumentreport_error!(err)form remains backwards-compatible and logs every time.Also threads the same option through
report_if_error!(result, log_mode)for callers that use the result helper.Linked Issue
N/A — Slack request.
ready-to-specorready-to-implement.Testing
Added
warp_core::errors::tests::report_error_log_mode_controls_log_frequency, which installs a test logger and verifies:report_error!(err)logs twice for two hitsReportErrorLogMode::EveryTimelogs twice for two hitsReportErrorLogMode::OncePerRunlogs once for two hits of the same macro callsiteValidation run:
./script/format./script/format --check && cargo clippy -p warp_core --all-targets --tests -- -D warningscargo nextest run -p warp_core -E 'test(report_error_log_mode_controls_log_frequency)'— 1 passedcargo nextest run -p warp_core— 44 passedcargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warningscargo clippy -p warp_completer --all-targets --tests -- -D warningsI also tried
cargo clippy --workspace --all-targets --all-features --tests -- -D warnings; it failed before reaching this change because release-bundle app binaries expected generated channel config files such asstable_config.json,dev_config.json,local_config.json, andpreview_config.jsonunderOUT_DIR../script/runScreenshots / Videos
N/A — no UI change.
Agent Mode
CHANGELOG-NONE
Co-Authored-By: Oz oz-agent@warp.dev
Conversation: https://staging.warp.dev/conversation/b3b97505-1e9f-427c-b87d-7f8757773bd3
Run: https://oz.staging.warp.dev/runs/019e7f0b-9f95-72e6-bb15-5b5b3ad074db
This PR was generated with Oz.