Skip to content

[Bug]: native provenance dry-run guard mistakes Make variable overrides for flags #32420

Closed

Description

@slyunnn

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

6a2b29954749d5a47820ed429cfa8a6c4793682f

Other Environment Information

macOS/arm64, Go 1.27.1, native CPU build, system GNU Make. Clean isolated Git worktree. Discovered while preparing QA for #32369 and #32078.

Actual Behavior

A standard Make command-line variable assignment can cause cgo-native-prepare-internal to return successfully before provenance preparation or begin. Third-party libraries and libmo are built, but the final record fails with native build completion marker is missing or invalid.

Observed with make build ONNX_PREBUILT_DIR=<verified-local-onnx-library-directory>. The first invocation spent time building native libraries and exited nonzero. The worktree contained no provenance pending/building marker afterward. Exporting the same variable in the environment and running plain make build completed successfully.

Expected Behavior

Make variable overrides should preserve the provenance prepare/build/record sequence. Only real dry-run, touch or question flags should suppress its mutating preparation.

Steps to Reproduce

Use a fresh worktree and a checksum-matching ONNX library directory for the platform.

make build ONNX_PREBUILT_DIR=/path/to/verified/onnx/library/directory

A minimal reproduction of the guard classification requires no native build. Put the following in a temporary Makefile and pass a command-line variable assignment.

all:
	@echo 'MAKEFLAGS=[$(MAKEFLAGS)] first=[$(firstword $(MAKEFLAGS))]'
	@case "$(firstword $(MAKEFLAGS))" in -*) echo CONTINUE ;; *n*|*t*|*q*) echo SKIPPED_PREPARE ;; *) echo CONTINUE ;; esac
make -f /tmp/guard.mk ONNX_PREBUILT_DIR=/tmp/cache
make -f /tmp/guard.mk

The first prints MAKEFLAGS=[ONNX_PREBUILT_DIR=/tmp/cache] and SKIPPED_PREPARE. Plain make prints CONTINUE.

Additional information

The first guard in Makefile target cgo-native-prepare-internal checks the first word of MAKEFLAGS with the patterns *n*|*t*|*q*. On this Make implementation, a variable override can be that first word and match those patterns. This is independent of the Group and max-processor fixes. No MatrixOne tracked source was changed during verification.

Searched open and closed issues for MAKEFLAGS and native build completion marker; no matching report was found.

Activity

  1. added
    kind/bug
    on Nov 9, 2026
  2. added theissue type on Nov 9, 2026
  3. added this to the MO-202611 milestone on Nov 9, 2026
  4. added a commit that references this issue on Nov 12, 2026
    4760bca
  5. XuPeng-SH commented on Nov 12, 2026

    @XuPeng-SH
    Contributor

    转 QA 验证:修复已随 #32574 合入 main,merge SHA 4760bcaa88b23fabe064b1631b624c0e8c40d549(PR head 071380402a525fd6696823a735ccca4537cc63ea)。本 issue 是确定性的 native Make 参数/构建准备缺陷,不按偶发 CI issue 直接关闭。

    修复移除对 MAKEFLAGS 首词的错误解析,由 Make 自身处理 dry-run/touch/question 执行语义,保留 prepare/build/record 顺序。作者报告:Linux GNU Make 3.81/4.4.1 完整生产 target 隔离矩阵通过,含变量赋值、真实选项、递归 Make、清理顺序和失败注入;3.81 相同预构建 native 输入的源码归档控制旧版缺 completion marker、候选成功。4.4.1 另做清理源码重建,使用校验匹配 ONNX 库。Node suite 50 项通过;macOS/arm64 Node22/system Make3.81 的目标回归通过。3.81 rebuild-all 清理完成但有两条 jobserver-unavailable warning,清理子 Make 可串行回退。

    本轮未新跑测试;上述证据来自作者,不是最终 merge SHA 的本轮本地实测。macOS 完整 native 构建与 GPU 尚未验证,源码归档产物标记 non-reusable;Linux 3.81 前后对照为增量构建,不能写成干净全重建。请 QA 优先按原 macOS ARM64 命令行 ONNX_PREBUILT_DIR 复现步骤检查 prepare/begin/record 及失败清理,再核对变量值含 n/t/q、递归 Make 与真实 -n/-t/-q 不产生错误副作用。无当前适用反例或未完成开发 follow-up,交给 Ariznawlll,保持开放,等待 QA 验证。

  6. Ariznawlll commented on Nov 12, 2026

    @Ariznawlll
    Collaborator

    测试结论

    通过:在 macOS/arm64 上使用原始的命令行变量覆盖方式执行完整 make build,构建成功,不再出现 native build completion marker 缺失错误。

    测试版本与环境

    • 修复:PR #32574,目标 main。
    • 版本:官方 main b9c06b27b0d7384ca31ce67edd43f764152d56d2。
    • 环境:独立 macOS 15 runner,Darwin arm64,系统 GNU Make 3.81,Go 1.27.1;测试过程中未使用本机已有 MO 进程或目录。

    黑盒测试(Happy / Unhappy)

    CI 43212255493 整个作业成功:

    • Happy:先准备 ONNX Runtime 1.26.0 arm64 dylib,并核对 SHA-256 30afadcfc3c704f7671f8430d6252956651c1972373901d2be629da2e6a4d8ee;再执行原始形态 /usr/bin/make build ONNX_PREBUILT_DIR=<已校验目录>。日志确认经过 native 清理/准备、使用指定预构建 ONNX、生成二进制,命令成功退出且 mo-service 可执行文件存在。
    • Unhappy / 参数边界:真实 Make 目标的 3 组 Node 测试 3/3 通过,覆盖仅命令行变量赋值、包含 -n / --touch 字样的变量值、正常并行/其他参数,以及真实 dry-run、touch、question 模式不执行准备;同时验证 clean 顺序及注入清理错误后的停止行为。

    白盒与回归

    修复后的准备目标不再将 MAKEFLAGS 首个变量赋值误判为 dry-run,而是交由 Make 自身区分实际执行模式;上述测试直接运行产品仓库的目标和参数回归。修复 PR 已将 Make 参数回归接入现有 macOS native-contract CI;本次完整 macOS 构建验收工作流也提交至 MOTR PR #329。

    本次验证的是原报告的 macOS CPU 构建和参数边界,不涉及 GPU 构建或生产部署。按原问题范围验收通过并关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions