# CODE-DESIGN-ANA-SEMI-ROOT-PREFLIGHT-ORCHESTRATION-V007-V025 - plan_id: `CODE-DESIGN-ANA-SEMI-ROOT-PREFLIGHT-ORCHESTRATION-V007-V025` - role_instance_id: `dev.developer.ana.cai` - created_at: `2026-07-26T22:16:00+08:00` - predecessor: `CODE-DESIGN-ANA-SEMI-ROOT-PREFLIGHT-ORCHESTRATION-V007-V024` / `24809/74d6effed42c21a1945979b0850fe0e323709741e02e64b6db4f7ada8d205fbf` - predecessor_review: `AUDIT-DEV-ANA-SEMI-ROOT-PREFLIGHT-ORCHESTRATION-V007-PYTHON-STAGE-P-REPAIR-PLAN-V024=HOLD/2/2` / `242477/07fb3540ca9135d6b2d2f239962f46578f4b2fdc85c89709dc5bf792e4c16db2` / line `1870` - status: `PENDING_INDEPENDENT_TWO_STAGE_PYTHON_SOURCE_FREEZE_PLAN_REVIEW` - source_materialization_authorization: `NOT_ISSUED` - candidate_execution_authorization: `NOT_ISSUED` - database_execution_authorization: `NOT_ISSUED` V025 不继续扩大首次写入前的自制 AST sandbox。它把原单次“写源码并立即执行”拆成两个独立授权链: 1. **Stage S / source freeze**:只 CreateNew 物化 Y01-Y04,不启动任何候选代码或外部进程; 2. **Stage V / validation execution**:仅在 Y01-Y04 exact bytes/hash 获得 `dev.reviewer.ana.cai` 独立实现审核 PASS 后,另立 append-only 执行计划与 management 授权,bootstrap 只接受审核通过的四个 exact hashes。 该拆分不改变 V020 consumer wire、Y05-Y08、native C00-C40 或数据库边界;它只把不可信源码从“同一授权内边写边执行”改为“先冻结、再独立审、最后按 hash 执行”。 ## 1. V024 两项 blocker 的结构性关闭 ### 1.1 BLOCK-V024-01:移除首次写入链中的可执行 AST allowlist Stage S 不启动 Python、PowerShell、node、csc 或任何候选进程;因此未审核源码不存在 receiver alias、native symbol alias 或 compliant false-positive 的运行机会。V024 bootstrap/AST gate 在 Stage S 全部 `NOT_APPLICABLE_NOT_EXECUTED`,不得作为 source freeze 放行依据,也不得启动。 Stage V 的唯一源码放行条件改为: - Y01-Y04 均是 Stage S immutable source package; - exact dev review=`PASS/0/0`; - Stage V 新计划逐字绑定四文件 path/bytes/SHA-256、review audit bytes/hash 与 review turn; - Stage V bootstrap 内 hardcode 四个 expected SHA-256/bytes,bundle 无权提供或覆盖 expected 值; - child start 前 parent 与 child 分别独立只读复开并匹配同一四组值;任何 drift 在 import/runpy/exec 前 STOP; - Stage V 不再通过末端 method 名推断安全,不接受未审核同 hash 外的任何 source。 Y04→Y01/Y02 的 receiver/module identity、API 名、调用次数与参数边界由实际 Y04/Y01/Y02 源码进入 implementation review;Stage V 计划把通过审核的 exact source hash 和审核结论作为不可变执行前驱。禁止在 Stage V 授权时改源码或仅靠 AST allowlist 推定等价。 ### 1.2 BLOCK-V024-02:目录/native writer 转为真实源码审核门 Stage S 不创建 future run root、`test/receipt/manifest` 或 Y05-Y08,不调用 `CreateDirectoryW/CreateFileW/WriteFile/ReadFile/FlushFileBuffers/CloseHandle/GetFileInformationByHandleEx/GetFileType`。因此 V024-02 对 Stage S 为 `NOT_APPLICABLE_NO_NATIVE_CALL`。 Y01/Y04 实际源码必须在 Stage S 中实现并在 implementation review 中逐字核验以下 Stage V 必需合同;未通过则不允许编制/授权 Stage V: - `ctypes`/`ctypes.wintypes` 唯一 import 形式与 receiver identity; - `CreateDirectoryW/CreateFileW/WriteFile/ReadFile/FlushFileBuffers/CloseHandle/GetFileInformationByHandleEx/GetFileType` exact argtypes/restype; - ROOT→run→`test`→`receipt`→`manifest` 唯一 CreateDirectoryW 顺序; - immediate last-error、invalid handle、partial hierarchy、ERROR_ALREADY_EXISTS、parent/target reparse、file-vs-directory、close/reopen/hash uncertainty; - source writer与result writer的唯一 owner、call count、CreateNew/no-overwrite; - failure 对 V020 C00-C40/Y01-Y08 materialization/exit 的唯一映射。 Stage V append-only 计划须从审核通过的 source 逐行提取这些 signatures/call graph 和固定 hashes;不得让 management 临时补合同。若真实源码不满足,则返回新修复计划,不进入执行授权。 ## 2. Stage S exact scope ### 2.1 唯一目标 Stage S 只允许以下四个 absent 文件;不创建 run root或其他 evidence file: | id | absolute path | role | encoding | |---|---|---|---| | Y01 | `E:\mb-ms-doc\project-info\dev\ana-dev\ana_semi_preconsumption_v002.py` | Python implementation | UTF-8 no BOM/CR/NUL,final LF exactly one | | Y02 | `E:\mb-ms-doc\project-info\dev\ana-dev\test\test_ana_semi_preconsumption_v002.py` | static/contract test source | UTF-8 no BOM/CR/NUL,final LF exactly one | | Y03 | `E:\mb-ms-doc\project-info\dev\ana-dev\test\ana_semi_preconsumption_vectors_v002.json` | V020 exact vectors | UTF-8 strict JCS,no BOM/CR/NUL/trailing LF | | Y04 | `E:\mb-ms-doc\project-info\dev\ana-dev\test\run_ana_semi_preconsumption_validation_v002.py` | single-process validation entry | UTF-8 no BOM/CR/NUL,final LF exactly one | target count=4;formal target=0。Y03 bytes必须精确为 V023/V024 已通过的 `4016/86f563b43d934cb0828e395f557ded328ad2abcfb2c1ef7bdbc8a4c32c12cbca`,不得重生成 schema或新增 case。 ### 2.2 物化机制与 no-overwrite Stage S 由 `dev.developer.ana.cai` 在独立 management authorization 下使用 Codex `apply_patch` 的 Add File 语义创建 Y01→Y02→Y03→Y04;每次 Add File 前后均以 exact absolute path 校验 absent→ordinary non-link file。任何 pre-existence、patch conflict、path escape、reparse、encoding drift 或 postwrite hash read failure立即 STOP;不得 delete、overwrite、truncate、rename、repair、backfill、retry或写第五个文件。 授权消费点=首次成功创建 Y01。失败时已物化子集永久不可变;未运行 downstream。Stage S 不使用 shell重定向、Python writer、PowerShell writer、temporary file或run root。 ### 2.3 pre-first-write gate 首次 Y01 Add File 前必须只读核验: - exact role/thread/host/cwd与全新 authorization/attempt/window; - V025 plan/audit snapshot; - Y01-Y04 absent;future run absent;旧 P01-P04 hashes匹配且旧 P05-P08 absent; - exact bundled Python、csc、mysql、mysql_config_editor相关授权进程均未由本链启动; - no database/network/credential/formal/BATCH-001 action。 任何 mismatch/read failure/uncertainty在零目标状态 terminal STOP;禁止修正后重跑同一授权。 ## 3. Stage S 源码内容边界 Y01/Y02/Y04 是待审核实现,但必须在物化时同时满足以下静态边界;这是代码审核入口,不是执行许可: - Python 3.12 标准库 only;禁止 subprocess/socket/urllib/http/requests/pymysql/mysql/sqlalchemy、动态 import、eval/exec/compile、os.system/os.spawn*、网络与凭据访问; - 不含 password/token/cookie/login-path content;不连接 database;不调用 mysql/config-editor; - 不发送 native/MB-X/route/inbox/session消息;terminal由parent Codex exact thread完成; - Y01只实现 V020 四 API、single-invocation owner、DateTimeOffset等价UTC tick、exact process provider与native writer primitives; - Y02包含 V020 4 success API、8 negative、4 provider precedence、7 time、15 selector、8 preflight及 V024 要求的 receiver/native/目录正负向静态 vectors; - Y04只编排已审核 Y01/Y02、生成 V020 Y05/Y06/Y07/Y08和C00-C40 closure;不执行 Y03以外输入、不运行 Y03/Y04外child; - 源码中所有 Win32 binding、module loader、API调用、目录/文件 owner和STOP mapping必须可由 reviewer逐行定位,无运行时生成源码或隐藏base64代码。 Stage S 完成 terminal 只报告四文件 materialized/bytes/hash、零进程/数据库/网络/凭据和 reviewer handoff;不得声称 implementation PASS。 ## 4. Stage S 独立实现审核与 Stage V 门 Stage S 后只允许 exact `dev.reviewer.ana.cai`: 1. 锁定 Y01-Y04 bytes/hash与 ordinary-file identity; 2. 静态读取/解析,不 import、不 runpy、不执行 candidate; 3. 审核 V020 wire producer、receiver-aware call graph、loader identity、Win32 prototypes、目录顺序、writer lifecycle、STOP/state mapping、no-secret/no-network/no-database; 4. 复算 Y03 strict JCS与既有 hash; 5. 输出 PASS/HOLD 与 immutable audit snapshot。 只有 PASS/0/0 才可 append-only 编制 Stage V execution plan。Stage V 计划必须使用全新 run/auth/attempt,有独立 review 和 management authorization;它可创建 Y05-Y08/run,但不得再改 Y01-Y04。Stage V implementation review PASS 后,才允许请求 root identity/grant database preflight authorization。 ## 5. 零状态与禁止项 - Y01-Y08=`ABSENT_8_OF_8`;future run absent。 - implementation/database authorization=`NOT_ISSUED/NOT_ISSUED`。 - 当前未执行 Python/PowerShell/csc/node/mysql/config-editor/SQL/database/network/credential。 - 禁止基于 V025 直接执行候选代码、创建 Y05-Y08/run、连接数据库、R3、formal target、BATCH-001、配置/binding/session/role/permission/Git mutation。 - V025 PASS 只允许向 management 申请 **single-use Stage S Y01-Y04 source-freeze authorization**;不允许申请 Stage V或数据库授权。