Repository navigation
UN-3016 [FIX] Record why an execution failed; stop dispatching skipped files #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
89a5256
c3aa791
9e1adc4
af64650
1ceb723
e15e3e2
2c95b6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…rce shape Behaviour-preserving cleanup, run once after the review verdict settled. - views.py: drop the second cleanup handler added in the previous commit and stage inside the existing try instead. That handler's guard is exactly the staging condition, so one handler now covers both paths rather than two copies of the same contract. - test_un3016_execution_error.py: import callback.tasks directly instead of extracting the helper with ast/exec. The docstring's claim that importing pulls in an unusable celery runtime is false — conftest loads .env.test before collection, and test_pg_callback_duplicate_guard.py already imports the module at module level. Verified by running the import under pytest. test_status_function_returns_a_reason is now behavioural: it calls _determine_execution_status_unified and asserts the reason is non-blank. The old version asserted only that every return was a 4-tuple, which would have passed with an always-None fourth element — i.e. it could not detect the very defect it was named for. Mutation-checked: forcing error_message = None now fails the test. - _summarize_file_errors: errors is keyed by file name, so entries are distinct by construction and the `entry not in seen` dedup could never fire. Removed, along with the duplicate early return it guarded. - source.py: skipped_files was a dict never used as a mapping; now a list of pre-formatted entries. Tests: 1298 passed, 132 skipped. test_pg_reaper.py deselected — it needs a live Postgres on 127.0.0.1:5432 and hangs identically on unmodified HEAD. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQhqNqCwFcXZZ7cQU6HxUE
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -270,27 +270,19 @@ def _summarize_file_errors(aggregated_results: dict[str, Any], total_files: int) | |
| errors are already aggregated as {file_name: error}; surface them here. | ||
| """ | ||
| errors: dict[str, Any] = aggregated_results.get("errors") or {} | ||
| if not errors: | ||
| return f"All {total_files} file(s) failed." | ||
|
|
||
| # Report the distinct reasons rather than repeating an identical message | ||
| # once per file; cap the detail so a large batch cannot bloat the column. | ||
| seen: list[str] = [] | ||
| for file_name, error in errors.items(): | ||
| detail = str(error).strip() if error else "" | ||
| if not detail: | ||
| continue | ||
| entry = f"{file_name}: {detail}" | ||
| if entry not in seen: | ||
| seen.append(entry) | ||
|
|
||
| if not seen: | ||
| # `errors` is keyed by file name, so every entry is distinct already; the | ||
| # cap is what keeps a large batch from bloating the column. | ||
| entries = [ | ||
| f"{file_name}: {str(error).strip()}" | ||
| for file_name, error in errors.items() | ||
| if error and str(error).strip() | ||
| ] | ||
| if not entries: | ||
| return f"All {total_files} file(s) failed." | ||
|
Comment on lines
+265
to
+281
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [High] [Lens 1, 3, 10, 13] — The error summary is a tautology in production:
|
||
|
|
||
| summary = f"All {total_files} file(s) failed. " | ||
| shown = seen[:_MAX_ERRORS_IN_SUMMARY] | ||
| summary += " | ".join(shown) | ||
| remaining = len(seen) - len(shown) | ||
| shown = entries[:_MAX_ERRORS_IN_SUMMARY] | ||
| summary = f"All {total_files} file(s) failed. " + " | ".join(shown) | ||
| remaining = len(entries) - len(shown) | ||
| if remaining > 0: | ||
| summary += f" | (+{remaining} more)" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[High] [Lens 13 — Testing] — The staging move is unpinned against dropping the staged hashes
Both tests in
test_un3016_execute_staging_cleanup.py(:57,:77) raise beforeexecute_workflowis reached, so nothing asserts the staged hashes still flow through.Losing this assignment dispatches an execution with
hash_values_of_files={}— the run reports success having processed zero uploaded files. A silent correctness failure on the primary upload flow.Mutation executed. Changing
:269to drop only the assignment → 2 passed. No other test exercisesWorkflowViewSet.execute().Fix: a third test asserting
execute_workflow.call_args.kwargs["hash_values_of_files"]is the sentinel returned by staging, and thatuse_file_historyisFalse.Confidence: High (mutation executed).