Repository navigation
perf(test): narrow Gmail dependency fixtures - #131712
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Landing evidence for head The owning fix is fixture selection: the two filesystem/PATH probes now use existing Validation completed: 63 owner/helper tests on macOS normally and shuffled (seed 731), the same 63 on Linux shuffled (seed 947), restored and post-rebase 9-case full-file proof, complete Latest ClawSweeper comment checked immediately before native prepare: acknowledgement and a review-started placeholder, with no completed review or |
|
Merged via squash.
|
What Problem This Solves
Maintainer-requested test-performance work: the Gmail setup utility suite pays for an OpenClaw home/state/auth/session fixture in two cases that only need temporary executables. This adds avoidable imports and cleanup to every full-file run.
Related: #131617 introduced the unchanged-PATH installation regressions retained here. This does not duplicate #131502's separate Gmail error-diagnostics work.
Why This Change Was Made
Use the existing
withTestDirhelper for those two binary-availability cases. Keep real executable files and mode0755, PATH/XDG restoration, the scoped Darwin mock, installer mocks, both installer outcomes, and the repeated successful lookup. All nine per-case module resets remain: Python resolution and executable caches still require fresh owner modules. The remaining seven cases are unchanged.The canonical fixture boundary is filesystem-only here.
ensureDependencyuseshasBinaryand the mocked installer, not OpenClaw config, auth, or SQLite state. Shared test setup still owns its isolated home and runtime cleanup. No custom helper, production seam, schema, persistence, dependency, baseline, snapshot, or runtime behavior changes. Production LOC +0/-0; tests +4/-4. Incidental full-state fixture setup/teardown is removed; no asserted behavior is removed.User Impact
No product behavior change. Developers get a faster full Gmail utility test run with the same nine cases and fault sensitivity.
Evidence
Full-file benchmark
One task-owned Blacksmith Testbox,
tbx_01m13vkwrx9wndx2xkttjm8pnc, Linux Node 24.19.0, pnpm 11.22.0. Testbox workflow. Baseline source:65e0f00dad8f51b9fd52b4212e78ebab4f670cde. Baseline was run before editing. Warmups, hydration, sync, and resource diagnostics are excluded from the eight balanced pairs in each series. Odd pairs run baseline then candidate; even pairs reverse that order. Each invocation runs the entire file with one worker and import diagnostics:The cold series uses a fresh cache for every sample. The additional warm series uses separately warmed baseline/candidate caches. GNU time wall values are authoritative. All 32 measured invocations passed 9/9 tests.
Cold savings: 2.345s / 22.45%, all eight pairs faster. Warm savings: 1.060s / 12.86%, seven of eight pairs faster. Warm wall pairs (baseline/candidate seconds):
9.93/7.19, 8.68/7.18, 8.31/7.51, 8.18/7.44, 8.61/7.08, 7.72/8.00, 7.52/6.09, 7.91/6.52. The one warm loss is retained; no slow samples were discarded. Both series clear the required stable 0.5s absolute or 3% scoped-wall threshold.Removing the static full-state import shifts required Gmail imports into the first test body; body time alone therefore increases while total time and RSS decrease. This is not a claim that all collection import time vanished from execution.
Separate temporary instrumentation observed 5 fixture roots before/after, 18 → 14 fixture directories, 9 → 9 per-case module resets, and zero remaining fixture directories. PATH, XDG_CONFIG_HOME, and platform restored after every case. The cold process-tree diagnostic observed 6–8 processes per invocation including
/usr/bin/timeand command wrappers, peak 6–7; one Vitest worker was fixed in both versions. Installer/Python/Tailscale subprocess calls remain mocked, not real external executions.Reversible fault proof
Each fault was run against the full baseline and candidate files, then restored before the next experiment. All eight fault runs failed at the same intended test boundary:
Exact production bytes restored and SHA-256 checked:
gmail-setup-utils.ts=ee2fb0c518e0b9c12245371ddd866b2af12280532468f33b69897a83f3725b61;config-eval.ts=09af08c8b7237dbfd6b105d405028d1546143004a75bdef9eae3a7a5b85e53d9. Uninstrumented full-file proof passed after restoration. No fault or diagnostic instrumentation is in the patch.Coverage and gates
731; the same 63 passed on Linux shuffled with seed947. Files: Gmail utilities, Gmail operations, Gmail configuration, shared config-eval, temp-dir helper, and env helper.OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed(canonical flag selects local execution). Includes formatting, guards, all three dead-export scans, full core test typechecks, and changed-file lint. Initial automatic remote-delegation attempts were stopped before acquiring another lease; they are not counted as validation.git diff --check, numstat, test-audit, and deslop passed. Fresh isolated Codex autoreview passed at P0 scope, no accepted/actionable findings.4405196c84732e2cc34cf7077dcd20186e5c7fe70e7574f3ed6cee49263583b0). Upstream changes did not touch the measured owner/helper/harness surface. Focused post-rebase proof passed 9/9 on heade169af64aeebfecad0d87fb2aa0bc0c923f0c24f.completed. No live Gateway, authenticated Gmail, cloud resource, or native Windows run is claimed. Windows skip behavior, mocked-platform behavior, existing cleanup semantics, and real executable permissions are unchanged.The fallback plugin-index import candidate remains unmeasured because Gmail qualified. Only this PR is in scope. AI-assisted with Codex.