tests: raise claw-pilot coverage from 79.5% to 83.7%#1
Merged
Conversation
Five new test files cover gaps in the inbound pipeline, lifecycle, channel plugin API, status/directory adapters, and wire envelope GC + HMAC defenses: - inbound-coverage: ack-send happy path + failure logging, onPeerProofOfLife fire-and-throw-handling, HMAC peer port-strip, oversize media drop, filename sanitization, ext fallback when sender omits filename, duplicate media drop, unknown envelope kind drop. - status-directory: every state branch in summarize (missing/disabled/ starting/ok), listEntries shape, resolveTarget rejection paths. - channel-plugin-api-coverage: config adapter (defaultAccountId, listAccountIds, resolveAccount), normalizeTarget whitespace handling, lifecycle hooks (onAccountConfigChanged, onAccountRemoved, runStartupMaintenance). - lifecycle-coverage: stopAll resilience when transport.stop rejects, periodic outbox drain, drain failure path, onPeerProofOfLife wiring. - wire-coverage: MediaReassembler.gc eviction, Reassembler.gc default-args, verifyEnvelope malformed-base64 and length-mismatch rejection. 230 tests, all passing. No production code modified.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
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
Adds 42 new tests across 5 files targeting coverage gaps in the TypeScript plugin. No production code modified.
Branches went 84.7% → 87.7%, functions 81.7% → 86.9%.
New test files
onPeerProofOfLife(fires + throw-safe + control-frame trigger), HMAC port-strip, oversize media drop, filename sanitization, ext fallback, duplicate media, unknown envelope kind.summarizestate branch (missing / disabled / starting / ok),listEntries,resolveTargetrejection paths.defaultAccountId/listAccountIds/resolveAccount),normalizeTargetwhitespace handling, lifecycle hooks (onAccountConfigChanged,onAccountRemoved,runStartupMaintenance).stopAllresilience when transport rejects, periodic outbox drain, drain failure path,onPeerProofOfLifewiring through to outbox.MediaReassembler.gceviction,Reassembler.gcdefault args,verifyEnvelopemalformed-base64 + length-mismatch defenses.What was not covered (and why)
pilot-transport.ts/pilot-worker.ts(still 0%): require a livepilotprotocol.Driverplus aworker_threads.Worker. Need integration setup, not unit tests.index.ts(still 46.9%): theregister()setTimeout /fs.watch/~/.openclaw/openclaw.jsonboot path needs a long-running fixture; the double-register guard is already tested.Sources/is 90% SwiftUI/UIKit views. The unit-testable Swift modules (Wire,MessageStore,ProfileStore) already have high coverage from 146 existing Swift tests.Findings (not fixed — flagged only)
channel-plugin-api.ts onAccountConfigChangedcallstransport.stop()but does not remove the account fromlifecycle.accountsbefore callingstartAll(nextCfg). The subsequentstartAccountthrows "already running" and the new allowlist is silently ignored. Documented in the matching test as observed behavior.inbound.ts sanitizeFilenamestrips/(preventing directory escape) but leaves literal..sequences in the basename. Harmless in practice because no/remains, but the function name oversells what it does. Updated test asserts "no path escape" rather than "no..substring."Test plan
npx vitest run— 230 / 230 passnpx vitest run --coverage— 83.7% lines, 87.7% branches, 86.9% functionsgit diff --statshows onlyplugin/tests/*-coverage.test.tsand onetests/status-directory.test.ts)