Files
2026-07-13 19:57:46 +08:00

26 lines
2.4 KiB
Markdown

# Contract Alignment Gate
This file records the boundary between the parser task contract and the ERP-ready form contract. It is part of the design specification so the cloud prompt, Skill, business-system parser, and ERP preflight do not silently drift.
## Current facts
- `standard_system_operation.schema.json` uses `additionalProperties: false` for `data` and now declares `data.resolution`.
- The raw-instruction flow can create a task with product/date/passenger/room/price/user facts while leaving ERP-derived fields deferred.
- `tools/browser_order_add_raw_instruction_test.mjs` confirms the real ERP sequence: select a unique product, run `Find_product/GetProduct`, then validate derived trip, route, customer, currency, and route prefix.
- `tools/browser_order_add_preflight.mjs` still requires the resolved ERP target fields before any submit path.
- `chrome-extension/ltjt-order-assistant/operation-plans.js` reads `data.order_mode` for task summaries and `data.test_marker` for test-only create/batch safety gates.
- The current local adapter adds `task_id` and `parser_prompt_version` inside `operation.source`, while the bundled schema only declares `instruction_id`, `operator`, `received_at`, and `notes` there.
- `session_id` is transport/session metadata and should remain outside the canonical operation.
## Design decision
`agent_parse_passed` is a task-creation result, not an ERP-readiness result. For team create/batch, `customer`, `route`, `trip`, and `order_number` are optional Agent facts when `data.resolution.deferred_fields` records them. The ERP layer owns deterministic product-template resolution and exact lookup; it must not guess or use a closest match.
The current business-system runtime contract retains `data.order_mode` and `data.test_marker`, because dropping either can make a valid task unplannable or remove the test-save guard. The Agent/Skill must not invent any other compatibility fields.
Transport metadata such as task ID, session ID, and parser/Profile version belongs in the business task wrapper or parse-result metadata, not in the canonical operation data.
## Remaining adapter note
The bundled parser schema now accepts task-ready team create/batch operations with deferred ERP fields. The ERP form mapping and browser preflight remain stricter and must resolve `customer`, `route`, `trip`, and `order_number` before any write. Do not weaken that execution gate or resolve unknown fields with arbitrary additional properties.