Repository navigation
Conversation
Pass variableMutationsOnly to host.execute so the sandbox sends back only mutations for environment, globals and collectionVariables. The full post-script scopes for the script trigger are rebuilt from the context sent to the sandbox (the masked clone when forbidden secrets apply) with the mutations applied. An older sandbox ignores the option and sends the full scopes, which are used as before. Co-Authored-By: Claude <[email protected]>
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (46.15%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1568 +/- ##
===========================================
- Coverage 77.54% 77.42% -0.12%
===========================================
Files 51 51
Lines 4338 4346 +8
Branches 1223 1225 +2
===========================================
+ Hits 3364 3365 +1
- Misses 731 737 +6
- Partials 243 244 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Full-run results, for reviewers. This was a copy of the PPC Governor collection (AUTO-1062) through a local CLI build: 44 VUs, fixed load, 20 min, 6 GiB / 4 CPU. The run used a prototype that patched the sandbox the same way as this PR (only
Why it helps: the allocation profile of the host thread shows the uvm bridge making about 6 copies of the variables per script run ( Reviewer guide covering all the AUTO-1062 changes: https://claude.ai/artifact/S7vBMoFxTA9kjzQHhQTXpt |
Context
AUTO-1062 / AUTO-60. After each script the sandbox sends back the full environment, globals and collectionVariables, and runtime only applies their
mutations. With ~4 MB of variables that copy costs ~22 ms and ~22 MB per script. One sandbox thread serves all VUs, so it also caps throughput: in a 44-VU, 20-minute CLI run, a prototype cut the worker peak from 2.65 to 1.92 GB and raised throughput from 32 to 40 rps.Summary of the change
event.command.jspassesvariableMutationsOnly: truetohost.execute(needs feat(AUTO-1062): add variableMutationsOnly option to return only scope mutations postman-sandbox#1116).values, runtime rebuilds it withapplyScopeMutations: a copy ofcontextToUse[scope]with the mutations applied, and.mutationskept. Thescripttrigger still gets full scopes with mutations, which nested-request and consumers read.contextToUseis the masked clone when_forbiddenSecretKeysapply, so masked secrets stay masked in the script result. A sandbox-only prototype failed 9 tests here (8 vault masking, 1 pm.variables).result[scope].mutations→applyOn(payload.context[scope]), as before.Breaking changes
None. An older sandbox ignores the option and sends full scopes, which take the old path (detected by
values). An older runtime never sets the option.Dependencies
postmanlabs/postman-sandbox#1116 (
variableMutationsOnly). No gain until runtime bumpspostman-sandbox. Until then this PR is behaviour-neutral.Test plan
Bench:
node copybench.js <runtimeDir> 7 100(1 request, prerequest + test script, 4.08 MB collection vars, 200 scripts):Additional notes
Draft to
develop. Hold it until the sandbox release, then add the dependency bump.Generated with Claude Code