aps-agent/docs/round-69-beihai-shipyard-sy...

9.6 KiB
Raw Permalink Blame History

Round 69 多智能体并行实施计划:北海造船 SYNTHETIC APS 数据包

日期:2026-08-03

1. 依赖图

CONTRACT -> MASTER + PLAN + OUTPUT -> TEST -> full generation -> audit

  • CONTRACT 是唯一共享前置,先完成并由主 agent 做 import smoke。
  • MASTER、PLAN、OUTPUT 在 CONTRACT 稳定后并行;PLAN 可使用 CONTRACT 的空 bundle 与 stable IDs,不依赖 MASTER 的实现细节。
  • 主 agent 集成后再启动 TEST worker,避免测试复制未稳定 schema。

2. Worker 任务

W69-CONTRACT

写入:config.py/models.py/registry.py/__init__.py。

交付:

  • GeneratorConfig、scale profile、固定种子和基准日期;
  • DatasetBundle、table registry、稳定 ID/hash/date helpers;
  • CSV/JSON 表名、列、主键、外键、world projection 契约;
  • full/small 的明确计数目标。

验收:import/compile/ruff;同输入 helper 输出稳定;无当前时间进入业务主键/哈希。

W69-MASTER

写入:master_data.py/projects.py/engineering.py。

交付:组织/资源/人员/供应商/日历;四项目/合同/里程碑/WBS/总段/分段/区域/工作包;图纸、工程发布、EBOM/PBOM/MBOM、routing/operations。

验收:full 规模达到计划;所有 BH-SYN/SYN 命名;MAKE 物料可映射 routing;确定性单元 smoke。

W69-PLAN

写入:materials.py/planning.py/scheduler.py/scenarios.py。

交付:库存与净算、MAKE/BUY/OUTSOURCE/STOCK、生产/采购/委外建议、有限能力排产、资源负荷、KPI、冲突/瓶颈、四异常场景与三方案。

验收:独占资源无未标记重叠;前置/物料/技能/尺寸重量/Hold Point 约束;15 类异常事件、4 个 canonical scenario、7 类方案;异常冻结区保护;INFEASIBLE 显式;12,000 个 active operation 全部有 slot/explanation/evidence。

W69-OUTPUT

写入:rag_skills.py/schemas.py/validation.py/exporter.py/cli.py 与 CLI script。

交付:附件目录全部文件、20 Skill、120 RAG assets、schema/manifest/dictionary/README/expected/validation;incremental hash skip、validate-only、world projection。

验收:空/小 bundle export smoke;所有要求文件存在;CSV UTF-8-SIG 或 UTF-8 明确;manifest hash/rowCount 与文件一致。

W69-TEST

写入:tests/golden/test_shipyard_synthetic_dataset.py。

交付测试:

  • small 快速生成;
  • 双次 determinism;
  • full 规模门槛;
  • 所有目录/文件/schema/manifest;
  • FK、routing/supplier/netting、资源重叠/precedence/material readiness/hold/freeze;
  • scenario 结论和 explanation;
  • incremental;
  • WorldStore 隔离加载;
  • 真实性免责声明。

3. 集成策略

  • 主 agent 先审查 CONTRACT,再并行派发三个实现 worker。
  • 任何契约变更只由主 agent 修改 CONTRACT,并广播给所有 worker;worker 不跨界修复。
  • 集成后先 small,再 standard,再 full;full 失败不得以缩小规模冒充完成。
  • 生成物写入根目录 beihai-shipyard-aps-data/;不触碰 server/data/**。

4. 验证与审计

  1. worker 自检;
  2. focused tests;
  3. full generator + validate-only;
  4. 文件清单、行数、hash、schema 与 world load;
  5. 关联/full golden、Node/Web;
  6. 8003/5173/browser;
  7. 独立代码/数据审计;
  8. GitNexus detect_changes(compare main)。

5. 完成门槛

  • 附件 22 节要求均可追溯到代码、文件或 validation metric;
  • full 数据规模全部达标;
  • validation-report 的关键错误均为 0;
  • baseline FEASIBLE 或显式 INFEASIBLE,绝不假绿;
  • final report 列文件、计数、分类、算法、KPI、瓶颈、物料风险、资源冲突、校验和待真实校准参数;
  • 未经授权不提交、推送、合并或发布。

6. 首轮 Plan Audit 修订(权威执行图)

6.1 精确模块与接口

CONTRACT 还包含 contract_fixture.py,冻结接口:

  • GeneratorConfig.for_scale(scale, project_count=4, seed=20260901);
  • DatasetBundle.tables: dict[str, list[dict]];
  • stable_id(namespace, *parts)、business_digest(bundle);
  • TABLE_SPECS 含 columns/pk/fks/file;
  • 各域生成函数均为 generate_*(bundle, config) -> DatasetBundle,只写自己拥有的 table names。

6.2 修订后的 worker 图与写边界

  1. W69-CONTRACT:原边界 + contract_fixture.py。
  2. W69-MASTER(CONTRACT 后):master_data.py/projects.py/engineering.py,只写 master/projects/engineering tables。
  3. W69-OUTPUT(CONTRACT 后,可与 MASTER 并行):rag_skills.py/schemas.py/exporter.py/cli.py 和 script;用 contract fixture 自检,不生成业务表。
  4. W69-SUPPLY(MASTER 后):materials.py/mrp.py/sourcing.py,只写 materials tables、purchase/outsource suggestions 和 supply risks。
  5. W69-SCHEDULE(SUPPLY 后):orders.py/constraints.py/scheduler.py/execution_quality.py,只写 production/work/operations/capacity/schedule/load/conflict/KPI 和 execution 六表。
  6. W69-SCENARIO(SCHEDULE 后):alternatives.py/scenarios.py,只写 7 alternatives、15 event scenarios、comparison/recommendation/diffs。
  7. 主 agent:新增 pipeline.py 串联所有域;整合 validation 的 table-independent checks。
  8. W69-VALIDATION(MASTER/SUPPLY/SCHEDULE/SCENARIO 接口稳定后):validation.py,只读 bundle,禁止修改生成表。
  9. W69-TEST(集成后):唯一测试文件。

不存在写重叠;依赖严格按上序。允许并行的只有 MASTER+OUTPUT、后续 VALIDATION 契约设计与 TEST 只读预备。

6.3 质量与执行归属

W69-SCHEDULE 明确负责 execution 六表和质量状态机;W69-SCENARIO 负责异常触发后的返工/重排差异引用,不回写 execution 表。

6.4 每 worker 自检命令

  • CONTRACT:.venv\Scripts\python.exe -c "from server.shipyard_synthetic.config import GeneratorConfig; from server.shipyard_synthetic.contract_fixture import build_contract_fixture; b=build_contract_fixture(GeneratorConfig.for_scale('small')); assert b.tables is not None"
  • MASTER:.venv\Scripts\python.exe -c "from server.shipyard_synthetic.contract_fixture import build_contract_fixture; from server.shipyard_synthetic.master_data import generate_master; from server.shipyard_synthetic.config import GeneratorConfig; c=GeneratorConfig.for_scale('small'); b=generate_master(build_contract_fixture(c),c); assert b.tables['ship-projects']"
  • OUTPUT:.venv\Scripts\python.exe -c "from pathlib import Path; from tempfile import TemporaryDirectory; from server.shipyard_synthetic.contract_fixture import build_contract_fixture; from server.shipyard_synthetic.config import GeneratorConfig; from server.shipyard_synthetic.exporter import export_bundle; c=GeneratorConfig.for_scale('small'); d=TemporaryDirectory(); export_bundle(build_contract_fixture(c),c,Path(d.name))"
  • SUPPLY:运行 small MASTER→SUPPLY inline smoke,断言 BUY/MAKE/OUTSOURCE/STOCK 均非零且净算恒等式成立。
  • SCHEDULE:运行 small MASTER→SUPPLY→SCHEDULE,断言 operations==slots、未标记 overlap=0、每 slot explanation/evidence。
  • SCENARIO:在 small scheduled bundle 上断言 7 alternatives、15 events、baseline/after/diff 三态齐全。
  • VALIDATION:对 small bundle 运行 validate_bundle,关键错误均 0。
  • TEST:Ruff/compile + pytest 单文件。

所有 worker 还必须运行其 owned files 的 Ruff 和 compileall。

6.5 精确最终验证

  • Python focused 与 full:计划 §7 的命令 + .venv\Scripts\python.exe -m pytest tests/golden -q。
  • Node:npm run test:node。
  • Web:npm run build:web。
  • 健康:PowerShell Invoke-WebRequest http://127.0.0.1:8003/api/health 与 http://127.0.0.1:5173/ 均 HTTP 200。
  • Browser:title=APS 智能排产工作台、document.readyState=complete、主 UI 文本存在。
  • Data protection:对 Round 68 基线四文件执行 Get-FileHash -Algorithm SHA256 前后比较。
  • Full performance:用 Python resource/psutil 或 PowerShell process metrics 记录 elapsedSeconds、peakWorkingSetMiB、outputMiB;门槛 180s/1536MiB/300MiB。

6.6 26 类硬约束测试矩阵

W69-TEST 必须为工作计划 §10.3 每一类约束至少建立 1 个正向或负向断言;不能只检查总计字段。Skill 逐 ID/字段、RAG 逐类别/字段/evidence resolution 也必须独立断言。

6.7 Pre-target-merge gate

当前明确不 commit/merge。若未来获授权,主 agent 必须在任何 target merge 前提交独立报告并等待用户确认;没有该确认不得推进。

7. 并行执行收口

Worker 状态 写边界结果
W69-CONTRACT Done config/models/registry/contract fixture 与精确规模契约
W69-MASTER Done 组织、项目、工程、WBS、图纸与 BOM 上游
W69-SUPPLY Done 物料、库存、MRP、MAKE/BUY/OUTSOURCE 与供应建议
W69-SCHEDULE Done 工单、工序、有限资源排产、质量与执行闭环
W69-SCENARIO Done 7 方案、15 异常、局部重排与不可行证据
W69-OUTPUT Done 51 CSV、JSON、world、Skill、Schema、RAG、CLI 与增量导出
W69-VALIDATION Done 只读独立校验、失败 fixture、约束和证据完整性
W69-TEST Done Round 69 focused 49 passed;隔离 WorldStore 使用 default world_key 与临时副本,受保护数据不写回
Main integration Done pipeline 汇合、full 生成、全量回归、服务/浏览器/数据保护、文档回写

所有 worker 写边界无重叠;失效 agent 已关闭。最终限定范围只读审计 AUDIT PASS,审计未导入 WorldStore,manifest/world 哈希稳定。未经用户授权,本轮不进行提交、推送、合并或发布。