Repository navigation
Split the report output service under the file-length limit - #4066
Merged
Merged
Conversation
report_output_service.py grew to 805 lines on master, one over the api.quality.file-length limit, so the file-length check fails there. Its run-history methods, which keep each report's run records, spec and version manifest in step with the report, move unchanged to a ReportOutputRunHistoryMixin in report_output_runs.py. ReportOutputService inherits them, so every method resolves to the same code, and the module's public names are unchanged. The runtime SQL and orchestration boundary tests now also read the new module, as they read report_output_service.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4066 +/- ##
===========================================
+ Coverage 50.94% 87.82% +36.88%
===========================================
Files 242 259 +17
Lines 14531 15961 +1430
Branches 2335 2622 +287
===========================================
+ Hits 7403 14018 +6615
+ Misses 6505 1278 -5227
- Partials 623 665 +42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4065
This fixes the failing
file-lengthcheck onmaster, which fails the "Quality guards" job on every open pull request. #4044 grewreport_output_service.pyfrom 792 to 805 lines, and #4054 then added the 800-lineapi.quality.file-lengthrule on a CI run from before #4044 merged: the branch rules don't require pull requests to be up to date withmaster, so neither CI run saw both changes. This pull request is based onmasterand is not part of stack #4057. It doesn't add the file to the rule's baseline.What moves where
services/report_output_service.pyInvalidReportOutputIdError,ReportOutputView,ReportCreateResult, andReportOutputService: its constructor and sessions, finding, creating and resolving report outputs,create_or_reuse_report_output,resolve_report_output,update_report_outputservices/report_output_runs.py(new)ReportOutputRunHistoryMixin: the 15 methods that keep a report's run history, report spec and version manifest in step with the report (_ensure_report_output_dual_write_stateand its helpers), andformat_run_timestampReportOutputServicenow inheritsReportOutputRunHistoryMixin. No method name is defined in both, so every method resolves to the same code, includingReportOutputService.format_run_timestamp, which the routes call. Every public name the module defined is still defined there.No names were renamed. No patch target changes: no test patches a name in
report_output_service; the tests patch the route's service instance (report_output_routes.report_output_service) or methods on a service object, which resolve as before. To check, a pytest plugin recorded everypatchandmonkeypatch.setattrin each test, the function that made it, and the calls its fake received, before and after, over the report-output service, route, contract and boundary tests: outcomes and call counts are identical for all 518 tests.Not a pure move
The two boundary tests that read
report_output_service.pyby path now also read the new module:tests/unit/services/test_orchestration_service_database_boundaries.py::test_orchestration_services_do_not_access_database_connections(api.services.no-direct-queries):report_output_runs.pyis added to itsmodule_nameparameters; the test body is unchanged.tests/unit/data/test_runtime_sql_boundaries.py::test_report_orchestration_uses_sessions_and_models_not_raw_sqlis unchanged; a new test,test_report_run_history_uses_sessions_and_models_not_raw_sql, makes the same assertions onreport_output_runs.pyand is registered on the same rule,api.data.runtime-sql-confined.Testing
pytestover the report-output service, route, contract and boundary tests (tests/unit/services/test_report_output_service.py,test_report_service_owned_sessions.py,test_service_owned_session_architecture.py,tests/unit/test_simulation_and_report_routes.py,tests/unit/v2/test_report_v1_runtime_selection.py,tests/unit/routes,tests/contract/test_v1_route_contracts.py, and both boundary test files): 518 passed onmaster, 520 on this branch (the new test and the new parameter).python scripts/run_quality_guards.py: all guards pass, includingfile-length, which fails onmaster.origin/file-length-economy-service): all pass, and the registry merges without conflicts.python -m scripts.rules guard --base-ref origin/master: pass;python -m scripts.rules render: no changes;python -m unittest discover -s scripts/rules/tests -t .: 142 pass.ruff format --check .,ruff check .: pass.uv lock --check: pass.# noqacomments: 94 before and after;type: ignore/pyright: ignore: 9 before and after.Environment variables
None changed. No workflow, image or deployment file changed, and the moved code reads no environment variable.
🤖 Generated with Claude Code