@agentsfleet/orly 0.6.6 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/audits/ufs.sh CHANGED
@@ -343,48 +343,57 @@ done < <(awk -v re="$NUMERIC_RE" '
343
343
  ' "${FILES[@]}")
344
344
 
345
345
  # ── 3. cross-runtime-orphan ─────────────────────────────────────────────────
346
- # Full-codebase ERR_* parity check. Scoped to ERR_* prefix because that's
347
- # the cross-runtime contract surface (server error codes consumed by
348
- # clients). Server (Zig) is the source of truth — every JS/TS ERR_* must
349
- # have a matching Zig pub const ERR_*. Zig-only ERR_* consts are fine
350
- # (server-internal codes don't need a client mirror).
346
+ # Full-tree ERR_* parity. Scoped to the ERR_* prefix because that is the
347
+ # cross-runtime contract surface — server error codes a client consumes. Zig is
348
+ # the source of truth: every client-side ERR_* must have a matching Zig
349
+ # `pub const ERR_*`. Zig-only codes are fine; a server-internal code needs no
350
+ # client mirror.
351
351
  #
352
- # Scans the *working tree* via `git ls-files` — sees staged content even
353
- # before it lands in HEAD, closing the previous diff-mode blindspot where
354
- # a fix staged in pre-commit couldn't satisfy a check that only read
355
- # committed history.
352
+ # Scoped BY RUNTIME, not by one repository's directory names. The previous form
353
+ # globbed `src/*.zig`, `agentsfleet/src/*.{js,jsx,ts,tsx}` and
354
+ # `ui/packages/*/src/*.ts{,x}` — one repository's layout inside a gate every
355
+ # repository receives, and it aged exactly as badly as that implies.
356
+ # `agentsfleet/src/` stopped existing, so the JavaScript half globbed ZERO
357
+ # files and "every JS ERR_* has a Zig twin" passed by scanning nothing, while
358
+ # three real codes one directory over went uncompared. A check aimed at a path
359
+ # that resolves to nothing is the same silent green this audit exists to catch.
356
360
  #
357
- # Perf (M70): batched `xargs grep` (single process across all files)
358
- # instead of `xargs -I{} grep` (one process per file). On agentsfleet the
359
- # server-side scan dropped from ~30s to <2s.
361
+ # Zig is the source of truth WHERE ZIG EXISTS. A repository with no Zig has
362
+ # nothing to compare against, so the check reports that it skipped rather than
363
+ # passing vacuously — and, more to the point, does not turn every error code in
364
+ # a pure-TypeScript repository into an orphan the moment the globs get fixed.
365
+ #
366
+ # Perf (M70): batched `xargs grep` (single process across all files) instead of
367
+ # `xargs -I{} grep` (one process per file). The server-side scan dropped from
368
+ # ~30s to <2s on a 1000-file Zig tree; scoping by runtime keeps that shape.
360
369
 
361
- zig_err=$(git ls-files -z -- 'src/*.zig' 2>/dev/null \
362
- | { grep -zvE '_test\.zig$|^src/zbench_fixtures\.zig$' || true; } \
363
- | xargs -0 grep -hE '^pub const ERR_[A-Z][A-Z0-9_]+[[:space:]]*=' 2>/dev/null \
364
- | grep -oE 'ERR_[A-Z][A-Z0-9_]+' | sort -u || true)
370
+ # Test and fixture trees are excluded DIRECTORY-shaped, not by `.test.` infix
371
+ # alone. `cli/test/acceptance/fixtures/install-negatives-ops.ts` declares codes
372
+ # that are INPUTS to a negative test — an infix-only filter walked straight
373
+ # past it and would have reported two fixtures as production orphans.
374
+ PARITY_EXCLUDE='(^|/)(test|tests|__tests__|fixtures)/|_test\.zig$|\.test\.|\.spec\.|(^|/)node_modules/|^vendor/|^third_party/|^src/zbench_fixtures\.zig$'
365
375
 
366
- js_err=$(git ls-files -z -- 'agentsfleet/src/*.js' 'agentsfleet/src/*.jsx' 'agentsfleet/src/*.ts' 'agentsfleet/src/*.tsx' 2>/dev/null \
367
- | { grep -zvE '\.test\.|\.spec\.' || true; } \
368
- | xargs -0 grep -hE '^export const ERR_[A-Z][A-Z0-9_]+[[:space:]]*=' 2>/dev/null \
369
- | grep -oE 'ERR_[A-Z][A-Z0-9_]+' | sort -u || true)
376
+ parity_codes() {
377
+ local declaration="$1"; shift
378
+ git ls-files -z -- "$@" 2>/dev/null \
379
+ | { grep -zvE "$PARITY_EXCLUDE" || true; } \
380
+ | { xargs -0 grep -hE "$declaration" 2>/dev/null || true; } \
381
+ | grep -oE 'ERR_[A-Z][A-Z0-9_]+' | sort -u || true
382
+ }
370
383
 
371
- ui_err=$(git ls-files -z -- 'ui/packages/*/src/*.ts' 'ui/packages/*/src/*.tsx' 2>/dev/null \
372
- | { grep -zvE '\.test\.|\.spec\.' || true; } \
373
- | xargs -0 grep -hE '^export const ERR_[A-Z][A-Z0-9_]+[[:space:]]*=' 2>/dev/null \
374
- | grep -oE 'ERR_[A-Z][A-Z0-9_]+' | sort -u || true)
384
+ zig_err=$(parity_codes '^pub const ERR_[A-Z][A-Z0-9_]+[[:space:]]*=' '*.zig')
385
+ client_err=$(parity_codes '^export const ERR_[A-Z][A-Z0-9_]+[[:space:]]*=' '*.js' '*.jsx' '*.ts' '*.tsx')
375
386
 
376
- # Every JS ERR_* must exist in Zig.
377
- for c in $js_err; do
378
- if ! echo "$zig_err" | grep -qx "$c"; then
379
- record "cross-runtime-orphan $c absent-in-zig"
380
- fi
381
- done
382
- # Every TS (UI) ERR_* must exist in Zig.
383
- for c in $ui_err; do
384
- if ! echo "$zig_err" | grep -qx "$c"; then
385
- record "cross-runtime-orphan $c absent-in-zig"
386
- fi
387
- done
387
+ if [ -z "$zig_err" ]; then
388
+ ok "audit-ufs: cross-runtime parity skipped — no Zig ERR_* declared, so this repository has no source of truth to compare against"
389
+ else
390
+ # Every client-side ERR_* must exist in Zig.
391
+ for c in $client_err; do
392
+ if ! echo "$zig_err" | grep -qx "$c"; then
393
+ record "cross-runtime-orphan $c absent-in-zig"
394
+ fi
395
+ done
396
+ fi
388
397
 
389
398
  # ── Report ──────────────────────────────────────────────────────────────────
390
399
 
@@ -348,7 +348,7 @@ ERROR REGISTRY GATE: <file>
348
348
  <!-- oracle-packs:start product.agentsfleet -->
349
349
  In this repository those surfaces are `src/` (Zig), `rustd/crates/*/src/` (Rust), `cli/src/` and `ui/packages/*/{src,app,lib,components,pages,tests}/` (TypeScript).
350
350
 
351
- `agentsfleet/src/` and `agentsfleet/test/` were listed here until they stopped existing. A trigger path that resolves to nothing is the same silent green this card's gate exists to prevent — and the identical stale prefix in `ufs.sh`'s cross-runtime parity scan means its JavaScript half reads zero files today.
351
+ `agentsfleet/src/` and `agentsfleet/test/` were listed here until they stopped existing. A trigger path that resolves to nothing is the same silent green this card's gate exists to prevent. The identical stale prefix sat in `ufs.sh`'s cross-runtime parity scan, where it made the JavaScript half read zero files; that scan now derives its runtimes instead of naming directories, so no path in it can go stale again.
352
352
  <!-- oracle-packs:end -->
353
353
 
354
354
  **Override:** `UFS GATE: SKIPPED per user override (reason: ...)` immediately preceding the edit. **User-only**; auto-mode does not cover.
@@ -370,7 +370,7 @@ Three discipline points, all part of RULE UFS:
370
370
 
371
371
  2. **Semantic numeric literals → named constant.** Numeric literals carrying meaning beyond their digits become named consts even at first use. Includes: conversion factors (powers-of-ten ≥ 1e3 used as multipliers/divisors), thresholds, sub-cent rates, time-unit factors, byte-unit factors, retry caps, sentinel offsets. Bare `1_000_000_000` in `nanos / 1_000_000_000` is a smell — `nanos / NANOS_PER_USD` is the rule.
372
372
 
373
- 3. **Cross-runtime parity.** Any constant that exists in more than one runtime (Zig, TS, JS) **must share its identifier verbatim**, modulo case where a language idiom forces it (Zig snake_case → TS/JS SCREAMING_SNAKE is a single-runtime style choice; the *semantic* name is identical). When a literal in runtime A would benefit from a name and a sibling runtime already has that name, reuse it. When introducing a new constant, define it in every runtime that uses the same value, same commit. There is no per-constant carve-out: this applies to every cross-runtime constant, not a curated subset.
373
+ 3. **Cross-runtime parity.** Any constant that exists in more than one of the runtimes this repository ships **must share its identifier verbatim**, modulo case where a language idiom forces it (Zig snake_case → TS/JS SCREAMING_SNAKE is a single-runtime style choice; the *semantic* name is identical). When a literal in runtime A would benefit from a name and a sibling runtime already has that name, reuse it. When introducing a new constant, define it in every runtime that uses the same value, same commit. There is no per-constant carve-out: this applies to every cross-runtime constant, not a curated subset.
374
374
 
375
375
  The gate exists because RULE UFS is otherwise pure self-policing. Without an audit script, an inline literal in a 800-LOC editing session reliably slips past attention.
376
376
 
@@ -421,6 +421,8 @@ The previous `--diff` (`BASE...HEAD`) default was retired with M70. The forcing
421
421
 
422
422
  `--all` is accepted as a back-compat alias for the default. `--diff` is rejected with exit 2 + a pointer to this section.
423
423
 
424
+ **Parity scope is derived, not named.** The ERR_* parity scan reads `*.zig` as the source of truth and every other in-scope runtime file as the client side, anywhere in the tree. It used to glob three fixed directories; when one of them stopped existing the glob matched zero files and "every client `ERR_*` has a Zig twin" passed by scanning nothing. Where a repository ships no Zig there is no source of truth, so the check prints that it skipped — a repository with one runtime is not a repository with an orphan in every file. Test and fixture trees are excluded directory-shaped (`test/`, `tests/`, `fixtures/`), because a code declared as the INPUT to a negative test is not a client mirror.
425
+
424
426
  **Languages the leaf reads.** Zig, TypeScript, JavaScript, Rust and Go. The rule is one rule, but each language hides its literals differently, so each gets a lane in `is_source` + the string-dup pass:
425
427
 
426
428
  | Language | Held out of the count, and why |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsfleet/orly",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Repository-scoped engineering harness: renders agent rules, materialises the gates that enforce them, and proves the PR boundary \u2014 for any coding agent.",
5
5
  "license": "MIT",
6
6
  "type": "module",