Skip to content

[EPAC-1880]: Backfill unittest tests for backend/cpp-oas-statistics#451

Merged
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-1880-backfill-unittest-tests-for-backend-cpp-oas-stat
May 14, 2026
Merged

[EPAC-1880]: Backfill unittest tests for backend/cpp-oas-statistics#451
riddim-developer-bot[bot] merged 1 commit into
mainfrom
symphony/epac-1880-backfill-unittest-tests-for-backend-cpp-oas-stat

Conversation

@riddim-developer-bot
Copy link
Copy Markdown
Contributor

Why

backend/cpp-oas-statistics/cpp_oas_statistics.py was the only Python ingest pipeline without a unittest suite. This PR closes that gap so CI can gate CPP/OAS parser regressions the same way it gates every other pipeline.

What changed

  • backend/cpp-oas-statistics/test_cpp_oas_statistics.py — four required named test cases: test_parses_happy_path_fixture, test_handles_missing_required_field, test_handles_malformed_upstream, test_emits_required_log_events.
  • backend/cpp-oas-statistics/fixtures/cpp_fixture.csv and oas_fixture.csv — minimal fixtures (Ontario + Alberta, 2022–2024) so tests run without network access.
  • backend/cpp-oas-statistics/fixtures/expected_output.json — golden snapshot (13 provinces, national totals CPP=1,530,000 OAS=1,330,000).
  • .github/workflows/backend-python.yml — new workflow (did not previously exist); matrix over 10 Python pipelines; cpp-oas-statistics included without skip guard.

Trade-offs not taken

  • Fixture coverage limited to Ontario + Alberta (2 of 13 provinces). Broader coverage adds noise without exercising new code paths.
  • Did not migrate to pytest (out of scope per issue).

Test plan

cd backend/cpp-oas-statistics && python3 -m unittest discover -v

Verification evidence

$ cd backend/cpp-oas-statistics && python3 -m unittest discover -v
test_emits_required_log_events ... ok
test_handles_malformed_upstream ... ok
test_handles_missing_required_field ... ok
test_parses_happy_path_fixture ... ok
test_returns_none_for_empty ... ok
test_returns_none_for_unparseable ... ok
test_standard_bilingual_format ... ok

Ran 7 tests in 0.004s
OK

actionlint passed on backend-python.yml (pre-commit hook). Skipped: iOS build — no Swift sources changed.

Resolves EPAC-1880

Reviewer-Boundary: review-only

Add test_cpp_oas_statistics.py with the four required named test cases:
- test_parses_happy_path_fixture: loads CSV fixtures, asserts golden snapshot
- test_handles_missing_required_field: absent Retirement column → ValueError
- test_handles_malformed_upstream: empty bytes → ValueError, pipeline finished not logged
- test_emits_required_log_events: patches stderr, verifies pipeline started/finished events

Commits fixtures/cpp_fixture.csv and fixtures/oas_fixture.csv (Ontario + Alberta,
2022–2024) so tests run without network access, and fixtures/expected_output.json
as the golden snapshot.

Also creates .github/workflows/backend-python.yml (did not exist) covering all
10 Python pipelines via a matrix job — cpp-oas-statistics included with no skip
guard since tests now exist.

All 7 tests pass: python3 -m unittest discover -v in 0.004s.
@riddim-developer-bot riddim-developer-bot Bot added the autonomous Enrolled in prconverged daemon for automated review and merge label May 14, 2026
@riddim-developer-bot riddim-developer-bot Bot enabled auto-merge (squash) May 14, 2026 19:54
@riddim-reviewer-bot riddim-reviewer-bot Bot added the agent:working Symphony developer-bot lease (not a CI required check) label May 14, 2026
@riddim-reviewer-bot
Copy link
Copy Markdown

riddim-reviewer-bot Bot commented May 14, 2026

⚠️ Autonomous review liveness watchdog

Symphony expected a reviewer-bot review for the current autonomous PR head within the configured SLA window, but none was found.

  • PR: [EPAC-1880]: Backfill unittest tests for backend/cpp-oas-statistics #451
  • Repo: RiddimSoftware/epac
  • Head SHA: f0e82a54ffa725fe6add86965cbfb54e0d2556ad
  • Suspected missing reviewer owner: RiddimSoftware/epac
  • Review SLA window: 300000 ms
  • PR last activity: 2026-05-14T21:45:38Z
  • Last heartbeat: fresh at 2026-05-14T22:13:13Z from riddim1.local @ 6360becfc8d5dc6e2d4a2c265ca6884c5d23e8c6

@sunnypurewal sunnypurewal removed the agent:working Symphony developer-bot lease (not a CI required check) label May 14, 2026
@riddim-reviewer-bot riddim-reviewer-bot Bot added the agent:working Symphony developer-bot lease (not a CI required check) label May 14, 2026
Copy link
Copy Markdown

@riddim-reviewer-bot riddim-reviewer-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewAutonomousPR

  • Verdict: approve
  • Reviewer boundary: review_only
  • Acceptance criteria coverage: covered=6, missing=0, unclear=1

Summary

Reviewed against the provided diff and acceptance criteria; no blocking correctness issues identified in this review-only pass.

Actionable findings

  • None.

Acceptance criteria coverage

  • coveredtest_parses_happy_path_fixture exists and asserts fixture-driven payload equals committed golden output.
    • Implemented in test_cpp_oas_statistics.py; compares against fixtures/expected_output.json (excluding generated timestamp).
    • Actionability: none
    • Evidence: backend/cpp-oas-statistics/test_cpp_oas_statistics.py, backend/cpp-oas-statistics/fixtures/expected_output.json
  • coveredtest_handles_missing_required_field asserts a clear non-KeyError failure on required-field omission.
    • Added bad_cpp inline fixture and asserts ValueError from build_payload.
    • Actionability: none
    • Evidence: backend/cpp-oas-statistics/test_cpp_oas_statistics.py
  • coveredtest_handles_malformed_upstream asserts parse failure and that pipeline finished is not logged.
    • Patches fetch_csv to empty payload and verifies main raises and log output lacks pipeline finished.
    • Actionability: none
    • Evidence: backend/cpp-oas-statistics/test_cpp_oas_statistics.py
  • coveredtest_emits_required_log_events validates JSON stderr events include pipeline started and pipeline finished.
    • Captures sys.stderr, patches fetch_csv, runs main(["--output", ...]), and parses each log line as JSON with required event/fields.
    • Actionability: none
    • Evidence: backend/cpp-oas-statistics/test_cpp_oas_statistics.py
  • covered — At least one fixture file committed under backend/cpp-oas-statistics/fixtures/ so tests run offline.
    • Added cpp_fixture.csv, oas_fixture.csv, and golden snapshot under fixtures directory.
    • Actionability: none
    • Evidence: backend/cpp-oas-statistics/fixtures/cpp_fixture.csv, backend/cpp-oas-statistics/fixtures/oas_fixture.csv
  • coveredbackend-python.yml removes the cpp-oas-statistics skip guard and includes it in the matrix job.
    • New workflow matrix lists cpp-oas-statistics directly without conditional skip logic.
    • Actionability: none
    • Evidence: .github/workflows/backend-python.yml
  • unclear — A regression in assertions should fail the cpp-oas-statistics matrix job.
    • This is an end-to-end CI behavior that should be validated in the parent workflow/run, but is not directly asserted in the added unit tests.
    • Actionability: follow_up
    • Suggested follow-up: Add/confirm a CI-level regression mutation test scenario or comment in PR that parent workflow behavior was observed.

@riddim-developer-bot riddim-developer-bot Bot merged commit 2e7a23d into main May 14, 2026
16 checks passed
@riddim-developer-bot riddim-developer-bot Bot deleted the symphony/epac-1880-backfill-unittest-tests-for-backend-cpp-oas-stat branch May 14, 2026 22:16
@riddim-reviewer-bot riddim-reviewer-bot Bot removed the agent:working Symphony developer-bot lease (not a CI required check) label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autonomous Enrolled in prconverged daemon for automated review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant