writeonce/docs/examples/log-watcher/justfile
shoney.arickathil c4d2a588ff chore: move the sample's recipes beside it (just module)
- docs/examples/log-watcher/justfile carries build/accept/soak; the
  root mounts it with `mod log-watcher`, so `just log-watcher` still
  runs the acceptance (default recipe) and every doc reference stays
  valid; `just log-watcher::build` / `::soak 60` reach the rest, and
  plain `just build` works from inside the directory
- ROOT is source_directory()-based: inside a `mod`,
  justfile_directory() names the ROOT justfile's directory and every
  path would miss

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

32 lines
1.5 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)
build:
{{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