Skip to content

fix(sdk): fail the build when list-ingredients fails, instead of repacking stale - #3660

Merged
dr-bonez merged 3 commits into
masterfrom
fix/s9pk-mk-ingredients-failure
Aug 12, 2026
Merged

fix(sdk): fail the build when list-ingredients fails, instead of repacking stale#3660
dr-bonez merged 3 commits into
masterfrom
fix/s9pk-mk-ingredients-failure

Conversation

@MattDHill

@MattDHill MattDHill commented Aug 11, 2026

Copy link
Copy Markdown
Member

s9pk.mk could print ✅ Build Complete!, exit 0, and leave the previous s9pk in place — omitting the changes just made to the package, with nothing to indicate anything was wrong.

Cause

INGREDIENTS := $(shell start-cli s9pk list-ingredients 2>/dev/null)
$(BASE_NAME)_%.s9pk: $(INGREDIENTS) $(GIT_DEPS) | check-deps

list-ingredients produces the s9pk's entire source-dependency list, ./javascript/index.js included. Nothing else in the file ties the package to its TypeScript.

$(shell) discards exit status. When the command fails it exits 9, its stderr is swallowed by 2>/dev/null, and INGREDIENTS is simply empty — so:

  • every source file detaches from the s9pk's prerequisites;
  • javascript/index.js is orphaned from the graph entirely, so its own rule (which does correctly depend on $(shell find startos -type f)) is never visited;
  • the target's only surviving prerequisites are .git/HEAD and .git/index. If the existing s9pk is newer than both, make declares it up to date;
  • arch/% has no file behind it, so its recipe runs regardless and prints the success banner.

Reproduced with source at 09:36:01, s9pk at 09:36:00, .git/index at 09:28:42:

$ make x86
Network Error: Failed to resolve hostname: demo.local
✅ Build Complete!
$ echo $?
0                       # s9pk mtime unchanged — not rebuilt

The window is the ordinary inner loop: edit a source file, rebuild, no git activity in between. Run git add first and .git/index is newer, so the target is out of date, reaches pack, and fails loudly (exit 2) — which is why this presents intermittently and reads as a network problem rather than a stale build.

Fix

Append a sentinel on failure and $(error) on it. Deliberately not $(.SHELLSTATUS): it is undefined on the GNU Make 3.81 that macOS still ships, where ifneq ($(.SHELLSTATUS),0) would fire the guard on every build.

Verified

Against a real package (tor-startos) with the configured host unresolvable:

  • failure path — errors with the message below, exit 2, no s9pk produced;
  • success path — with list-ingredients returning normally, INGREDIENTS holds the clean list with no sentinel, the guard stays silent, and a touched source file correctly triggers an ncc rebuild (exit 0) — the very rebuild the bug was suppressing.
s9pk.mk:14: *** `start-cli s9pk list-ingredients` failed, so make cannot tell
which files the s9pk depends on and would silently repack the previous build.
Run it directly to see the error — a host in .startos/config.yaml that no longer
resolves is a common cause, since start-cli resolves it even for commands that
contact no server.  Stop.

Relationship to #3601

#3601 is today's trigger: start-cli resolves the configured host even for commands that contact no server, so a workspace naming a .local box that is off the LAN fails every invocation. That remains a separate fix. This one is independent — it keeps any future failure of list-ingredients from silently producing a stale package, which is the part that can ship wrong bits.

🤖 Generated with Claude Code

Also here

projects/start-os/AGENTS.md listed projects/start-sdk/s9pk.mk under "don't edit generated binding files", beside the ts-rs osBindings. Nothing generates it, and this repo is where it is meant to be edited — its DO NOT EDIT header addresses package authors reading the copy npm put in their node_modules. Followed as written, that line forbids the fix above.

MattDHill and others added 2 commits August 11, 2026 10:49
…cking stale

`start-cli s9pk list-ingredients` produces the s9pk's entire source-dependency
list, `javascript/index.js` included — nothing else in s9pk.mk ties the package
to its TypeScript. `$(shell)` discards exit status, so any failure left
INGREDIENTS empty and detached every source file from the target's
prerequisites. Make then compared the existing s9pk against its only surviving
prerequisites, `.git/HEAD` and `.git/index`, found it newer, and declared it up
to date — while the arch/% recipe still printed "Build Complete" and exited 0.

The build therefore shipped a package without the changes just made to it, with
nothing to indicate anything was wrong. The window is the ordinary inner loop:
edit a source file and rebuild without touching git in between. Touch git first
and the s9pk is genuinely out of date, so it reaches pack and fails loudly
instead, which is why it presents intermittently.

Guard with a sentinel rather than $(.SHELLSTATUS), which is undefined on the GNU
Make 3.81 macOS ships and would fire the guard on every build there.

Today's trigger is #3601 — start-cli resolves the configured host even for
commands that contact no server, so a workspace naming a `.local` box that is
off the LAN fails every invocation. That is a separate fix; this one keeps any
future failure of that command from silently producing a stale package.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…file

It was listed beside the ts-rs osBindings under "don't edit generated binding
files", which is wrong on both counts: nothing generates it, and this repo is
where it is meant to be edited. Its "DO NOT EDIT" header speaks to package
authors looking at the copy npm put in their node_modules.

Following it as written would block the fix in this branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread projects/start-sdk/s9pk.mk Outdated
Simplified the error message for ingredient listing failure.
@dr-bonez
dr-bonez merged commit 2c88b2b into master Aug 12, 2026
13 checks passed
@dr-bonez
dr-bonez deleted the fix/s9pk-mk-ingredients-failure branch August 12, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants