fix(B-0140): port profile.sh to TS — Phase 2 (4 of 8)#1962
Merged
Conversation
Profiling helper: install/counters/trace/gcdump/bench/coverage. tsc clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Ports the repo’s profiling helper from a Bash script to a Bun/TypeScript CLI under tools/, aiming to keep the same diagnostic workflows (install tools, counters, trace, gcdump, bench, coverage) while continuing the broader .sh → .ts migration.
Changes:
- Added
tools/profile.tsimplementinginstall,counters,trace,gcdump,bench, andcoveragecommands viaspawnSync. - Removed the legacy
tools/profile.sh.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tools/profile.ts | New Bun/TS implementation of the profiling helper commands (dotnet diagnostics, benchmarks, coverage). |
| tools/profile.sh | Deleted legacy Bash implementation now replaced by the TS tool. |
| return resolve(dirname(fileURLToPath(import.meta.url)), ".."); | ||
| } | ||
|
|
||
| function run(cmd: string, args: string[], cwd?: string): void { |
Comment on lines
+25
to
+31
| for (const tool of tools) { | ||
| const update = spawnSync("dotnet", ["tool", "update", "--global", tool], { | ||
| stdio: "inherit", | ||
| }); | ||
| if (update.status !== 0) { | ||
| run("dotnet", ["tool", "install", "--global", tool]); | ||
| } |
| "/p:CollectCoverage=true", | ||
| "/p:CoverletOutputFormat=cobertura", | ||
| "/p:CoverletOutput=./TestResults/", | ||
| '/p:Exclude=[Dbsp.Tests.*]*', |
| bun tools/profile.ts trace <pid> # session trace for speedscope.app | ||
| bun tools/profile.ts gcdump <pid> # heap dump for PerfView | ||
| bun tools/profile.ts bench [filter] # BenchmarkDotNet run with memory diagnoser | ||
| bun tools/profile.ts coverage # run tests with coverage, emit HTML |
4 tasks
AceHack
added a commit
that referenced
this pull request
May 17, 2026
… met (#4073) The TypeScript-standardization row was in substrate-drift state: row remained `status: open` while every named artifact had landed and every acceptance bullet had a corresponding merged PR. Per `.claude/rules/backlog-item-start-gate.md` step 0 (substrate-drift discriminator added 2026-05-16), the substrate-honest move on an implementation tick is to close the row, not author more work. Evidence (every acceptance bullet → merged PR): 1. Six non-install `.sh` files ported then deleted via Phases 1-4 (snapshot/check-drift/check-schema in #1986; profile in #1962; amara/ani via subsequent ports). Self-test `find tools -name '*.sh' …` now returns only install-graph files under `tools/setup/`. 2. Each TS sibling has a `bun test`: `tools/profile.test.ts` plus `tools/peer-call/smoke.test.ts` (all 8 peer-call wrappers). 3. Phase 5 sweep complete — `.sh` originals deleted (recoverable via `git log --diff-filter=D` per LOST-FILES-LOCATIONS.md). 4. Phase 6 `.py` policy lint: `lint-no-python-files` job at `.github/workflows/gate.yml:877` invoking `bun tools/lint/no-python-files.ts`. Allowlist + 9-test suite present. 5. `grep -E '\.(sh|py)' package.json` returns no matches. 6. All migration PRs landed green; no follow-up regression rows. Smallest safe slice: status flip + Resolution section + BACKLOG.md index regen via `BACKLOG_WRITE_FORCE=1 bun tools/backlog/generate-index.ts`. operative-authorization: aaron 2026-05-14: "- **Devil-pole** (edge-runner drive): keep pushing, discover, go hard, never-be-idle" Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
bun --bun tsc --noEmit— cleanbun tools/profile.ts --help— displays usage🤖 Generated with Claude Code