feat: generate push-payload JSON files per destination#3769
Draft
varadarajan-tw wants to merge 9 commits into
Draft
feat: generate push-payload JSON files per destination#3769varadarajan-tw wants to merge 9 commits into
varadarajan-tw wants to merge 9 commits into
Conversation
Adds a new CLI command `generate:push-payload` (available as `yarn push-payloads` from the repo root) that generates a `payload.json` file inside each destination's source folder. The payload represents the exact JSON body that would be sent to the Segment control plane during a push operation. - New command: packages/cli/src/commands/generate/push-payload.ts - Payload files written to <destination>/payload.json (co-located with index.ts) - GitHub Actions workflow triggers on PR open/sync, push to main, and workflow_dispatch - CI validation step (assert-push-payloads-updated.sh) ensures payloads are committed and up-to-date on every PR
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3769 +/- ##
==========================================
- Coverage 80.93% 80.21% -0.72%
==========================================
Files 1348 1349 +1
Lines 25089 25333 +244
Branches 5212 5293 +81
==========================================
+ Hits 20305 20321 +16
- Misses 3837 4065 +228
Partials 947 947 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Set HUSKY=0 in workflow commit step to prevent husky pre-commit hook from trying to install gitleaks via brew (not available on runners) - Add .prettierignore for payload.json so prettier never reformats them, ensuring assert-push-payloads-updated.sh produces a clean diff - Regenerate all payload files in the correct (non-prettified) format - Filter payload.json from required-field-check CHANGED_FILES to avoid hitting ARG_MAX limit when passing 216 paths as shell arguments - Pass workflow_dispatch slug input via env var to prevent shell injection (addresses semgrep finding)
…sing payloads getManifest() was loading @segment/destinations-manifest from packages/cli/node_modules (a stale published copy with ~6 browser destinations) instead of the workspace-built version at the repo root (which has all 50+ browser destinations). Fix by resolving both manifests via require.resolve with cwd as the search path, matching how CI resolves them after yarn install with workspace hoisting. Also improves assert-push-payloads-updated.sh to print which files are stale instead of a bare failure message.
The version field used a template literal that embedded the Node.js runtime version (process.version), causing the payload.json to differ across environments and Node.js versions, breaking the CI assert check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…load.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
generate:push-payloadCLI command (yarn push-payloadsfrom repo root) that generates apayload.jsonfile co-located inside each destination's source folderpushoperation (metadata, options, actions with fields, presets)workflow_dispatch— generates and commits updated payload files automaticallyassert-push-payloads-updated.sh) ensurespayload.jsonfiles are committed and current on every PR, following the same pattern asassert-types-updated.shTest plan
yarn push-payloadsruns locally and writespayload.jsoninto each destination folderyarn push-payloads --slug=actions-amplitudegenerates a single destination's payloadGenerate Push Payloadsworkflow