Skip to content

test: make local unit runs truthful#1048

Open
dennisonbertram wants to merge 3 commits into
developfrom
codex/test-truthful-unit-lane-1042
Open

test: make local unit runs truthful#1048
dennisonbertram wants to merge 3 commits into
developfrom
codex/test-truthful-unit-lane-1042

Conversation

@dennisonbertram

Copy link
Copy Markdown
Owner

Why

Closes #1042. Parent epic: #1041.

The protected path is a developer or coding agent running the standard local unit command from a fresh checkout or linked worktree. Before this change, missing dependencies looked like hundreds of product failures, contract tests could be discovered and skip inside the unit lane, local and CI Bun versions drifted, and init.sh silently skipped hook installation in linked worktrees.

What changed

  • Extracted a testable isolated-runner core with dependency and exact-Bun preflight before discovery or child spawning.
  • Added stable exit vocabulary: 0 passed, 1 product/test child failure, 2 blocked setup.
  • Excluded contract, integration, and journey directories from the unit lane.
  • Preserved bounded concurrency and all-failure aggregation while adding a final plain JSON summary with Bun version, file counts, observed skip counts, duration, status, and reason when applicable.
  • Added deterministic coverage for dependency blocking, Bun mismatch, lane exclusion, aggregate failures, child crashes, success summaries, and skip parsing.
  • Added a temporary linked-worktree fixture proving init.sh installs repository-relative hooks when .git is a file.
  • Aligned packageManager and every setup-bun workflow occurrence on Bun 1.3.14, with matching development and lessons documentation.
  • Removed a 250 ms wall-clock race from the delegated-worker status test; the unresolved mocked stream now makes the assertion deterministic under the Bun test timeout.

Out of scope

How it was verified

Red evidence

  • bun test scripts/testing/isolated-runner.test.ts
    • Failed because the truthful runner core did not exist.
  • bun test scripts/testing/init-hooks.test.ts
    • Failed because core.hooksPath was not installed from a linked worktree.

Blocked setup evidence

  • In the clean worktree before dependency installation: bun run test:isolated
    • Exit 2.
    • reason=dependency_missing.
    • filesDiscovered=0, filesPassed=0, filesFailed=0.
    • No product test child was spawned.

Green deterministic evidence

  • bun test scripts/testing/isolated-runner.test.ts scripts/testing/init-hooks.test.ts
    • 8 passed, 0 failed.
  • bun test packages/agent/tools/tools.test.ts
    • 40 passed, 0 failed.
  • bun --bun run check
    • Passed.
  • git diff --check
    • Passed.

Full local integration evidence

  • bun run test:isolated
    • 881/881 test files passed.
    • 2 skipped tests observed and reported.
    • Final status passed on Bun 1.3.14.
  • bun --bun run ci
    • Format/lint, typecheck, 881 isolated files, and migration parity passed.
  • POSTGRES_URL=placeholder plus the CI placeholder env bun run --cwd apps/web build:ci
    • Next production-style build passed.
  • Pre-push hook
    • git diff --check, bun run check, and bun run typecheck passed before push.

Evidence quality

Deterministic unit coverage plus a real temporary Git linked-worktree regression fixture, a dependency-free blocked-path run, the complete local isolated suite, repo-level CI, and a CI-style Next build. Hosted GitHub CI and reviewer checks are pending on this PR.

Risk and rollback

This changes developer and CI tooling only; there is no application runtime, database, migration, or deploy-state mutation. The main compatibility risk is the Bun 1.3.14 upgrade across CI and smoke workflows. The full local suite and production-style build passed on that exact version. Roll back the runner, packageManager, and workflow pin changes together so parity remains invariant.

The lane now excludes directories named contract, integration, or journey. Tests for implementation modules whose filenames contain those words still run; only directory boundaries are excluded.

Reviewer guide

Start with scripts/testing/isolated-runner.ts and its focused tests. Then review the init.sh fixture, the package/workflow pin alignment, and the small packages/agent/tools/tools.test.ts timing cleanup. Workflow and documentation edits are mechanical parity updates.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-agents Ready Ready Preview, Comment Jul 14, 2026 8:32pm

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95a494c936

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread init.sh

install_git_hooks() {
if [[ ! -d "$ROOT_DIR/.git" ]]; then
if ! (cd "$ROOT_DIR" && git rev-parse --is-inside-work-tree >/dev/null 2>&1); then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid installing hooks into an enclosing repository

When init.sh is run from a source tree nested inside another Git worktree but not itself a checkout, this broader git rev-parse --is-inside-work-tree check succeeds for the parent repo. The later git config core.hooksPath .githooks then writes to that parent repository's config, hijacking its hooks path instead of skipping hook installation for this non-checkout; verify the Git top-level is ROOT_DIR (or that $ROOT_DIR/.git exists as a file or directory) before configuring hooks.

Useful? React with 👍 / 👎.

@cursor

cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

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