Skip to content

test(B-0156): add bun test for tools/profile.ts CLI dispatch#3962

Closed
AceHack wants to merge 2 commits into
mainfrom
otto-cli/b0156-profile-ts-test-2026-05-16
Closed

test(B-0156): add bun test for tools/profile.ts CLI dispatch#3962
AceHack wants to merge 2 commits into
mainfrom
otto-cli/b0156-profile-ts-test-2026-05-16

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 16, 2026

Summary

Adds a focused bun test suite for tools/profile.ts covering the CLI dispatch / arg-parser entry paths. Closes one acceptance bullet for B-0156: "Each TS sibling has at least one bun test covering its primary entry path."

Of the six non-install .sh-port targets in B-0156, two (amara.ts, ani.ts) are already covered by tools/peer-call/smoke.test.ts. The remaining four (snapshot-github-settings.ts, check-github-settings-drift.ts, check-tick-history-shard-schema.ts, profile.ts) lack dedicated tests. This PR closes the gap for profile.ts. Follow-up slices can close the hygiene three.

Scope

8 tests covering paths that exit before any external tool fires:

  • no args → help text + exit 0
  • --help / -h → help text + exit 0
  • help lists all six canonical subcommands (install, counters, trace, gcdump, bench, coverage)
  • unknown command → exit 64 + help
  • counters / trace / gcdump without <pid> → exit 64 + usage: on stderr

Mirrors the established tools/peer-call/smoke.test.ts pattern: spawnSync, 10s timeout, validate CLI plumbing not external-tool behavior.

Out of scope

  • install / bench / coverage branches — shell out to dotnet-counters / dotnet-trace / dotnet-gcdump / dotnet / reportgenerator, not guaranteed installed on every dev machine or CI runner.
  • Live dotnet-trace collection — needs a running .NET process.

Test plan

  • bun test tools/profile.test.ts8 pass / 0 fail / 24 expect() calls / 896ms on this branch.
  • CI gate (gate.yml) confirms no regression on the broader bun test step.

Substrate-drift note on B-0156

Self-test (find tools -name '*.sh' -not -path '*/setup/*' -not -path '*/lean4/*') returns ZERO files — Phases 3-5 of the row (peer-call ports, profile port, .sh sweep) are factually complete; the row text still says "3 ports remaining". A follow-up doc-refresh slice can sync the row text. Out of scope here.

Operative authorization

aaron 2026-05-14: "- Devil-pole (edge-runner drive): keep pushing, discover, go hard, never-be-idle"

PR opened via REST (POST /repos/:owner/:repo/pulls) because GraphQL quota was 0/5000 at create time; core REST budget had ~4986/5000 (per .claude/rules/refresh-world-model-poll-pr-gate.md pure-git tier composes with REST-still-available).

Closes one acceptance bullet for B-0156: "Each TS sibling has at
least one `bun test` covering its primary entry path." This is the
4th of 6 non-install .sh-port targets to get test coverage (amara
and ani are covered by peer-call/smoke.test.ts; snapshot /
check-drift / check-shard-schema and tools/profile.ts had no
dedicated tests).

Scope: 8 tests covering help / unknown-command / missing-arg paths
that exit early — no external `dotnet-counters` / `dotnet-trace` /
`dotnet-gcdump` invocations. Mirrors the established
peer-call/smoke.test.ts pattern (spawnSync, 10s timeout, validates
CLI plumbing not external-tool behavior).

Result: `bun test tools/profile.test.ts` → 8 pass / 0 fail / 24
expect() calls / 896ms.

operative-authorization: aaron 2026-05-14: "- **Devil-pole** (edge-runner drive): keep pushing, discover, go hard, never-be-idle"

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 16, 2026 22:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a focused Bun test suite to validate the CLI dispatch/arg-parsing “early-exit” paths of tools/profile.ts, aligning with the B-0156 acceptance criterion that each TS tool has at least one bun test covering its primary entry path.

Changes:

  • Introduces tools/profile.test.ts with 8 smoke tests covering: no-args help, --help/-h, canonical subcommand list presence, unknown-command behavior, and missing-<pid> usage errors for counters/trace/gcdump.
  • Exercises only code paths that exit before any external tooling (dotnet-*, reportgenerator) would be invoked.

Copy link
Copy Markdown
Member Author

@AceHack AceHack left a comment

Choose a reason for hiding this comment

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

Maji Antigravity Check: No drift detected. Action-oriented PR adding a test. Note that 1 check is failing. Proceeding to investigate the failure.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: c84e8e0dda

ℹ️ 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".

@@ -0,0 +1 @@
Subproject commit f355f51c35f1dc6dbfe7e81044190e13372a37dc
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove unintended gitlink entries

This commit introduces several mode-160000 gitlink paths (e.g., this one) but does not add corresponding .gitmodules mappings, which leaves the repo in an invalid submodule state; git submodule status now fails with no submodule mapping found. Any automation or local workflow that inspects submodules will hard-fail until these entries are removed or properly declared, and these paths are unrelated to the stated profile.ts test scope.

Useful? React with 👍 / 👎.

@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 23, 2026

Substrate-honest close per stale-armed-PR resolution case 1. The tools/profile.ts CLI dispatch smoke tests shipped via #3995 (2026-05-17). B-0156 itself closed via #4073 (2026-05-17). DIRTY since 2026-05-16.

@AceHack AceHack closed this May 23, 2026
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