Skip to content

fix: startup validation, pagination docs, UI consolidation, reveal tests - #1562

Open
10xwhoman wants to merge 2 commits into
LabsCrypt:mainfrom
10xwhoman:fix/startup-validation-swagger-ui
Open

fix: startup validation, pagination docs, UI consolidation, reveal tests#1562
10xwhoman wants to merge 2 commits into
LabsCrypt:mainfrom
10xwhoman:fix/startup-validation-swagger-ui

Conversation

@10xwhoman

Copy link
Copy Markdown

Resolves four issues across backend config, Swagger docs, frontend component consolidation, and hook test coverage.

Changes

#1519 — Loan config startup validation (mirror env.ts pattern)

  • Added validateLoanConfigOnStartup() to loanConfig.ts that catches config errors, logs to console and structured logger, and calls process.exit(1) — identical exit pattern to validateEnvVars()
  • Updated index.ts to call validateLoanConfigOnStartup() at the top-level startup path before accepting traffic
  • Extended loanConfig.test.ts with a validateLoanConfigOnStartup describe block: success, missing var, out-of-range value

#1518 — useReveal test suite

  • Added useReveal.test.tsx with five cases:
    1. Success — revealed value stored in state
    2. 403 access denied — error surfaced, no PII leaked
    3. 410 expired — error surfaced, no PII leaked
    4. clearRevealed() — value nulled, mutation reset
    5. No PII before request resolves (in-flight guard)

#1517 — UI component consolidation

  • Moved COPY_FEEDBACK_RESET_MS = 2000 into CopyButton.tsx (single source of truth) and used it in the setTimeout call
  • ui.tsx now re-exports COPY_FEEDBACK_RESET_MS from CopyButton.tsx — all existing imports continue to work unchanged

#1516 — Pagination swagger description

  • Added description field to the Pagination schema in swaggerSchemas.ts linking to docs/pagination-contract.md

Closes #1519
Closes #1518
Closes #1517
Closes #1516

10xwhoman and others added 2 commits July 29, 2026 01:24
- LabsCrypt#1519: add validateLoanConfigOnStartup() mirroring validateEnvVars() pattern —
  catches config errors, logs to console and logger, calls process.exit(1);
  update index.ts to call it at the top-level startup path; extend
  loanConfig.test.ts with validateLoanConfigOnStartup coverage
- LabsCrypt#1518: add useReveal.test.tsx with five cases: success, 403 access denied,
  410 expired, PII cleared via clearRevealed(), no PII before request resolves
- LabsCrypt#1517: move COPY_FEEDBACK_RESET_MS constant into CopyButton.tsx (single
  source of truth), use it in setTimeout; ui.tsx re-exports from CopyButton
  for backward compatibility with existing imports
- LabsCrypt#1516: add description field to Pagination swagger schema linking to
  docs/pagination-contract.md

Closes LabsCrypt#1519
Closes LabsCrypt#1518
Closes LabsCrypt#1517
Closes LabsCrypt#1516

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the four small fixes are all legit and the useReveal coverage is welcome. but now that main's CI is green again, this branch fails on its own changes:

  1. backend: your new src/tests/loanConfig.test.ts fails (see the backend job log for the run on the updated branch). there is also a duplicated originalEnv setup block in that file worth cleaning while you are in there.
  2. frontend: the frontend job is red on the updated branch too, please check that log and fix or rebase.

once those two jobs are green this is good to merge.

if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

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