← Back to Pull requests

Add E2E tests for unified callback abstraction #143

Merged
Sridhar1030 merged 1 files (1651 lines) on Sep 04, 2026 18:03 UTC
View on GitHub
Sridhar1030 Sridhar1030 commented on Aug 18, 2026 09:45 UTC
Author

Summary

Implements automated tests from the RHAISTRAT-1256 unified callback abstraction test plan for RHOAIENG-79856.

Adds tests/test_e2e_callbacks.py with 50 new tests covering all 49 test cases across 11 categories:

| Category | TCs |
|----------|-----|
| TC-IFACE — Unified callback interface | 6 |
| TC-CTX — TrainingHubContext | 5 |
| TC-ADAPT — Backend adapter layer | 5 |
| TC-ILAB — InstructLab integration | 4 |
| TC-MINI — Mini-Trainer integration | 4 |
| TC-UNSL — Unsloth integration | 4 |
| TC-ENT — Enterprise callback library | 6 |
| TC-MIG — Migration and portability | 5 |
| TC-PERF — Performance and scalability | 4 |
| TC-E2E — End-to-end scenarios | 3 |
| TC-UPGRADE — Upgrade testing | 3 |

Together with existing tests/test_callbacks.py from #128 and #141: 78 tests, all passing.

Notes:

  • ILAB/MINI/UNSL tests are adapter-level (mock native contexts + bridge dispatch); no GPU required.

  • TC-ENT uses test-local TrainingHubCallback fixtures (compliance, cost, quality, bias) — enterprise library not shipped yet; tests prove the pattern.

  • TC-ILAB-002: accelerator info validated via ctx.metrics (no backend_state field on TrainingHubContext).

  • Real GPU training (full torchrun OSFT/SFT) remains manual via examples/scripts/callback_smoke_*.py.
  • Test plan

  • pytest tests/test_e2e_callbacks.py tests/test_callbacks.py -v

  • (Optional, GPU workbench) python examples/scripts/callback_smoke_instructlab.py

  • (Optional, GPU workbench) python examples/scripts/callback_smoke_mini_trainer.py
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

  • Tests

  • - Expanded end-to-end coverage for callback lifecycle, ordering, context handling, and error isolation.
    - Validated callback compatibility across supported training backends and monitoring integrations.
    - Added coverage for migrations, upgrades, rollbacks, cross-backend workflows, and performance overhead.
    - Improved confidence that optional integrations degrade gracefully when dependencies are unavailable.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 1651 lines (+1651 / -0) across 1 files Reviewer: Maxusmusti Review duration: 24978m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.43) × (1 − Review Confidence (0.62)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 1651 lines diff across 1 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.40 · 1 substantive comment(s)
    0.40
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    61%
    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.400
    Real PR Conversation Timeline
    1 comments
    "Review active on #143"
    general weight: 0.35
    Reviewers
    Assignees
    Sridhar1030 Sridhar1030
    Labels
    risk: low confidence: 62.0% 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: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    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: 62.0% · Lower = rushed or shallow review
    62.0%
    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.4% · Safe to merge
    16.4%