writeonce/docs/examples/log-watcher/justfile
shoney.arickathil 464b61ba65 fix(log-watcher): portable wo.toml — no pinned runtime path
The manifest pinned `[build] runtime = "../../../runtime/wovm"`, a repo-only
relative path that overrides woc's runtime resolution — so `woc <copied-dir>`
failed off-repo (e.g. an installed toolchain on a test server) with "runtime
binary not found".

- Drop the [build] section: the project no longer hardcodes a machine path, so
  an installed `woc` self-locates `wovm` beside its own binary.
- The module justfile's `build` recipe now sets WO_RUNTIME=<repo>/runtime/wovm
  so the in-repo build still uses the freshly built VM.
- Acceptance is unaffected (it compiles via `woc --emit` + an explicit $WOVM,
  never the manifest [build] key).

Verified: just log-watcher::build OK; just log-watcher 7/0; and building a
copied tree with the installed-layout woc from an unrelated cwd self-locates
the sibling wovm and produces a runnable binary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:19:20 +02:00

34 lines
1.7 KiB
Makefile

# docs/examples/log-watcher — the systems-track sample workload.
# Mounted into the root justfile as a module: `just log-watcher::<recipe>`
# from the repo root, or plain `just <recipe>` from this directory.
# Recipes run with this directory as the working directory.
# source_directory(), not justfile_directory(): inside a `mod`, the latter
# names the ROOT justfile's directory and every path here would miss
ROOT := source_directory() / "../../.."
# default: the acceptance test (what `just log-watcher::` runs)
default: accept
# build the self-contained executable from wo.toml: `woc <dir>` reads the
# manifest and produces target/log-watcher (needs the compiler and runtime
# built once: `just woc-build` and `just wovm-build` at the root). WO_RUNTIME
# points woc at the repo's freshly built VM — the manifest pins no path, so an
# installed woc self-locates its own wovm instead.
build:
WO_RUNTIME={{ROOT}}/runtime/wovm {{ROOT}}/compiler/_build/default/bin/woc .
@ls -la target/log-watcher
# the language track's acceptance test: this sample must compile with zero
# diagnostics AND run — watch alerts on an error line, run schedules a
# cron.d entry, the MCP server answers JSON-RPC (initialize, tools/list,
# 401 without a token), and SIGTERM stops a server parked in accept.
accept:
{{ROOT}}/scripts/log-watcher-accept.sh
# the same script's opt-in soak: each mode under load for DURATION seconds,
# resident memory and descriptor count compared against a warmed baseline
# (256 KiB / zero-fd tolerance) — the check that catches what a seconds-long
# run cannot. `just log-watcher::soak 60` for a longer sit.
soak DURATION="30":
LW_SOAK={{DURATION}} {{ROOT}}/scripts/log-watcher-accept.sh