Skip to content

feat: generate push-payload JSON files per destination#3769

Draft
varadarajan-tw wants to merge 9 commits into
mainfrom
feat/generate-push-payloads
Draft

feat: generate push-payload JSON files per destination#3769
varadarajan-tw wants to merge 9 commits into
mainfrom
feat/generate-push-payloads

Conversation

@varadarajan-tw
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new generate:push-payload CLI command (yarn push-payloads from repo root) that generates a payload.json file co-located 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 (metadata, options, actions with fields, presets)
  • GitHub Actions workflow runs on PR open/sync, push to main, and workflow_dispatch — generates and commits updated payload files automatically
  • CI validation step (assert-push-payloads-updated.sh) ensures payload.json files are committed and current on every PR, following the same pattern as assert-types-updated.sh

Test plan

  • yarn push-payloads runs locally and writes payload.json into each destination folder
  • yarn push-payloads --slug=actions-amplitude generates a single destination's payload
  • CI validate job passes with the committed payload files
  • Opening a PR triggers the Generate Push Payloads workflow

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
Copilot AI review requested due to automatic review settings April 30, 2026 07:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Comment thread .github/workflows/generate-push-payloads.yml Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.21%. Comparing base (6601116) to head (df24189).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- 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)
Copilot AI review requested due to automatic review settings May 5, 2026 06:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

…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.
Copilot AI review requested due to automatic review settings May 5, 2026 07:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

varadarajan-tw and others added 2 commits May 5, 2026 17:01
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>
Copilot AI review requested due to automatic review settings May 5, 2026 11:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings May 5, 2026 11:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

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.

3 participants