Skip to content

fix(cli): resolve golden bench fixtures relative to package, not cwd - #1

Open
mosesman831 wants to merge 1 commit into
mainfrom
devin/1791635996-lexloop-bench-path-fix
Open

mosesman831 wants to merge 1 commit into
mainfrom
devin/1791635996-lexloop-bench-path-fix

Conversation

@mosesman831

Copy link
Copy Markdown
Contributor

Summary

lexloop bench golden silently reported an all-zero result when run from any cwd other than the repo root: the default fixture dir fixtures/golden was resolved against process.cwd(), listJsonFiles swallows ENOENT, and the run then produced a misleading {"loops": 0, ...} bench instead of an error.

  • bench/golden.ts now resolves the default corpus relative to the module location via defaultGoldenDir(): it walks upward from import.meta.url until a fixtures/golden directory exists. This covers both layouts — bench/ when run from source and packages/cli/dist/ in the bundled dist/cli.js — so the bench works from any cwd. An explicit --dir still resolves against cwd.
  • runGoldenBench now throws LL4005 when a fixture dir yields zero .json files (loops/ + productive/ combined), instead of reporting zeros; the CLI surfaces it via exitWith(2, ...) (gate failure stays exit 3).

Verification (E2E, clean install)

pnpm install + pnpm --filter @latticeag/lexloop-cli build, then node packages/cli/dist/cli.js:

Command cwd Result
bench golden /tmp/elsewhere (outside repo) Before: all-zero counts. After: loops:16, loops_detected:16, loops_false_productive:0, productive:16, exit 0
bench golden repo root 16/16 detected, 0/16 false positives, exit 0
bench golden --dir fixtures/golden repo root exit 0 (explicit --dir unchanged)
bench golden --dir /nonexistent /tmp/elsewhere LL4005 no golden fixtures found under /nonexistent ..., exit 2 — fails loudly instead of printing zeros
init + doctor /tmp/elsewhere exit 0, all doctor checks ok
watch --from-jsonl events.jsonl /tmp/elsewhere replayed 5 steps (observe-only), exit 0

pnpm test: 171/171 across 20 files. pnpm typecheck: clean.

Link to Devin session: https://app.devin.ai/sessions/98f9894639bd4e3b903f7517b118edc8
Open in Devin Desktop: https://app.devin.ai/desktop/session/98f9894639bd4e3b903f7517b118edc8?variant=devin
Requested by: @mosesman831

lexloop bench golden resolved the default fixtures/golden dir against
process.cwd(), so running it from anywhere but the repo root silently
found zero fixtures and reported an all-zero result. Resolve the corpus
relative to the module location instead (walk up from import.meta.url
until fixtures/golden exists; works from the bundled dist/cli.js and
from the source tree alike) and fail loudly with LL4005 when a fixture
dir yields zero files. Explicit --dir still resolves against cwd.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 12:41
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants