Skip to content

chore(tooling): fix #864, #865, #866, #867 contributor tooling and docs - #1250

Merged
vjuliaife merged 2 commits into
vjuliaife:mainfrom
AderonkeAfolabi:fix/contributor-enhancements-864-865-866-867
Oct 18, 2026
Merged

vjuliaife merged 2 commits into
vjuliaife:mainfrom
AderonkeAfolabi:fix/contributor-enhancements-864-865-866-867

Conversation

@AderonkeAfolabi

Copy link
Copy Markdown
Contributor

Closes #864, closes #865, closes #866, closes #867

This pull request resolves four contributor experience, developer tooling, and documentation gaps across the repository:

1. Issue #864: Local Lambda Invocation Harness for Backup Lambdas

  • Problem: scripts/backup-cleanup-lambda.ts and scripts/backup-compliance-report-lambda.ts were written as AWS Lambda handlers without a local invocation path. Contributors testing retention logic or compliance reporting either had to deploy to AWS or manually construct event/context stubs, and running locally triggered AWS credential authentication errors.
  • Solution: Introduced scripts/lib/invoke-lambda-local.ts, an in-process local runner that mocks @aws-sdk/client-rds, @aws-sdk/client-dynamodb, @aws-sdk/client-s3, and @aws-sdk/client-cloudtrail. It provides synthetic test data for snapshot policies, S3 objects, and DynamoDB audit records so contributors can perform dry-run smoke tests with zero AWS credentials. Documented invocation commands in both script headers and docs/OPERATIONS_RUNBOOK.md, and added automated regression tests in scripts/tests/invoke-lambda-local.test.ts.

2. Issue #865: VS Code Format-on-Save Configuration

  • Problem: Root .prettierrc and rustfmt.toml configurations existed, but no editor workspace settings enabled format-on-save. Code was only formatted at commit time via lint-staged, causing noisy diffs during active development.
  • Solution: Added .vscode/settings.json enabling editor.formatOnSave: true and configuring esbenp.prettier-vscode as the default formatter for TypeScript, JavaScript, JSON, YAML, and Markdown. Explicitly assigned [rust] to rust-lang.rust-analyzer to ensure Rust files defer to rustfmt.toml without Prettier conflicts. Added extension recommendations in .vscode/extensions.json and documented setup in docs/local-dev.md and CONTRIBUTING.md.

3. Issue #866: Reproducible Query Analysis & Benchmarking

  • Problem: docs/query-analysis.md documented EXPLAIN ANALYZE findings for hot-path PostgreSQL queries but did not explain how contributors could regenerate the query plans locally, what seed data volumes were assumed, or where the queries originated in apps/api/src.
  • Solution: Updated the query table with direct links to call sites in apps/api/src/routes/importers.ts for all 9 queries. Added a "Reproducing this analysis locally" section explaining why default seeds trigger Seq Scan on small tables, providing a self-contained SQL synthetic generator (generate_series) for realistic benchmark volumes ($\ge 1,000$ importers, $\ge 50,000$ events), and documenting parameterized EXPLAIN (ANALYZE, BUFFERS) commands. Cross-referenced from CONTRIBUTING.md's Testing section as an optional performance regression check.

4. Issue #867: Contributor Local Setup Support Channel

  • Problem: docs/runbooks/support-escalation.md covers production on-call escalation, but there was no documented channel for contributors stuck on local environment setup.
  • Solution: Added a "Stuck on local setup?" section to docs/local-dev.md pointing to GitHub Issues with the [dev-setup] title convention. Cross-linked the support channel at the top of docs/FAQ.md and in CONTRIBUTING.md, while keeping production incident escalation in docs/runbooks/support-escalation.md strictly separated.

Changed

Testing

The changes were verified using the following commands:

# 1. Run automated regression tests for local Lambda runner (#864)
npx tsx --test --test-force-exit scripts/__tests__/invoke-lambda-local.test.ts
# Result: 7 tests passed (0 failures) in 256ms

# 2. Verify CLI dry-run smoke test: backup cleanup (#864)
npx tsx scripts/lib/invoke-lambda-local.ts cleanup --dry-run
# Result: Deleted 2 expired snapshots, created 2 audit records, exited with code 0

# 3. Verify CLI dry-run smoke test: compliance report (#864)
npx tsx scripts/lib/invoke-lambda-local.ts compliance-report --dry-run
# Result: Generated compliance report, uploaded mock S3 object, exited with code 0

# 4. Verify code formatting against root .prettierrc (#865)
npx prettier --check .vscode/settings.json .vscode/extensions.json scripts/lib/invoke-lambda-local.ts scripts/__tests__/invoke-lambda-local.test.ts scripts/backup-cleanup-lambda.ts scripts/backup-compliance-report-lambda.ts docs/local-dev.md docs/FAQ.md docs/OPERATIONS_RUNBOOK.md docs/query-analysis.md CONTRIBUTING.md
# Result: All files formatted cleanly

Scope Notes

  • Tooling & Docs Only: No changes to production smart contracts (contracts/tariff-shield/) or API route business logic (apps/api/src/routes/).
  • No Dependencies Added: The Lambda runner uses native Node.js module interception without adding external packages to package.json.
  • Zero Production Runbook Disruption: docs/runbooks/support-escalation.md remains completely unmodified.

Push Command

git push -u origin fix/contributor-enhancements-864-865-866-867

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tariff-shield-web Error Error Oct 18, 2026 12:46am UTC

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@AderonkeAfolabi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Comment on lines +17 to +22
import {
invokeLambdaLocal,
createMockLambdaContext,
createMockLambdaEvent,
getDefaultMockAwsData,
} from '../lib/invoke-lambda-local';
DeleteDBSnapshotCommand,
} from '@aws-sdk/client-rds';
import { DynamoDBClient, PutItemCommand } from '@aws-sdk/client-dynamodb';
import { CloudTrailClient, LookupEventsCommand } from '@aws-sdk/client-cloudtrail';

const rds = new RDSClient({ region: process.env.AWS_REGION || 'us-east-1' });
const dynamodb = new DynamoDBClient({ region: process.env.AWS_REGION || 'us-east-1' });
const cloudtrail = new CloudTrailClient({ region: process.env.AWS_REGION || 'us-east-1' });
@vjuliaife
vjuliaife merged commit 959ca85 into vjuliaife:main Oct 18, 2026
10 of 27 checks passed

This branch had an error being deployed

1 failed deployment
Preview — 555fbf9d Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants