simon824 commented on code in PR #380:
URL: https://github.com/apache/hugegraph-ai/pull/380#discussion_r4236014079


##########
domains/product-manufacturing/actions/complete-operation.yaml:
##########
@@ -0,0 +1,25 @@
+apiVersion: ontogeny/v1
+kind: Action
+metadata:
+  name: complete-operation
+  display: Complete operation
+  description: Confirm a routing operation as finished
+spec:
+  target: operation
+  parameters:
+    note:
+      type: string
+      display: Note
+  rules:
+  - expr: target.status != 'COMPLETED'
+    message: Operation is already completed

Review Comment:
   Fixed in deff6b2: `complete-operation` now also refuses `CANCELLED` targets 
(`target.status != 'CANCELLED'`), and cancelling an order cancels its routing 
with it. Covered end-to-end by the new `test_hardening_rules_reject` contract 
test (cancel PO-1001 → `complete-operation` on its operations is rejected).



##########
NOTICE:
##########
@@ -1,5 +1,17 @@
-Apache HugeGraph AI
-Copyright 2022-2026 The Apache Software Foundation
+ontogeny
+Copyright 2026 Apache HugeGraph Authors

Review Comment:
   Addressed in deff6b2: this is a single project, so the two NOTICE files are 
now one. The upstream NOTICE content (Apache HugeGraph AI, © The Apache 
Software Foundation 2022-2026, ASF attribution) is merged verbatim into the 
root `NOTICE`, and the duplicate vendored copy under `third_party/` was removed 
so there is exactly one authoritative NOTICE. The decision is recorded in 
`THIRD_PARTY.md` (curation section); `third_party/LICENSE` is retained as-is.



##########
domains/product-manufacturing/actions/add-bom-line.yaml:
##########
@@ -0,0 +1,41 @@
+apiVersion: ontogeny/v1
+kind: Action
+metadata:
+  name: add-bom-line
+  display: Add BOM line
+  description: Add one material line to a product's bill of materials
+spec:
+  target: bom
+  parameters:
+    product_id:
+      type: string
+      display: Product
+      required: true
+    material_id:
+      type: string
+      display: Material
+      required: true
+    qty_per_unit:
+      type: decimal(10,3)
+      display: Quantity per unit
+      required: true
+    scrap_rate:
+      type: decimal(5,4)
+      display: Scrap allowance
+  rules:
+  - expr: parameters.qty_per_unit > 0
+    message: Quantity per unit must be positive

Review Comment:
   Fixed in deff6b2: `add-bom-line` now validates `(parameters.scrap_rate ?? 0) 
>= 0 and (parameters.scrap_rate ?? 0) <= 1` — the null-coalesce keeps the 
optional case (rate omitted → 0) passing while negative values and anything 
above 1 are rejected.



##########
domains/product-manufacturing/actions/assign-operation.yaml:
##########
@@ -0,0 +1,31 @@
+apiVersion: ontogeny/v1
+kind: Action
+metadata:
+  name: assign-operation
+  display: Assign operation to work centre
+  description: Move a queued operation to a different work centre by rewriting 
the
+    operation-work-centre link (set-link)
+spec:
+  target: operation
+  parameters:
+    work_center_id:
+      type: string
+      display: Target work centre
+      required: true
+  rules:
+  - expr: target.status != 'COMPLETED'
+    message: Completed operations cannot be reassigned
+  - expr: parameters.work_center_id != target.work_center_id
+    message: Operation is already assigned to that work centre

Review Comment:
   Fixed in deff6b2: `assign-operation` now requires `target.status == 
'QUEUED'` (the positive form subsumes the old completed-only guard). The 
contract test dry-runs the action against a `COMPLETED` operation and asserts 
the rule fires.



##########
domains/product-manufacturing/actions/record-inspection.yaml:
##########
@@ -0,0 +1,52 @@
+apiVersion: ontogeny/v1
+kind: Action
+metadata:
+  name: record-inspection
+  display: Record inspection
+  description: Record a quality inspection result for an order
+spec:
+  target: quality-inspection
+  parameters:
+    order_id:
+      type: string
+      display: Production order
+      required: true
+    inspected_qty:
+      type: integer
+      display: Inspected quantity
+      required: true
+    defect_qty:
+      type: integer
+      display: Defect quantity
+      required: true
+    result:
+      type: enum[PASS, FAIL, PENDING]
+      display: Result
+      required: true
+    inspector:
+      type: string
+      display: Inspector
+  rules:
+  - expr: parameters.inspected_qty > 0
+    message: Inspected quantity must be positive
+  - expr: parameters.defect_qty <= parameters.inspected_qty
+    message: Defects cannot exceed the inspected quantity

Review Comment:
   Fixed in deff6b2: `record-inspection` gained `parameters.defect_qty >= 0` 
(the existing defects ≤ inspected upper bound is unchanged), so negative counts 
are rejected at the rules stage.



##########
domains/product-manufacturing/functions/capacity-check.yaml:
##########
@@ -0,0 +1,26 @@
+apiVersion: ontogeny/v1
+kind: Function
+metadata:
+  name: capacity-check
+  display: Work centre capacity check
+  description: Compare a work centre's daily capacity against open production 
orders and estimate the
+    earliest feasible delivery
+spec:
+  runtime: python
+  entry: capacity.py:capacity_check
+  parameters:
+    work_center_id:
+      type: string
+      required: true
+      display: Work centre ID
+    qty:
+      type: integer
+      required: true
+      display: Additional quantity
+  returns:
+    type: string

Review Comment:
   Investigated — intentionally unchanged. The DSL's property-type vocabulary 
(`core/types.py`: string, integer, decimal, boolean, date, timestamp, 
geo-point, geo-shape, media, document, enum[…], vector(d), struct<…>) has no 
object/JSON shape, and `capacity_check` returns a success/failure union (the 
failure branch is `{work_center_id, ok: false, reason}`) that a `struct<…>` 
declaration would misrepresent. `returns` is documentation-only — it is not 
machine-enforced by the sandbox — and the display text already notes the JSON 
payload. Happy to adopt a richer type if one lands in the DSL.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to