Skip to content

fix: support shrunk client payloads on v2-lite - #569

Closed
yeelali14 wants to merge 4 commits into
v2-litefrom
fix/v2-lite-shrink-payload
Closed

fix: support shrunk client payloads on v2-lite#569
yeelali14 wants to merge 4 commits into
v2-litefrom
fix/v2-lite-shrink-payload

Conversation

@yeelali14

@yeelali14 yeelali14 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

client_payload arrives in one of three shapes — plain JSON, base64(gzip(JSON)), or a small reference to a payload stashed on the resolver. v2-lite read fields out of it with fromJSON(fromJSON(inputs.client_payload)) in four places, which throws on the last two shapes before any step runs.

Why the YAML fix alone is not enough

action.yml deliberately passes CLIENT_PAYLOAD through untouched — the action resolves only the fields needed for step expressions, and the engine inflates the payload. That's intentional: inflated it's ~1.4MB+, so pushing it through a step output would risk E2BIG and defeat the compression entirely.

So the engine has to understand the envelope, and v2-lite's does not:

engine bundle decodes shrunk payload?
v2 (2.0.258) core 2.1.282-6
v2-lite (2.0.211, Jan) core 2.1.246

Without the bump the checkout steps would succeed and dist/index.js would then fail. Hence two changes.

Changes

  1. action.yml — resolve the fields via scripts/resolve-payload-fields.js, as v2 does.
  2. Engine bump@linearb/gitstream-core 2.1.2462.1.301, dist/ rebuilt.

Lite properties preserved

dist/ was rebuilt with this branch's own package script (ncc + copy-wasm) rather than copied from v2 — copying would have broken the thing that makes this branch lite:

this branch  dist/node_modules/ = @wasm-fmt
v2 (2.0.258) dist/node_modules/ = @wasm-fmt @octokit axios lodash moment agent-base asynckit …

Also untouched: the runtime Install Dependencies for plugins step, the absence of NODE_PATH, and the existing action pins — the new step reuses this branch's github-script@v8 rather than importing v2's v9. checkout@v6, upload-artifact@v6, ALL=100 and the git-fetch behaviour are all left as they are.

Verification

  • Rebuilt bundle contains oversized-payload-reference, payloadUrl, gunzipSync.
  • 66 tests pass (8 suites), lint clean, prettier clean.
  • The 7 steps.payload-fields.outputs.* references match the 7 keys emitted.

Known follow-up (not in this PR)

dist/ still carries four orphaned chunk files from the January build — 407/582/788/888.index.js and a root-level ruff_fmt_bg.wasm. The current build emits only 178/880/966/index.js (matching v2 exactly), so these are dead weight on a branch whose point is being lite. Left alone deliberately: deleting build artifacts isn't part of a payload fix, and a smaller diff is easier to review. Worth a separate cleanup.

Separately: this branch's releases have silently no-opped since January because a stray v2-lite tag shadows the v2-lite branch, so git checkout v2-lite in the release job detaches onto the tag and the push is a no-op. That needs fixing before anything here reaches consumers.

🤖 Generated with Claude Code

✨ PR Description

Purpose: Enable v2-lite action version to handle compressed and oversized client payloads through a dedicated payload resolution utility.

Main changes:

  • Created resolve-payload-fields.js script supporting plain JSON, gzip-compressed, and server-stashed payload formats with security validation
  • Updated action.yml to resolve payload fields via github-script step before checkout, replacing inline JSON parsing
  • Upgraded gitstream-core to v2.1.301 and modified main.ts to use v2-lite action version

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

client_payload arrives as plain JSON, base64(gzip), or a reference to a
server-stashed payload. v2-lite resolved fields with
fromJSON(fromJSON(inputs.client_payload)) in four places, which throws on
the last two shapes before any step runs.

Two changes are needed, because the YAML fix alone is not sufficient:

- action.yml resolves the fields it needs for step expressions via
  scripts/resolve-payload-fields.js, as v2 does. CLIENT_PAYLOAD is still
  passed through untouched.
- The engine bundle is bumped from core 2.1.246 to 2.1.301. The action
  deliberately does not inflate CLIENT_PAYLOAD itself - the payload is
  ~1.4MB+ inflated, so pushing it through a step output would risk E2BIG
  and defeat the compression. The engine inflates it, and 2.1.246 has no
  support for the envelope, so the checkout would succeed and the engine
  would then fail.

The lite properties are preserved: dist is rebuilt with this branch's own
package script (ncc + copy-wasm), so dist/node_modules still contains only
@wasm-fmt rather than v2's vendored octokit/axios/lodash/moment, the
runtime "Install Dependencies for plugins" step is untouched, and no
NODE_PATH is introduced. The existing action pins (checkout v6,
github-script v8, upload-artifact v6) are left as they are - the new step
reuses this branch's github-script v8 rather than importing v2's v9.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@orca-security-us orca-security-us Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@linearb linearb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ PR Review

The PR is well-structured and correctly addresses the three payload shapes. The resolution script is clean, the security mitigations (origin check, size cap, secret masking) are solid, and the test coverage is thorough. One functional gap stands out in the updated action.yml.

1 issues detected:

🐞 Bug - `steps.payload-fields.outputs.github_token` is now resolved and masked, but the cm repo and cm org checkout steps are not using it — they were not updated alongside the base-branch checkout.

Details: The "Checkout cm repo" and "Checkout cm org" steps do not supply a token field. The entire motivation of this PR is to make the github_token from the payload available to downstream steps — the base-branch checkout was correctly updated to use steps.payload-fields.outputs.github_token || github.token, but the two CM checkouts were not. If either CM repository is private, these steps will fall back to the default GITHUB_TOKEN, which may not have access, silently producing a clone failure or an empty checkout that the engine then processes incorrectly.

File: action.yml (119-133)

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how

Same resolver change as develop: parse first and switch on the value of
`type`, so the double-encoded compressed-payload envelope the GitHub
trigger will send is inflated instead of being mistaken for a raw payload
and silently resolving to empty fields.

Both compressed forms stay supported permanently - Bitbucket has no
run-name to protect and keeps sending the bare base64(gzip) form.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
yeelali14 and others added 2 commits August 13, 2026 14:27
Same coverage as develop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Same diagnostic as develop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@yeelali14

Copy link
Copy Markdown
Contributor Author

Closing — not needed. Shrink-payload support is landing on develop/@v2 via #571; v2-lite isn't getting it.

@yeelali14 yeelali14 closed this Aug 13, 2026
@yeelali14
yeelali14 deleted the fix/v2-lite-shrink-payload branch August 13, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant