Skip to content

fix: token symbol source of truth, Node 22 pinning, render.yaml cleanup, db-restore safeguards (#1264 #1909 #1911 #1912) - #1924

Merged
K1NGD4VID merged 5 commits into
LabsCrypt:mainfrom
pheelztech:fix/issues-1264-1909-1911-1912
Nov 20, 2026
Merged

K1NGD4VID merged 5 commits into
LabsCrypt:mainfrom
pheelztech:fix/issues-1264-1909-1911-1912

Conversation

@pheelztech

Copy link
Copy Markdown
Contributor

Summary

Fixes four audit/DevOps issues in one PR, one commit per issue.

#1264: Single source of truth for token symbols

  • New frontend/src/lib/tokens.ts with resolveTokenSymbol / resolveTokenLabel, derived from TOKEN_ADDRESSES in lib/soroban.ts.
  • lib/dashboard.ts, lib/api/streams.ts and the stream details page now import it. The details page's hardcoded TOKEN_SYMBOLS map is gone (it also ignored NEXT_PUBLIC_*_ADDRESS overrides).
  • New tokens added to TOKEN_ADDRESSES now resolve on all three surfaces with one change. Added tokens.test.ts.

#1911: One Node version everywhere (22)

  • .nvmrc = 22; engines.node = ^22.22.1 in the root, backend and frontend package.json (and lockfile).
    • ^22.22.1 rather than plain 22: lint-staged requires >=22.22.1 and @stellar/stellar-sdk >=22.12.0.
  • Enforced with engine-strict=true in .npmrc. Tested: npm install on Node 20 now fails with a clear EBADENGINE error.
  • Every workflow uses node-version-file: '.nvmrc' (security.yml was 20.19.0, deploy-docs.yml was 20).
  • Dockerfiles: node:20-alpine → digest-pinned node:22-alpine. render.yaml: NODE_VERSION: "22".
  • docs/DEVELOPMENT.md and CONTRIBUTING.md document the same version.

#1909: render.yaml cleanup

  • env: node → runtime: node; autoDeploy: true → autoDeployTrigger: commit; removed the invalid entrypoint.
  • Migrations run in exactly one place: preDeployCommand. startCommand is now just npm run start. A failed migration aborts the deploy instead of crash-looping the service. The deploy lifecycle is documented at the top of the file.
  • STREAM_CONTRACT_ID and ADMIN_PUBLIC_KEY use sync: false (Render prompts for them), and preDeployCommand fails the deploy with a clear message if either is unset or empty.
  • ⚠️ preDeployCommand requires a paid Render instance type.

#1912: db-restore.sh safety safeguards

  • Refuses non-empty targets (exit 3) unless --force.
  • --dry-run decrypts and validates the backup, inspects the target and prints the plan, without writing anything.
  • --force requires typing the database name (or --yes for automation), writes an encrypted pre-restore snapshot in the normal backup format (restorable with the same script), then replaces all user schemas.
  • Transactional: the schema wipe, SQL restore and per-table row-count checks all run inside one psql --single-transaction. Any failure rolls back, leaving the target unchanged.
  • The manifest is validated before being interpolated into SQL.
  • Also fixes scripts/pg-service.mjs: it wrapped service-file values in quotes, which libpq does not strip (invalid integer value "'5432'" for connection option "port"). That broke every connection made by db-restore.sh and db-backup.sh.
  • docs/DISASTER_RECOVERY.md now documents the flags and gives a failure-state/recovery table that matches the script.
  • The existing dr-test.yml call (empty DB, no flags) keeps working unchanged.

Testing

  • Frontend: vitest run on Node 22 → 95 files, 1061 passed + 1 pre-existing skip, after updating the @/lib/soroban mock in stream-details-content.test.tsx. tsc --noEmit and eslint on the changed files are clean.
  • render.yaml: parsed with yaml; preDeployCommand verified to abort when a required variable is empty and to proceed when both are set.
  • db-restore.sh: 21/21 checks against a real PostgreSQL 16.10:
    • empty-target restore
    • non-empty target refused and untouched
    • dry-run makes no changes
    • --force without a TTY and without --yes aborts
    • forced restore with a row-count mismatch rolls back and old data survives
    • forced restore succeeds
    • the snapshot restores back
    • a mid-dump SQL error leaves no partial tables
    • a wrong key is rejected

Closes #1264
Closes #1909
Closes #1911
Closes #1912

🤖 Generated with Claude Code

pheelztech and others added 5 commits November 20, 2026 16:11
Extract resolveTokenSymbol/resolveTokenLabel into lib/tokens.ts, derived
from TOKEN_ADDRESSES, and use it in dashboard.ts, api/streams.ts and the
stream details page. The details page previously used a hardcoded map that
ignored NEXT_PUBLIC_*_ADDRESS overrides and new tokens.

Closes LabsCrypt#1264

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add .nvmrc (22) and engines.node ^22.22.1 to root, backend and frontend
- Enforce via engine-strict=true in .npmrc
- All workflows read node-version-file: .nvmrc (security.yml was 20.19.0,
  deploy-docs.yml was 20)
- Dockerfiles move from node:20-alpine to digest-pinned node:22-alpine
- DEVELOPMENT.md and CONTRIBUTING.md document the same version

Closes LabsCrypt#1911

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- env -> runtime, autoDeploy -> autoDeployTrigger: commit
- Remove the invalid entrypoint field
- Migrations run only in preDeployCommand; startCommand just starts
- STREAM_CONTRACT_ID / ADMIN_PUBLIC_KEY use sync: false and the deploy
  aborts if they are unset or empty
- NODE_VERSION 22 to match .nvmrc

Closes LabsCrypt#1909

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Refuse to restore into a non-empty database (exit 3) unless --force
- --dry-run validates the backup, inspects the target and prints the plan
  without making changes
- --force requires typed confirmation (or --yes), writes an encrypted
  pre-restore snapshot in the regular backup format, then replaces all
  user schemas
- Schema wipe, SQL restore and row-count verification run in a single
  transaction, so any failure rolls back and leaves the target unchanged
- Validate the manifest before interpolating it into SQL
- pg-service.mjs: stop quoting service-file values; libpq reads quotes
  literally (e.g. port "'5432'"), which broke every connection
- Document the behaviour and failure/recovery states in DISASTER_RECOVERY.md

Closes LabsCrypt#1912

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l build

../sdk/overview.md and ../development/testing.md do not exist, so
docusaurus build aborted (failing on main since at least 2026-10-18).
Point them at sdks/typescript.md and DEVELOPMENT.md#running-tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@K1NGD4VID
K1NGD4VID merged commit 71c242b into LabsCrypt:main Nov 20, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants