test: add deploy coverage test (orphan-read invariant)#12
Merged
Conversation
Cross-checks every key declared on the DashboardConfig interface in
src/lib/config.ts against the keys written by each 'Generate ... config'
step in .github/workflows/deploy.yml (testnet + mainnet sections). Fails
CI if any read has no matching write, unless the key is in the per-network
DEFAULT_OK allowlist for keys whose source-side default is intentionally
correct.
Mirrors the moonlight-pay test added in PR #27 to catch the same orphan-read
class of bug (e.g. moonlight-pay's adminWallets, which was read by isAdmin()
since the admin route shipped but never written by deploy.yml).
This repo's deploy uses 'deno eval' rather than a heredoc, but the same
'Generate {production,mainnet} config' / 'Build production bundle' markers
delimit the relevant block, and the line-level <word>: regex captures the
config keys identically.
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.
Why this PR exists
Mirrors the test landed in moonlight-pay PR #27 to catch the orphan-read class of bug across the other 3 Moonlight frontends:
The original moonlight-pay incident: `adminWallets` had been read by `isAdmin()` since the admin route shipped, but no part of deploy.yml wrote it. The `/#/admin` page was unreachable from day one.
This PR closes the gap on `network-dashboard`.
How it works
`src/lib/config_deploy_test.ts` is a pure static check (no build, no env vars, no runtime):
Two assertions: one for testnet (`Generate production config`), one for mainnet (`Generate mainnet config`).
Per-network audit
4 keys declared on `DashboardConfig` (`environment`, `stellarNetwork`, `rpcUrl`, `councilPlatformUrl`).
No hard orphans, no soft orphans.
Negative-test evidence
Before opening: removed `rpcUrl: Deno.env.get('RPC_URL'),` from the `Generate production config` step → `deno task test` reported failure with `rpcUrl` missing from testnet deploy. Restored the line → green.
```
deploy.yml writes every DashboardConfig key on testnet (or it's in DEFAULT_OK) ...
[Diff] Actual / Expected
FAILED | 1 passed | 1 failed
```
Test plan