Copilot commented on code in PR #380: URL: https://github.com/apache/hugegraph-ai/pull/380#discussion_r4235720680
########## NOTICE: ########## @@ -1,5 +1,17 @@ -Apache HugeGraph AI -Copyright 2022-2026 The Apache Software Foundation +ontogeny +Copyright 2026 Apache HugeGraph Authors Review Comment: The existing Apache HugeGraph AI NOTICE identity is replaced with `ontogeny`, although this PR adds Ontogeny to the existing project and says the vendor attribution is appended. Preserve the original project name and ASF copyright block, then append any additional attribution rather than replacing it. ########## 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: `scrap_rate` is optional but otherwise unconstrained, so negative values reduce required material and values above 1 represent more than 100% scrap. The availability function directly multiplies by `1 + scrap_rate`; constrain the supplied fraction to `[0, 1]`. ########## 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: Negative defect counts pass these rules because only the upper bound is checked (`-1 <= inspected_qty`). That permits impossible inspection records and can inflate yield calculations; reject values below zero before creating the object. ########## 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: The description says this action reassigns a queued operation, but the current predicate also accepts `RUNNING` and `CANCELLED` operations. Enforce the documented state transition so cancelled or in-progress work cannot be moved. ########## server/ontogeny/core/__init__.py: ########## @@ -0,0 +1,35 @@ +# Copyright 2026 Apache HugeGraph Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""ontogeny.core -- DSL: models, loading, validation, linting, expression language.""" + +from .loader import OntologyPackage, load_package Review Comment: `lint` is advertised in `__all__` but is never imported into this package, so `from ontogeny.core import *` fails when it tries to resolve that name. Import it from `.linter` alongside the other public entry points. ########## 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: This guard still allows a `CANCELLED` operation to be changed to `COMPLETED`. Since cancelling an order marks its linked operations cancelled, an operator can later revive that cancelled work through this action; add an explicit cancelled-state guard. ########## domains/product-manufacturing/functions/material-availability.yaml: ########## @@ -0,0 +1,27 @@ +apiVersion: ontogeny/v1 +kind: Function +metadata: + name: material-availability + display: Material availability check + description: Explode the product BOM, compare required quantities against on-hand material stock and + return the shortage list +spec: + runtime: python + entry: availability.py:material_availability + parameters: + product_id: + type: string + required: true + display: Product ID + qty: + type: integer + required: true + display: Quantity + returns: + type: string Review Comment: The Python function returns a dictionary containing readiness and shortage details, while this public DSL contract declares a string. Generated consumers therefore receive an incorrect return schema; declare a matching structured result type or serialize the implementation result to JSON consistently. ########## 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: The Python function returns a dictionary of capacity metrics, but the declared return type is `string`. This makes the strongly typed function metadata disagree with the actual API value; use a matching structured contract or return a serialized string. ########## web/tsconfig.node.json: ########## @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "es2023", + "lib": ["ES2023"], + "types": ["node"], + "skipLibCheck": true, + + /* Bundler mode */ + "module": "nodenext", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["vite.config.ts"] Review Comment: The node TypeScript project excludes the newly added Vitest integration config and `tests-integration` sources, while CI invokes `tsc` only for the app project. Vitest transpiles these files without type-checking, so integration harness type errors can reach runtime; include them in this node project. ########## domains/product-manufacturing/functions/order-yield.yaml: ########## @@ -0,0 +1,22 @@ +apiVersion: ontogeny/v1 +kind: Function +metadata: + name: order-yield + display: Order quality yield + description: Summarise inspection results and routing progress for one production order +spec: + runtime: python + entry: yield.py:order_yield + parameters: + order_id: + type: string + required: true + display: Order ID + returns: + type: string Review Comment: `order_yield()` returns a dictionary (including `pass_rate` and routing fields), not a string as declared here. Consumers that rely on the function schema will be given the wrong type; align the declared result and implementation. -- 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]
