Repository navigation
Add test-audit repo skill adapted from OpenClaw - #4361
Merged
SawyerHood merged 1 commit intoSep 25, 2026
Merged
Conversation
Ports OpenClaw's test-audit skill (MIT) to bb: an authoring gate for new tests, an audit workflow for low-value or implementation-coupled tests, and a campaign mode for pruning one subsystem's test surface. OpenClaw commands and paths are replaced with bb's Turbo/Vitest routes, off-pipeline suites, oxfmt/oxlint, provider parity and corpus gates, and AGENTS.md test rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 25, 2026
SawyerHood
deleted the
bb/adapt-skill-for-the-bb-codebase-thr_s3kmw74uzx
branch
September 25, 2026 22:19
SawyerHood
added a commit
that referenced
this pull request
Sep 25, 2026
## Human comments ## What was wrong Several CLI, desktop, mobile, web and integration tests could not fail on their own: - a repo-wide grep for a `bb workflows catalog` command that never existed; - help-text and runbook prose pins; - literal restatements of the code under test; - a dark-theme SSR test that only asserted the wrapper it added itself. Others duplicated a stronger test, or kept test-only exports alive. ## What changed Found by a read-only test audit using the repo `test-audit` skill (#4361). - **CLI:** - Deletes the `bb workflows catalog` grep, the `bb thread log` help-string pin and the `createDevTurboCommand` restatement. `createDevTurboCommand` is no longer exported. - Deletes the Docs and GitHub "official plugin frontend bundle" copies and `helpers/plugin-copy.ts`. The plugin-forks CI job owns building copied plugins. The GitHub nav panel and PR thread-tab registration assertions move to `plugins/github/app.test.tsx`. - Folds stop, compact, clear, cancel-plan and clear-goal into one table. Every row still fails if the CLI fetches the thread first. - **Integration and QA:** - Deletes the merge-base helper test (precedence is owned by `packages/domain/test/environment.test.ts`) and makes the helper file-private. - Deletes three runbook prose pins and keeps the permission-mode cross-check. - **Desktop:** - Deletes two server-probe tests that their siblings contain. - SIGINT and SIGTERM are tested through `registerDesktopShutdownSignalHandlers`, which now owns its once-only state. - Browser permissions are tested only through the session handlers, now including notifications and geolocation. - Folds the Linux window-factory and terminal-open tests into tables. - **Mobile:** - Deletes the SF Symbol source scan, which cannot fail on its own. - The `shellHref` and `isNativeOnlyShellPath` cases now run through `resolveShellIncomingLink`. - Font tests use literal expected values instead of values read from the module under test. - **Web:** deletes the dark-theme SSR test and duplicate marketplace serialization cases. The empty and cleared-category cases move into `marketplace-routes`. Production +9/−17, tests +375/−1326. ## How you verified - `pnpm exec turbo run test lint typecheck` passes for all 9 touched packages, plus `bb-plugin-simple-notes` and `@bb/domain`. - Desktop smokes (`smoke:browser-cdp`, `smoke:browser-broker`, `smoke:packaged`, `smoke:appimage-lifecycle`) pass under xvfb against a built AppImage. `@bb/integration-tests` `test:smoke` passes 31/31. - An independent verifier used before and after worktrees on 175d5ac and 78 mutations across the 47 removed or merged test declarations. - Result: 0 lost. The only losses are 7 inventory or prose pins, removed on purpose. - Shutdown exit codes (130/143), double-signal handling and stop/quit order are unchanged and caught by the new table. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 25, 2026
## Human comments ## What was wrong Several plugin tests didn't test the plugin: - They replayed Plugin SDK behaviour: the native-roots cap and `defineCli` parsing copied into six plugins. - Copies of the SDK RPC demo tests in github and docs registered their own stub handlers. - Some restated source, or could never run in CI: monaco language tests against a bundle CI never builds. - Some kept test-only exports alive: `filterClaudeNativeRoots`, `combineWorkspaceWriteRoots`, and the Plugin Guide `*_MARKS` arrays. ## What changed Found by a read-only test audit using the repo `test-audit` skill (#4361). - **Claude native roots:** drops the cap test that replayed the SDK filter, and inlines `filterClaudeNativeRoots` into `resolveClaudeNativeRoots`. No published SDK export changes. - **`defineCli` replays:** trims the generic parsing checks from six plugins. The SDK's `cli-spec.test.ts` covers them, and now also covers `usageErrorExitCode` at every usage-error site. Each plugin keeps: - its `bb <name> <cmd>` command-name assertion; - its own error envelopes. custom-instructions also keeps the required-text check, and proves a bare `set` leaves saved instructions intact. - **github/docs:** the SDK RPC demo copies are gone. Plugin-specific input validation now runs against the real loaded plugins: github `startWork` rejects a bad repo or item number, and docs `/write` rejects non-string content. - **Plugin Guide:** the hand-maintained `*_MARKS` arrays and their inventory tests are replaced by a rendered check. Each visual group's fixture must draw exactly `surfaceIds(group)`. `surfaces.ts` and `anatomy-manifest.json` are unchanged. - **monaco:** the tautological language tests are dropped. `stage-assets.mjs` now fails the bundle build (`prepare:bundled`, part of `smoke:tarball`) if a claimed language id isn't registered. - **Other removals:** - pi `rpc-child.extension-ui.test.ts` - duplicate Claude and Codex workspace-write root tests; `combineWorkspaceWriteRoots` is no longer exported - the workflows doc-tree grep for a command that never shipped - concurrency-limit `limits.test.ts` - a duplicate tasks steer test - two inert plugin-build tests - an unreachable scaffold-script branch Production, tooling and docs +33/−66; tests +134/−873. ## How you verified - `pnpm exec turbo run test lint typecheck` passes over all 16 touched packages (52/52). - An independent verifier used before and after worktrees on 175d5ac. For each removed test it wrote the bug that test catches as a production change, then checked the old test fails and a remaining test also fails. - It found 5 lost failure modes, all restored in this PR: the Guide surface ids, custom-instructions `set` without text, CLI command names, github `startWork` input validation, and the docs content type. - Each restored assertion fails under its mutation. - The monaco check was confirmed to run in the packaging path: it passes on clean source and fails on a bad language id. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 25, 2026
## Human comments ## What was wrong Many server, db, domain and contract tests duplicated a stronger test at the owning boundary. Examples: - three "Unsupported tool" variants that hit the same fallback branch; - twin public-thread and thread-parent tests; - ten "ships X enabled/disabled" builtin tests. Others pinned incidental literals, such as exact gzip byte counts in `payload-size.test.ts` and copied icon and logo lists. Some couldn't fail at all: a check for a connect route that doesn't exist, and a "migrates without throwing" test that every db test already repeats. A few kept dead production code alive: - `hasCompletedEventLoopWorkForTests` (no callers since #4259) - `pruneThreadEventsBeforeSequence` (no callers since #3766) - `claimQueuedThreadMessage` - `createHostDaemonClient` in the host-daemon-contract source ## What changed Found by a read-only test audit using the repo `test-audit` skill (#4361). - **Dead production code removed, with its tests:** - `hasCompletedEventLoopWorkForTests` - `pruneThreadEventsBeforeSequence` and its transaction variant. The other prune wrappers are unchanged. - `claimQueuedThreadMessage`. Test call sites use `claimQueuedThreadMessageGroup` with `{ kind: "explicit-send" }`. - `isAgentDelegatedChildThread`, inlined. - **Tests rewritten or moved:** - The randomized `timeline-context-order-cache` test now prunes through the live `advanceThreadPruning` path, and asserts that rows are actually pruned. - `createHostDaemonClient` moves into its only user, `internal-session-protocol-version.test.ts`. The wire schema is unchanged, so no `HOST_DAEMON_PROTOCOL_VERSION` bump. - **Duplicates folded into their keepers or tables:** the builtin plugin defaults, `requestMatchesEntityTag` cases and pending-interaction `reason`. - **Not in this PR:** the `thread_dynamic_context_file_states` table (no writer since #2140) and its schema test. Dropping it needs a migration decision. Production +1/−117, tests +137/−1555. ## How you verified - `pnpm exec turbo run test lint typecheck` passes for `@bb/server`, `@bb/db`, `@bb/domain`, `@bb/server-contract` and `@bb/host-daemon-contract`. - The only failures were `@bb/server` timeouts at load average 40. The base commit shows them too, and they pass when rerun alone. - oxlint's `no-comments` errors match base. - An independent verifier used before and after worktrees on 175d5ac. For each removed test it wrote the bug that test catches as a production change, then checked that the old test fails and a remaining test also fails. - Result: 44 OK, 5 with no unique failure mode, 0 lost. - Builtin plugin icon names stay covered by `PluginIcon.test.tsx` ("resolves every named branding.icon the shipped plugins declare"). - Both `isParentNotifiableChildThread` clauses stay caught. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 25, 2026
## Human comments ## What was wrong When the sidebar moved into the thread-list and navigation plugins (#4036, #4041, #4117, #4140), the old app and client-core copies stayed behind. Nothing in the shipped app renders or calls them, but their tests kept them compiling and passing. The shipped plugin copies have their own tests. A few other app tests could not fail: they restated constants or asserted a flag inside a block that only runs when the flag has that value. Others were near-duplicates of a stronger test. ## What changed Found by a read-only test audit using the repo `test-audit` skill (#4361). - Deletes dead code that nothing in the shipped app calls, and the tests that only exercised it: - `ThreadArchiveQuickAction` and `ThreadActionsContextMenu` (the plugin copies ship) - `SidebarRenameProvider`, the app's sidebar row state classes, the drop-animation constant and the sidebar lifecycle atom - `useSystemProviderUsageLimits` and its query key (unused since #3449), and `getAppCommandMetadata` - client-core's environment grouping, sort policy and pinned-root ordering. The only live callers read `effectivePinnedThreadIds` or pass their own comparator. - the unused `hasRunningPluginStatus` parameter, and the plugin copy of `arrangeByStoredOrder` - The theme-preview anatomy anchor now points at `plugins/thread-list/app/rows/sidebarRowClasses.ts`, the file that actually renders the rows. - Folds duplicate suites into table tests at their owners: bundle budget, command ordering, `isRowExpandable`, steer rendering and child activity. - Deletes tests that restate constants or cannot fail. - Adds two tests after coverage verification: - an unpinned parent stays out of `effectivePinnedThreadIds`; - the terminal enables xterm's proposed API, which the Unicode 11 addon requires. This builds a real `Terminal`. Production +59/−706, tests +476/−1618. ## How you verified - `pnpm exec turbo run test lint typecheck` passes for `@bb/app`, `@bb/client-core`, `@bb/thread-view`, `bb-plugin-thread-list` and `bb-plugin-theme-preview`, plus typecheck of every client-core and thread-view dependent. - An independent verifier used before and after worktrees on 175d5ac and 55 mutations. For each of the 75 removed or merged tests, it wrote the bug that test catches as a production change and checked that the old test fails and a remaining test also fails. - Result: 64 OK, 10 with no unique failure mode, 1 lost. The lost assertion is restored above. - The live callers `RootComposeMobileRecents` and `useSidebarThreadReveal` still fail on sort or pin mutations. - Known gap, not caused by this change: the rename-cancel effect in `useSidebarRename` was untested before and after. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 25, 2026
## Human comments ## What was wrong Host and runtime tests covered the same contracts at two layers. Examples: - `workspace-dispatch` tests that were exact twins of the `host-files` handler tests; - agent-runtime recovery and provider-registry tests left over after #2325 moved recovery onto typed hints and made the registry id-agnostic; - `managed-config` tests repeated by the server-move service tests. Others tested a shared helper instead of their subject: the plugin-host env test called the `process-utils` sanitizer directly and never touched `PluginHostManager`. Two could not detect their bug: - the concurrent skill-staging test lacks a pinned clock, so it catches a same-millisecond temp-dir collision only by chance; - the watcher recovery harness is env-gated and asserts constants it hard-codes. A few tests kept exports alive only for themselves: `listPathsRecursively`, `diffCumulativeText`, `sendJsonRpc` and `toJsonRpcMessage`. ## What changed Found by a read-only test audit using the repo `test-audit` skill (#4361). - **Duplicate tests deleted.** Tests were tightened first where needed; for example, the relative-path handler test now asserts the error code and message. - **`runtime.fake-approvals.test.ts` deleted:** its unique assertions move into `runtime.interactive-requests.test.ts`, which now asserts the full command approval payload (reason, cwd, actions). - **`listPathsRecursively`:** its depth and exclusion cases now run through `listWorkspacePaths`, and the function is no longer exported. The dispatch test lists a nested directory. - **`diffCumulativeText`:** its tests fold into the assembler test, and it is no longer exported. - **`sendJsonRpc`:** inlined into `sendJsonRpcRequest`. `toJsonRpcMessage` is no longer exported. - **Unchanged:** request bytes, published Plugin SDK output and host-daemon wire shapes. - **Not in this PR:** the opt-in root-recovery benchmark (#2666), pending its author. Production +4/−15, tests +176/−1080. ## How you verified - `pnpm exec turbo run test lint typecheck` is green across host-daemon, agent-runtime, host-watcher, host-workspace, provider-bridge-acp, provider-bridge-protocol and provider-parity. - The only failures are the two `command-discovery` tests that fail on this machine when `/tmp/.agents` exists; they pass with `TMPDIR=/var/tmp/...`. - Off-pipeline suites: - provider-parity: 59/59. - integration `environment-actions`: 5/5. - agent-runtime `test:integration`: only the two real-Codex tests that also fail on base. - An independent verifier used before and after worktrees on 175d5ac and one mutation per removed test (39 tests). - Result: 31 OK, 4 with no unique failure mode, 4 partial losses. All 4 are restored here, and each fails under its mutation. - It also built `@get-bb/plugin-sdk` in both trees: `dist/` and `bundled-types/` are byte-identical. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
bb had no shared guidance for deciding whether a new test earns its keep or for auditing existing tests that duplicate stronger proof, couple to implementation, or keep test-only production seams alive. OpenClaw's
test-auditskill covers this, but its commands and paths are OpenClaw-specific.What changed
Adds
.bb/skills/test-audit/(SKILL.md, CAMPAIGN.md, and the upstream MIT LICENSE). The value bar, authoring gate, junk patterns, retention bar, candidate evidence, and edit shape are kept close to upstream. The bb-specific changes:pnpm exec turbo run test --filter=<pkg> -- <path>. It lists the suitesturbo run testskips (agent-runtime and real integration, provider corpus,pnpm parity, tarball and desktop smoke) and when to run each.sharedWorkerProjectsisolation, no comments, generated modules.HOST_DAEMON_PROTOCOL_VERSIONwire shapes, Plugin Guide surfaces, published@get-bb/plugin-sdkexports (public API even with zero in-repo consumers), and parity/corpus ownership of provider event shapes.git checkout <rev> -- .over uncommitted edits.> AGENT GENERATED, andclose-out. Review usesdocs/CODE_REVIEW.mdanddeslop.$crabboxheavy-proof routing and test line-cap baselines, which have no bb equivalent.How you verified
pnpm exec oxfmt --check .bb/skills/test-audit/passes.--filter=@bb/text-utils -- test/utf16.test.ts -t utf), and the off-pipeline task names were resolved withturbo run … --dry=json.🤖 Generated with Claude Code