Skip to content

feat: add async federation export trigger#4840

Open
mashbean wants to merge 1 commit into
developfrom
feat/federation-lambda-trigger
Open

feat: add async federation export trigger#4840
mashbean wants to merge 1 commit into
developfrom
feat/federation-lambda-trigger

Conversation

@mashbean

@mashbean mashbean commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add lambda_async federation export trigger mode for publish/edit paths
  • keep off and record_only behavior unchanged; off still means no trigger call
  • enforce strict public-only + author/article federation gate before Lambda invocation
  • invoke federation-export Lambda asynchronously only for eligible rows, with S3 output required
  • record queued, skipped, or failed status in federation_export_event

Safety

  • this PR does not enable production outbound by itself
  • rollback remains setting MATTERS_FEDERATION_EXPORT_TRIGGER_MODE=record_only or off
  • missing Lambda function name or S3 bucket marks the event failed and is caught by existing publish/edit error handling
  • private/paywalled/non-opt-in articles are recorded as skipped and do not invoke Lambda

Required env for lambda_async

  • MATTERS_FEDERATION_EXPORT_TRIGGER_MODE=lambda_async
  • MATTERS_FEDERATION_EXPORT_LAMBDA_FUNCTION_NAME
  • MATTERS_FEDERATION_EXPORT_S3_BUCKET
  • optional: MATTERS_FEDERATION_EXPORT_S3_PREFIX
  • optional: MATTERS_FEDERATION_WEBF_DOMAIN

Verification

  • npm run build
  • npm run lint
  • npx -p node@18 node --experimental-vm-modules --no-experimental-fetch node_modules/.bin/jest build/connectors/__test__/federationExportService.test.js build/mutations/article/__test__/federationExportTrigger.test.js --runInBand --forceExit

Notes

  • local Node is v24, so Jest was run through temporary Node 18 to match repo engine.
  • npm install reported existing audit findings; no audit fix was run to avoid unrelated dependency churn.

@mashbean mashbean requested a review from a team as a code owner June 6, 2026 19:36
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.31579% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.41%. Comparing base (85bdbe1) to head (21b6358).
⚠️ Report is 19 commits behind head on develop.

Files with missing lines Patch % Lines
src/connectors/article/federationExportService.ts 72.72% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4840      +/-   ##
===========================================
- Coverage    72.82%   72.41%   -0.42%     
===========================================
  Files         1054     1054              
  Lines        21263    20946     -317     
  Branches      4671     4538     -133     
===========================================
- Hits         15485    15168     -317     
- Misses        5706     5708       +2     
+ Partials        72       70       -2     

☔ View full report in Codecov by Harness.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant