Skip to content

feat: enforce pass/fail quality gates on typed operator outputs - #283

Open
chandrashekhard-zmx wants to merge 8 commits into
Mes-Open:developfrom
chandrashekhard-zmx:feat/quality-gate-enforcement
Open

feat: enforce pass/fail quality gates on typed operator outputs#283
chandrashekhard-zmx wants to merge 8 commits into
Mes-Open:developfrom
chandrashekhard-zmx:feat/quality-gate-enforcement

Conversation

@chandrashekhard-zmx

Copy link
Copy Markdown

Summary

  • A number/boolean/select typed operator output can now carry an optional pass criterion (min/max range, required Yes, or a single passing option) alongside the existing is_required "must be recorded" gate.
  • Recording a value that fails the configured criterion automatically raises the existing IN_PROCESS_QC_FAIL blocking issue on the work order, which stops the next station from starting — reusing WorkOrder::isBlocked() / BatchStep::canStart() rather than inventing new blocking logic.
  • Closes a real gap found by manually building out the Yotta Energy YottaBlock YB-1 line: a required output only ever checked "was something recorded," never "was the recorded value actually good." A test work order (WO-YB1-TEST-FAIL) recorded an out-of-spec voltage and the batch still reached DONE with zero blocking before this change.
  • Admin authoring UI: pass-criterion fields appear per value type in the process-template step editor, with a badge on the outputs list showing the configured criterion.
  • No criterion configured = unchanged behavior (fully backward compatible).

Implementation

  • database/migrations/2026_09_04_120000_add_expected_result_to_template_step_outputs.php — nullable expected_min/expected_max/expected_value columns.
  • App\Services\WorkOrder\OutputGateEvaluator — stateless pass/fail evaluation per value type.
  • App\Observers\BatchStepOutputValueObserver — hooks BatchStepOutputValue::created, raises the issue via the existing IssueService, best-effort (never breaks the operator's save).
  • Admin request/controller validation + persistence, and process-template page serialization (ProcessTemplateManagementController).
  • React/Inertia authoring UI in Show.jsx.

Full plan: docs/superpowers/plans/2026-09-04-quality-gate-enforcement.md.

Test plan

  • php artisan test — full suite: 1651 passed, 3 pre-existing failures unrelated to this change (imagewebp() missing in this container's GD build, and Sanctum stateful-domain config assertions) — none touch files this PR changes.
  • New unit tests: TemplateStepOutputExpectedResultTest, OutputGateEvaluatorTest.
  • New feature test: QualityGateEnforcementTest (out-of-range value raises issue + blocks next step; in-range raises nothing; resolving the issue unblocks; ungated outputs unaffected).
  • Extended StepTypedOutputsTest for admin-authoring validation/persistence of the new fields.
  • Manually verified end-to-end in the browser: added a number-range criterion via the admin UI, confirmed it persisted and the badge rendered.
  • Pint formatting applied.

🤖 Generated with Claude Code

chandrashekhard-zmx and others added 8 commits September 4, 2026 22:39
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… criterion

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ality gate

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… output

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Also wire expected_min/expected_max/expected_value through the admin
process-template page's outputs prop serialization, which the plan's
Task 5 had missed — the field mapping there is explicit, not a plain
model toArray(), so the new columns were invisible to the UI without it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • cla-signed

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: b84903ae-ba6e-4be4-9545-24ead909aaa9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jakub-przepiora

Copy link
Copy Markdown
Contributor

Thank you for contributing to OpenMES @chandrashekhard-zmx. We're introducing a Contributor License Agreement (CLA) so the project can stay open source (AGPL-3.0) while also being offered under separate commercial licences that fund its continued development.

You keep the copyright to your contributions — the CLA doesn't transfer ownership. It only grants the project the rights it needs to license OpenMES under both open-source and commercial terms, and you remain free to use your own code elsewhere.

Since code you contributed is still part of OpenMES, we'd like to confirm it's covered. Please read the CLA here:
https://github.com/Mes-Open/OpenMes/blob/813531c9c8938258f631be40b9de9295f498fc44/CLA.md

If you agree, just comment with the line below:

I have read the OpenMES CLA at commit 201d911 and I agree that it covers all my past and future contributions to Mes-Open/OpenMes.
If any of your contributions were made in the course of employment (your employer may own the rights), let me know 0 a Corporate CLA would apply instead of this individual one.

Thanks a lot for your help building OpenMES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants