Skip to content

S3: yard written in Track (tools/yard) - #36

Merged
dev-dami merged 7 commits into
mainfrom
agent/s3b-yard-link
Nov 22, 2026
Merged

dev-dami merged 7 commits into
mainfrom
agent/s3b-yard-link

Conversation

@dev-dami

@dev-dami dev-dami commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Second step of retiring Rust. yard, the package and build tool, is ported to Track. The Rust yard in src/yard stays until S5 deletes src/.

What

  • tools/yard/: main.trk (commands), builder.trk, manifest.trk, cache.trk, resolver.trk, yutil.trk. Build it with trackc build --native tools/yard/main.trk -o yard.
  • Finding trackc: yard uses $TRACKC first, then a trackc next to the yard binary, then PATH.
  • Linking, as the Rust yard does:
    • Every .trk under src/ is linked, except names containing _test and anything under /tests/.
    • yard writes target/_yard_root.trk, one import per module, with each path escaped as Track string contents. It then builds that file into one image.
    • Each module is also checked on its own, in parallel, and the first error is reported in source order.
    • yard check builds the same root, so check and build agree.
  • Cache: content-based. The key covers the yard version, the trackc checksum and every source file. A warm build is fully cached and leaves the executable untouched.
  • Shell work (mkdir, rm, find, cp, cksum) goes through sys_exec with single-quote escaping. No runtime primitives were added.
  • Tests: tests/yard/run.sh needs no cargo. It has 14 cases: the 9 from tests/yard_tests.rs, plus implicit module linking, nested and explicit imports, check/build agreement, the linked-image cache, and a CLI sweep.
  • docs/yard.md is updated.

Differences from the Rust yard

  • Dependencies are written to Track.toml sorted by name. Rust used hash-map order.
  • Error text differs in places: trackc's diagnostics instead of "Compile Error: …", and fixed text after "Failed to read".
  • There is no target/_track_runtime.o, because the runtime is built into the image.

Checks

  • First check: FAIL. A cross-file call with no import built under the Rust yard but not under the Track yard. Fixed in 3fa6caf.

  • Re-check: PASS with notes. Compared against the Rust yard on:

    • the repro
    • nested modules
    • mixed imports
    • _test and tests/ files excluded from the link
    • duplicate definitions and ../ imports (both fail, as they do in Rust)
    • yard test passing and failing
    • cache warm, edit, add and remove

    Shell injection through paths, names and Track.toml values was tried and executed nothing. Its two notes are fixed in bbdcdae:

    • a " in a filename could end the import string in the root file;
    • the failing-test case failed for a compile-time reason, and now aborts at run time.
  • Local gates:

    • tests/yard/run.sh: 14/14
    • check --deny-warnings tools/yard/main.trk
    • bootstrap and selfhost fixed point
    • native parity
    • cargo test: 165 passed

Follow-up: run tests/yard/run.sh in CI. This waits for #35, which also edits ci.yml.

🤖 Generated with Claude Code

dev-dami and others added 5 commits November 22, 2026 11:48
tools/yard/*.trk builds with trackc build --native and drives trackc
for per-module compiles; tests/yard/run.sh mirrors tests/yard_tests.rs
without cargo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Track yard used target/objects/main.o, a standalone build of main.trk,
as the executable, so a call into a module main did not import failed with
'undefined function'. yard now writes target/_yard_root.trk with one import
per module and builds that one unit from the project root; trackc's
cwd-relative fallback gives each module the same file key its importers
use, so explicit imports load once. Per-module checks stay as cache stamps;
the image is keyed by the package fingerprint. yard check builds the same
image in scratch, so check and build agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checker on S3b: a `"` in a module filename ended the import string in
target/_yard_root.trk (`a";import "evil` became two imports and a parse
error); the Rust yard builds such a name. Module paths are now escaped
as Track string contents (`\`, `"`, newline). The runner's failing-test
case used `abort()`, which is a compile error under trackc, so it passed
for the wrong reason; it now aborts at run time and checks for
"Track abort: zfail". New check: a module named `q"u\o.trk` links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 386423b9-8009-4500-8211-f31d6628b3ef
Commits

Reviewing files that changed from the base of the PR and between 9c6f813 and 31b40ef.

Files selected for processing: 9

  • .github/workflows/ci.yml
  • docs/yard.md
  • tests/yard/run.sh
  • tools/yard/builder.trk
  • tools/yard/cache.trk
  • tools/yard/main.trk
  • tools/yard/manifest.trk
  • tools/yard/resolver.trk
  • tools/yard/yutil.trk
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dev-dami
dev-dami merged commit 9e4368e into main Nov 22, 2026
6 checks passed
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.

1 participant