← Back to Pull requests

Avoid unused EventBus debug work #479

Closed
unknown closed this pull request without merging on Oct 25, 2026 06:47 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 16:04 UTC
Author

Summary

  • Evaluate the event-data keys for the entry debug message only when DEBUG is enabled, avoiding an unconditional list allocation on every emit() call.

  • Emit the final summary only when a callback ran, removing the empty “no subscribers found” log while preserving the entry and completion logs for events with active subscribers.

  • Add regressions for both cases without changing event dispatch.
  • Closes #294

    Validation

  • Regression tests failed before the fix: both the unused-keys check and the empty-summary check failed.

  • QT_QPA_PLATFORM=offscreen uv run --frozen pytest tests/models/events -q — 51 passed.

  • Ruff on both changed files — passed.

  • ty check pandaplot/models/events/event_bus.py — passed.

  • git diff --check — passed.

  • Repository-wide Ruff still reports two existing EXE001 findings for non-executable scripts with shebangs (scripts/audit_positional_args.py, scripts/build_installer.py); neither file is changed.

  • The full application test suite was not run; the focused event-bus test directory covers this change.
  • Requested measurements and review follow-up

    This is a log-noise cleanup. These synthetic timings do not establish an application-wide speedup.

    Python 3.12.13 on macOS-27.0.1-arm64-arm-64bit. Median of 5 timeit repeats of 20,000 emits with a six-key payload and zero or one synchronous no-op subscriber. A counting logging handler discards output; file/console I/O and real GUI usage are not measured. The pre-change implementation is from the parent of 6499431; the after implementation is 6499431 (the new test-only commit does not change it).

    | Level | Subscribers | Before µs/emit | After µs/emit | DEBUG records before → after |
    |---|---:|---:|---:|---:|
    | INFO | 0 | 2.551 | 0.307 | 0 → 0 |
    | INFO | 1 | 1.230 | 0.432 | 0 → 0 |
    | DEBUG | 0 | 5.910 | 3.484 | 2 → 1 |
    | DEBUG | 1 | 7.017 | 7.350 | 3 → 3 |

    The timing samples were noisy (for example INFO/no-subscriber before ranged from 1.043 to 4.463 µs/emit), and DEBUG/one-subscriber was slightly slower after the change. The dependable result here is one fewer record per no-subscriber emit at DEBUG and avoiding the keys list with DEBUG disabled. This is a synthetic record count, not an application-session log trace.

    Changed the regression test to use caplog.set_level("INFO", logger="EventBus"), which restores the shared logger on teardown. Fresh validation: 51 event tests passed; Ruff passed on both changed files; ty passed on the event-bus module; diff check passed. Repository-wide Ruff still reports the two unchanged EXE001 script permissions findings listed above. Full application and device testing remain unrun. Remote tests require maintainer approval.

    Diff: 338 lines (+253 / -85) across 4 files Reviewer: rupayon123 Review duration: 23923m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 338 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #479"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%