fix(memory): make make dist produce a buildable source tarball again - #3231
Conversation
`make dist` has failed outright since a46aea8 moved the component manuals into the repository-level docs/user-guide tree: the copy list still named `src/agent-memory/docs`, which no longer exists, so `cp -R` exited non-zero and the target aborted before writing either tarball. $ make dist # at 8ba7a0f, before this change cp: cannot stat 'docs': No such file or directory make: *** [Makefile:274: dist] Error 1 That failure hid a second omission: the copy list never included `examples/`, although Cargo.toml declares `[[example]] mcp-harness` with an explicit path. Cargo refuses to resolve a declared target whose file is missing, so an archive built from a merely de-docced copy list still fails every invocation that selects examples: $ cargo build --offline --examples # unpacked archive, no examples/ error: can't find example `mcp-harness` at path `.../examples/mcp_harness.rs` `%build` runs a plain `cargo build --release`, which does not select examples, so rpmbuild could not report it. `cargo test` does build them, and the archive ships `tests/` plus a Makefile whose `test` target runs `cargo test --locked`, so it is meant to be test-capable. Neither release path in CI was affected — `.github/actions/package-source` copies the whole component tree and `scripts/rpm-build.sh` tars it minus build artefacts. `make dist` is the contributor-facing path (`make rpm` and `make srpm` depend on it) and is what the Makefile documents as "Create source + vendor tarballs for RPM build". - Drop the removed `docs/` from the copy list; the spec packages CHANGELOG.md only and the manuals now live in docs/user-guide. - Add `examples/` so every target Cargo.toml declares is present. - Guard the staged tree before tarring and name the missing path, rather than letting rpmbuild or a contributor find out later. The list is exactly what agent-memory.spec.in's %build/%install reads plus the declared cargo target paths; a copy list that rots silently is what broke this target in the first place. - Cargo.toml's "Linux only" note pointed at `docs/design.md`, which never existed in this component; point at the repo-level docs/BUILDING.md and the remote-* targets instead. Verified locally (crate downloads stubbed, the rest is the real recipe): before → exit 2 with `cp: cannot stat 'docs'`; after → exit 0 producing dist/agent-memory-0.2.7.tar.gz (367 KiB) + the vendor tarball, and the unpacked archive carries every spec-required path including examples/mcp_harness.rs. With that file removed the new guard fails the target: `ERROR: examples/mcp_harness.rs is missing from dist/agent-memory-0.2.7 ...`. `make -n dist` expands cleanly, `make help` renders, `make test-openclaw-install` passes, and scripts/check-component-versions.py reports the metadata synchronized. Co-authored-by: multica-agent <github@multica.ai>
ikunkun-sys
left a comment
There was a problem hiding this comment.
🤖 AI review by codex-runner · Agent: Reviewer · 判定:APPROVE
审查提交:bd3ec576。未发现阻塞合并的问题。
-
变更概述:修复 agent-memory 本地
make dist:移除已不存在的docs/,补入examples/,新增归档前的文件完整性检查,并修正构建说明引用。 -
正确性:复制清单覆盖 Cargo 显式目标;新增 17 项检查与源码及前置生成步骤一致,缺失文件时会在归档前退出。未发现新增逻辑缺陷。
-
风格与一致性:沿用现有 Makefile 写法。注释略长且包含历史提交信息,可精简;不影响合并。
-
风险:检查清单需随 spec、Cargo 目标同步维护。本地已通过
make -n dist、展开配方的 shell 语法检查、路径核对及git diff --check。CI 的 agent-memory 测试成功,但本轮未实际执行打包、真实 vendoring 或 RPM 构建,不能据此确认完整打包链通过。工作树保持干净。
结论:APPROVE
建议合并,无必须修改项。本次仅提供审查意见,未提交 GitHub review。
ikunkun-sys
left a comment
There was a problem hiding this comment.
🤖 AI review by codex-runner · Agent: Reviewer · 判定:APPROVE
审查提交:bd3ec576。未发现阻塞合并的问题。
-
变更概述:修复 agent-memory 本地
make dist:移除已不存在的docs/,补入examples/,新增归档前的文件完整性检查,并修正构建说明引用。 -
正确性:复制清单覆盖 Cargo 显式目标;新增 17 项检查与源码及前置生成步骤一致,缺失文件时会在归档前退出。未发现新增逻辑缺陷。
-
风格与一致性:沿用现有 Makefile 写法。注释略长且包含历史提交信息,可精简;不影响合并。
-
风险:检查清单需随 spec、Cargo 目标同步维护。本地已通过
make -n dist、展开配方的 shell 语法检查、路径核对及git diff --check。CI 的 agent-memory 测试成功,但本轮未实际执行打包、真实 vendoring 或 RPM 构建,不能据此确认完整打包链通过。工作树保持干净。
结论:APPROVE
建议合并,无必须修改项。本次仅提供审查意见,未提交 GitHub review。
What is broken
make -C src/agent-memory dist— the target the Makefile documents as "Create source + vendor tarballs for RPM build", and the prerequisite ofmake rpm/make srpm— fails onmain:a46aea8d(docs(docs): move user manuals to docs/user-guide) movedsrc/agent-memory/docs/{en,zh}/…user_manual.mdinto the repository-leveldocs/user-guidetree, which leftsrc/agent-memory/docs/empty and therefore gone. Thecp -Rlist indiststill namesdocs, so the target aborts before writing either tarball. It has been broken since 2026‑07‑21.Fixing only that exposes a second, older omission: the copy list never included
examples/, whileCargo.tomldeclares an explicit target path —Cargo refuses to resolve a declared target whose file is missing, so an archive built from a merely de-
docs'd copy list still fails any invocation that selects examples:%buildruns a plaincargo build --release --locked --offline, which does not select examples, so rpmbuild could never report this.cargo testdoes build them, and the archive shipstests/plus a Makefile whosetesttarget runscargo test --locked— i.e. it is meant to be test-capable.Blast radius: the two CI release paths are unaffected (
.github/actions/package-sourcecopies the whole component tree;scripts/rpm-build.shtars it minus build artefacts). This is the contributor/local release path.What changed
src/agent-memory/Makefile(distonly) and one stale comment insrc/agent-memory/Cargo.toml:docs/from the copy list. The spec packagesCHANGELOG.mdonly (%doc %{_docdir}/%{name}/CHANGELOG.md), and the manuals now live indocs/user-guide.examples/so every targetCargo.tomldeclares is present in the archive.agent-memory.spec.in's%build/%installreads (src/main.rs,src/lib.rs,examples/mcp_harness.rs, both configs, the two systemd units,adapters/agent-memory/manifest.json, the four openclaw bundle files,.anolisa/component.toml,CHANGELOG.md,LICENSE) and fail naming the missing one. Tradeoff: the list duplicates what the spec reads and can itself go stale — but it fails loudly atmake distinstead of silently inside rpmbuild, which is exactly the failure mode that rotted this target.Cargo.toml's "Linux only" note pointed atdocs/design.md, which has never existed in this component (git log --all --diff-filter=A -- 'src/agent-memory/docs/*'shows only the two user manuals). It now points atdocs/BUILDING.mdand theremote-build/remote-testtargets, which is where the Linux-host workflow is actually documented.No workflow files are touched.
Verification
Local, with only the crate-download step stubbed (
cargo vendorwrites a placeholder tree; every other line is the real recipe — this machine's registry fetch was ~1 crate/20 s):make distbefore this changecp: cannot stat 'docs': No such file or directorymake distafterdist/agent-memory-0.2.7.tar.gz(367 KiB) +dist/agent-memory-0.2.7-vendor.tar.gzagent-memory-0.2.7/(matches%setup -n); all 17 spec-required paths present incl.examples/mcp_harness.rsand.cargo/config.toml; nodocs/examples/mcp_harness.rsremoved)ERROR: examples/mcp_harness.rs is missing from dist/agent-memory-0.2.7 but agent-memory.spec.in or Cargo.toml requires it, no tarball writtencargo build --offline --exampleson a staged tree withoutexamples/error: can't find example 'mcp-harness'(reproduces the second defect)make -n distmake helpdistdescription unchangedmake test-openclaw-installpython3 scripts/check-component-versions.pygit statusafter the runsNot run: a full
rpmbuild(needs mock +systemd-devel), and a realcargo vendor(registry throughput here). Neither is touched by this change — the vendor tarball recipe and the%setup/%buildinputs are unchanged apart from the addedexamples/.