Repository navigation
feat: test data factories, client bundle secret scan, advisory-lock job leader election, accessible chart tables - #940
Merged
Dydex merged 1 commit intoOct 17, 2026
Conversation
…ection, accessible chart tables - testing (AstronLabs#932): typed fluent factories for applicants, loans and milestones with named variants (verified, overdue, approved, ...). A schema-drift test ties them to prisma/schema.prisma. A ratcheted guard test discourages inline fixtures. First four test files migrated; pattern documented. - security (AstronLabs#933): scripts/client-bundle-secret-scan.mjs scans the built client bundle and source maps for known key formats, leaked server env values and non-NEXT_PUBLIC_ exposure, against a reviewed allowlist. New CI workflow; tests plant fake secrets. - database (AstronLabs#935): PostgreSQL advisory-lock leader election for scheduled jobs. One instance runs each tick, the lock is release are recorded in ScheduledJobRun, skips are exported as metrics. Scheduler jobs wrapped. - frontend (AstronLabs#928): AccessibleChart wrapper adds a trend summary and a chart/table toggle (real table, keyboard operablrt.
|
@Ojukwu-Chinedu 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! 🚀 |
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
Resolves #932, #933, #935 and #928.
closes #932 Shared test data factories
backend/src/test-utils/factories/: immutable fluent builders (with,build,buildMany, deep-merge overrides, deterministic ids).applicantFactory:verified(),ineligible(),pending(),deleted(),snapshot().loanFactory(API shape) andloanRowFactory(Prisma row shape):overdue(),repaying(),approved(),manualReview(), ...milestoneProposalFactory:open(),approved(),rejected().testFactories.test.tscompares the Applicant/LoanApplication factories withschema.prisma, so a model change fails in one place.autoRejectionRules,adminPortfolioDigest,optimisticLocking,loanAsOf.noInlineFixtures.test.tsis a ratcheted guard. Legacy files are baselined and the list can only shrink;// fixture-ok:opts out. Also a PR template checklist item and a CONTRIBUTING note.docs/TEST_DATA_FACTORIES.mdcloses #933 Client bundle secret scan
scripts/client-bundle-secret-scan.mjs+.github/workflows/client-bundle-secret-scan.yml..next/staticand app sources in source maps for known key formats: checksum-validated Stellar seeds, AWS/GitHub/Slack/Stripe/etc., PEM, JWT, credentialed URLs, high-entropy secret assignments.NEXT_PUBLIC_prefix:next.configenv:, client-componentprocess.envreads, and secret-lookingNEXT_PUBLIC_*names.devops/client-bundle-secret-allowlist.json(SHA-256 or value, reason required). Reports never print full secrets.next.config.ts:productionBrowserSourceMapsonly whenCLIENT_BUNDLE_SOURCEMAPS=true(CI scan only).docs/CLIENT_BUNDLE_SECRET_SCAN.mdcloses #935 Advisory-lock leader election
services/jobLeaderElection.ts:pg_try_advisory_xact_lockheld by an open transaction. A crashed holder's connection dies, so PostgreSQL releases the lock immediately (no TTL).runningrow, skip if the run already completed withinminIntervalMs(recently_run), recordScheduledJobRun {jobName, instanceId, ...}.scheduledJob()wrapper (never rejects, fails closed) applied to cluster-wide jobs inscheduler.ts,partitionManager,analyticsRefresh,webhookAutoDisable,ipfsOrphanCleanup,backupScheduler. Per-process jobs (JWT/secrets/webhook key rotation, mTLS) are intentionally not wrapped.remitmortgage_scheduled_job_skipped_total{job,reason},remitmortgage_scheduled_job_runs_total{job,outcome}.20261017030000_scheduled_job_runs(withdown.sql) + Prisma model.docs/JOB_LEADER_ELECTION.mdcloses #928 Accessible chart data tables
AccessibleChartwrapper +lib/chart-summary.ts(trend/share summaries).aria-pressed); real<table>with caption,scopeheaders, focusable scroll region; live-region announcement. The table renders the same rows as the chart/CSV export, so it follows filters and time range.docs/ACCESSIBLE_CHART_TABLES.mdTesting
tsc --noEmitclean.jobLeaderElection,testFactories,noInlineFixturessuites plus migrated suites pass (53 tests). Compared withmain, the suites I touched show the same pre-existing failures (see notes).node --test scripts/client-bundle-secret-scan.test.mjs: 18/18; scanner run against a realnext buildwith source maps: 0 findings.Notes for reviewers
schema.prismaalready fails validation onmain(ApiKey.usagereferences an undefinedApiKeyUsage), soprisma generatefails there. I did not touch it. I verified using a patched copy of the schema.check-migration-rollbacksand a number of backend suites already fail onmainin this environment. The new migration has adown.sql.ScheduledJobRunis missing.