Skip to content

make: track ip65 blob's libs and cfg content (#309) - #317

Merged
JC-000 merged 5 commits into
masterfrom
fix/309-ip65-blob-deps
Oct 18, 2026
Merged

JC-000 merged 5 commits into
masterfrom
fix/309-ip65-blob-deps

Conversation

@JC-000

@JC-000 JC-000 commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Closes #309

What

The ip65 blob rule listed only ip65_stub.s and ip65.cfg; ld65 also links ip65_tcp.lib and ip65_c64.lib. Now:

Decisions

  • c64.lib is not hashed (lives in the cc65 install). The digest carries TOOLCHAIN_ID plus ld65's search-path env (LD65_LIB, LD65_OBJ, CC65_HOME). Recorded in the Makefile and CLAUDE.md.
  • make ip65-blob does not force: docs fixed (CLAUDE.md, README, engineering-notes), not behaviour.
  • UCI builds never touch or need ip65/.

Inline fixes (this PR)

  • Docs said make ip65-blob forces a rebuild (3 places); missing-libs failure text updated.
  • make -t on a lib-less tree created 0-byte libs (regression from my first cut): fixed with +.
  • The plain test Farm symlinked the real ip65-build/, so make BACKEND=ip65 ... in any Farm test deleted the developer's real blob (reproduced on a pre-make: track ip65 blob's libs and cfg content (#309) #317 tree). Farm now copies it; a last-running guard test asserts the checkout's ip65-build/ is untouched by the suite.
  • Same-second blob byte flip left a stale PRG (older defect, above).
  • tools/package/build_prgs.sh: also bootstraps ip65-libs when libs are missing (not just the blob); header comment corrected.
  • .gitignore: ip65-build/*.stamp.

Tests (tools/test_build_flags_stamp.py: 34/34 on make 3.81 and gmake 4.4.1)

RED on master's Makefile (first round): tracks / dry-run / missing-lib tests. New this round, each with the Makefile mutant that turns it red:

mutant red test(s)
drop ip65_tcp.lib / ip65_c64.lib lib_content_change, tracks, missing_lib, skip_goals
drop ip65.cfg / stub from digest tracks, dry_run (+ content_change_moves_the_prg for stub)
libs removed from digest loop lib_content_change_with_restored_mtime_relinks
TOOLCHAIN_ID removed from digest toolchain_change_relinks
LD65_ENV line removed toolchain_change_relinks (LD65_LIB case)
named-failure rule removed missing_lib, t_on_a_libless_tree
+ prefix removed t_on_a_libless_tree
ifeq BACKEND guard removed test_uci_build_does_not_need_the_ip65_tree (second UCI build must not relink)
IP65_STAMP_SKIP forced empty skip_goals_do_not_run_the_blob_block
link-output deletion unconditional maintenance_goal_keeps_the_prg, dry_run_message
parse-time rm of ip65_blob.o dropped (stamp 1) content_change_moves_the_prg (object mtime pushed to the future)
blob-bytes stamp's rm dropped (stamp 2) byte_flip_reaches_the_prg
dry-run guard removed dry_run_writes_nothing, dry_run_message
dry-run message uses LINK_OUTPUTS dry_run_message

Hash gate (clean builds, identical to master 569274c)

ip65 3fccbeb1, ip65-onchip e69bfce7, uci fe3b6c20, uci-onchip 9e11f570, uci-comb ad85797b, uci-onchip-store 1e824348, uci-comb-store fee4d5b1, PQ onchip 354f70d0, PQ comb b8677dd7, PQ onchip+store 3b4dd718, PQ comb+store 41202de9, uci-m3 c64267c4 (also identical on master's Makefile). Blob stays cf1a5ff7809af4e4655e385b378b936054f41046ff2b7604828af3240c2d90dd. make package ran: e69bfce7 / 3b4dd718 / 41202de9. Bare pytest 525 passed; test_runner_coverage passed. The other profiles the adversary hashed (wiki, demo-store) I did not reproduce.

Round 2 (fixes after adversary)

  • Blocker: the blob-bytes stamp was only recorded by a later parse, so the first same-second flip after a build was missed (and the suite failed on a stampless checkout). The blob rule now writes ip65-c64-bin.stamp right after ld65; block 1 no longer deletes it. test_ip65_cases_do_not_depend_on_checkout_state runs the first-flip and skip-goal cases from "no blob, no stamps" and "blob, no stamps" trees; the byte-flip test has no warm-up parse and starts from "no blob, no stamps". Red on the round-1 Makefile (2eb7a0b): cases_do_not_depend_on_checkout_state, skip_goals; green now.
  • Surviving mutants killed: recipe stamp write removed -> cases_do_not_depend_on_checkout_state; bin-stamp -n text -> dry_run_message; "absent stamp = invalidate" -> parse_after_a_build_invalidates_nothing; command-line LD65_LIB= unseen (shell-env form) -> toolchain_change_relinks. "Block 1 keeps the bin stamp" is now moot: the deletion was removed (a rebuilt blob rewrites the stamp, and block 2 skips while the blob is absent).
  • LD65 env digest spelled with make variables, so make LD65_LIB=... is seen on 3.81; unset = empty = stable.
  • CLAUDE.md sentence made true.
  • Re-run: 36/36 on make 3.81 and gmake 4.4.1; bare pytest 527 passed from a copy with a blob and no stamps; 11 profiles identical to master 569274c, blob cf1a5ff7..., make package e69bfce7 / 3b4dd718 / 41202de9.

Round 3

  • flip -> delete the blob -> rebuild left the flipped object/PRG permanent when they were not older than the regenerated blob. The blob-bytes block now deletes ip65_blob.o (and, for real goals, the link outputs) whenever the blob is absent at parse time; it sits inside the existing -n/-q/-t and STAMP_SKIP gating. Test test_ip65_deleted_blob_after_a_flip_recovers_the_prg (object and PRG mtimes pushed into the future): red on f79dc28, red with the new branch mutated to true, green after.
  • 37/37 on make 3.81 and gmake 4.4.1; bare pytest 528 passed from a stampless checkout; 11 profiles + blob cf1a5ff7... identical to master 569274c; make package e69bfce7 / 3b4dd718 / 41202de9.

Round 4

  • make ip65-blob (keeps the PRG per build/flags.stamp invalidation is target-independent: a maintenance target that builds no PRG deletes every object and the PRG, and leaves a stale .map behind #220, deletes the object) could leave the flipped PRG permanent. The bytes block now ends with [ -f ip65_blob.o ] || rm -f $(IP65_RM_LINK) (empty for maintenance goals). Test test_ip65_maintenance_rebuild_after_a_flip_recovers_the_prg.
  • make -t with the blob absent created a 0-byte blob (master too) that failed the size assert forever. A 0-byte blob is now deleted at parse (real builds only). Test test_ip65_dry_run_t_blob_is_recovered_by_the_next_build.
  • Block comment corrected. Both tests red on 33342af and with their clause mutated out; 39/39 on make 3.81 and gmake 4.4.1; bare pytest 530 passed from a stampless checkout; 11 profiles + blob identical to master; make package e69bfce7 / 3b4dd718 / 41202de9.

🤖 Generated with Claude Code

JC-000 and others added 5 commits October 18, 2026 08:56
The ip65 blob rule listed only ip65_stub.s and ip65.cfg, though ld65 also
links ip65_tcp.lib and ip65_c64.lib. Both libs are now prerequisites (a
missing one fails in make, naming it and 'make ip65-libs'), and stub, cfg,
both libs and the toolchain id are content-stamped in
ip65-build/ip65-c64.stamp at parse time (#305 shape; -n/-q/-t compare only;
clean/ip65-libs skip). A stale stamp deletes the blob, its object and (for
real goals) the link outputs. make ip65-blob does not force: docs corrected.
Tests in test_build_flags_stamp.py, each mutation-checked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- named-failure lib rule runs under -t (+ prefix): no empty lib files
- blob's own sha256 stamped; a same-second byte flip deletes ip65_blob.o and
  link outputs
- dry-run warning mirrors the real branch (names the object, no PRG for
  maintenance goals); LD65_LIB/LD65_OBJ/CC65_HOME in the digest
- Farm tests get a private ip65-build (a symlink let them delete the real blob)
- build_prgs.sh bootstraps ip65-libs when the libs are missing
- tests for every previously unkilled mutant

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… env (#309 round 2)

- the blob rule writes ip65-c64-bin.stamp after ld65, so the FIRST same-second
  flip after a build reaches the PRG; the block-1 deletion of that stamp is gone
- LD65_ENV digest reads the make variables LD65_LIB/LD65_OBJ/CC65_HOME so a
  command-line value is seen on make 3.81
- tests: first flip without warm-up, no-blob/blob-no-stamps checkouts, one
  invalidation per input change, absent bin stamp is recorded, bin-stamp -n text
- CLAUDE.md sentence corrected

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
flip -> delete the blob -> rebuild left ip65_blob.o and the PRG from the
flipped blob permanent when they were not older than the regenerated blob
(same second on make 3.81). The blob-bytes block now deletes the object and
(for real goals) the link outputs whenever the blob is absent at parse time.
Test: test_ip65_deleted_blob_after_a_flip_recovers_the_prg.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… absent (#309 round 4)

- bytes block ends with `[ -f ip65_blob.o ] || rm -f $(IP65_RM_LINK)`: after
  `make ip65-blob` (maintenance, keeps the PRG per #220, deletes the object)
  the PRG can no longer outlive its object.
- a 0-byte blob (`make -t` creates one) is deleted at parse, so the next real
  build recovers instead of dying on the size assert.
- block comment corrected (absent blob no longer "record only").

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JC-000
JC-000 marked this pull request as ready for review October 18, 2026 16:28
@JC-000
JC-000 merged commit c1dc2f0 into master Oct 18, 2026
@JC-000
JC-000 deleted the fix/309-ip65-blob-deps branch October 18, 2026 16:28
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.

ip65 blob link does not track its libs, and tracks ip65.cfg by mtime only

1 participant