feat: add deploy pipeline, container limits, keypair cache and type g… - #323
Merged
abayomicornelius merged 1 commit intoJul 29, 2026
Merged
Conversation
…uards Closes Heliobond#225, Heliobond#226, Heliobond#227, Heliobond#228. - Heliobond#228: replace unsafe casts and non-null assertions with runtime guards in config.ts, registry.ts, stellar.ts and admin.ts - Heliobond#227: derive the admin keypair once and cache it, keeping the missing-secret error - Heliobond#225: set 512MB/0.5 CPU limits and a 384MB V8 heap ceiling for the container - Heliobond#226: add deploy.yml building to GHCR, staging on merge, production on release
|
@Omoboi-dev 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
Closes #225
closes #226
closes #227
closes #228
Four backend hardening issues in one branch — they touch overlapping files
(
stellar.ts,Dockerfile,docker-compose.yml).#228 — Strict mode: replace assertions with runtime validation
The three sites named in the issue:
config.ts—as "testnet" | "mainnet"→ exportedStellarNetworktypeand an
isStellarNetworkguard.validateRequiredEnv()now readsprocess.envdirectly, since the config object is built at import time andcould never see a bad value. This fixes a
config.test.tscase failing onmain.lib/registry.ts—sim.result!→ localisSimulationErrorguard plus anexplicit
retval === undefinedcheck.routes/admin.ts—raw as number[]→ entries validated individually andcopied into a
number[], so the type comes from construction.Also removed while in those files:
reason!,result as {...}(now aProjectUpdateOutcomediscriminated union),(err as Error), thereq.query.x as stringcasts, andgetResult!instellar.ts. Response bodyshapes are unchanged.
Left alone: the
as anyatstellar.ts:152— narrowing it requiresrestructuring transaction handling, not a type fix. Pre-existing warning, not new.
#227 — Cache the admin keypair
Derived once into a module-level variable instead of per call (previously once
per project per cron cycle). The secret is cached alongside it so a changed
secret rebuilds. Error behaviour unchanged;
resetAdminKeypairCache()exportedfor tests.
#225 — Container resource limits
512 MB / 0.5 CPU on the backend, 256 MB / 0.25 CPU on Redis, and
NODE_OPTIONS=--max-old-space-size=384in the production stage only.The 128 MB gap is deliberate: V8 old space excludes the Node binary and native
buffers, so a ceiling below the limit gives
JavaScript heap out of memorywitha stack trace instead of a silent SIGKILL. Redis caps itself at
192mbwithallkeys-lruso it evicts rather than growing into its limit.#226 — Deployment workflow
New
.github/workflows/deploy.yml: push tomain→ staging, release orv*tag → production, plus manual dispatch.
GITHUB_TOKEN— no extra secretin_progress→success/failureunder
if: always()), attached to the merge commit so it shows on the PRevent_type=deploydispatchrelease.ymlalready firesDEPLOY_HOOK_URL, set per environmentNew
docs/DEPLOYMENT.mdcovers limits, tuning, pipeline, registry and rollback.Tests
Four new suites, 54 tests, all passing: keypair cache behaviour, the type guards,
and parsers asserting the compose/Dockerfile limits and the workflow's triggers,
digest pinning and status reporting.
tsc --noEmitandeslintclean on changed files. Suite totalsmain→ branch:26 → 23 failures (3 fixed, 0 new), 645 → 701 passing, same 11 failing suites.