Skip to content

SEP-2024: Validate failure_reason against task-history status - #1526

Merged
yyyyyyyan merged 8 commits into
mainfrom
copilot/sep-2000-validate-failure-reason
Sep 15, 2026
Merged

yyyyyyyan merged 8 commits into
mainfrom
copilot/sep-2000-validate-failure-reason

Conversation

Copilot AI commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

POST /history/ accepted failure reasons for statuses that do not carry operator-facing failure details, allowing contradictory task-history records.

  • Validation

    • Reject non-null failure_reason when status.operator_summary() returns None.
    • Return a structured 422 response naming both conflicting fields.
    • Preserve existing behavior for FAILED, LOST, STALE, and UNLAUNCHABLE.
  • Coverage

    • Cover SUCCESS, PENDING, RUNNING, and STOPPED rejection.
    • Retain coverage for accepted failure statuses and reason normalization.
  • API contract

    • Update the Tasks OpenAPI specification and changelog fragment.

Copilot AI and others added 2 commits September 15, 2026 01:29
Co-authored-by: yyyyyyyan <24644216+yyyyyyyan@users.noreply.github.com>
Co-authored-by: yyyyyyyan <24644216+yyyyyyyan@users.noreply.github.com>
Copilot AI changed the title [WIP] SEP-2024: Validate failure_reason against status on task-history create route SEP-2024: Validate failure_reason against task-history status Sep 15, 2026
Copilot AI requested a review from yyyyyyyan September 15, 2026 01:49
@yyyyyyyan yyyyyyyan added the qa not required Merge without a QA sign-off: substitutes for 'qa passed' in label-gate. Does not skip any test job. label Sep 15, 2026
@yyyyyyyan
yyyyyyyan marked this pull request as ready for review September 15, 2026 02:15
Copilot AI balanced review requested due to automatic review settings September 15, 2026 02:15
@github-actions github-actions Bot added python frontend svc:tasks PR touches the tasks service (app/tasks/) labels Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation matches the stated API contract and includes appropriate coverage and documentation.

Pull request overview

Adds task-history validation to prevent contradictory failure reasons.

Changes:

  • Rejects failure reasons for statuses without operator summaries.
  • Adds rejection coverage and structured 422 assertions.
  • Updates OpenAPI documentation and changelog.
File summaries
File Description
app/tasks/routes.py Adds status/reason validation.
tests/app/tasks/test_routes.py Tests rejected status combinations.
frontend/packages/api/specs/tasks.json Documents the new 422 response.
changelog.d/SEP-2024.changed.md Records the behavior change.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  app/core/db
  utils.py
  app/inventory/migrations
  env.py
  app/sep/migrations
  env.py
  app/tasks
  routes.py
  app/tasks/migrations
  env.py
Project Total  

This report was generated by python-coverage-comment-action

@yyyyyyyan
yyyyyyyan merged commit 25698fb into main Sep 15, 2026
23 checks passed
@yyyyyyyan
yyyyyyyan deleted the copilot/sep-2000-validate-failure-reason branch September 15, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend python qa not required Merge without a QA sign-off: substitutes for 'qa passed' in label-gate. Does not skip any test job. svc:tasks PR touches the tasks service (app/tasks/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants