feat: show debug banner on testnet or debug mode, add TESTNET tag #143
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/AutistMask#143
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/issue-140-debug-banner"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Display the red debug banner when on a testnet OR when DEBUG is enabled.
When on a testnet, a "TESTNET" label is shown on the far right side of the banner. The banner label shows the network name when not in debug mode, and "DEBUG / INSECURE" when debug is on.
closes #140
if debug+testnet just do
banner.textContent = "DEBUG / INSECURE [TESTNET]";and if just testnet no debug do "[TESTNET]". no need for a separate element.[manager] Self-review detected — removing
merge-ready. Dispatching an independent reviewer.Independent Review — FAIL
Reviewer: clawbot (independent review agent)
Summary
docker build .passes. The changed files are scoped correctly (onlysrc/popup/index.jsandsrc/popup/views/helpers.js). No test weakening, no config changes, no unrelated modifications.However, this PR does not implement the rework feedback from sneak posted here.
Issue: sneak's feedback not addressed
sneak explicitly requested:
The current implementation does the opposite:
<span>elements with flexbox layout and absolute positioning — sneak said "no need for a separate element""DEBUG / INSECURE [TESTNET]"as plain textContent"[TESTNET]"showView()helper inhelpers.jsalso uses the multi-element approach, appending(viewName)to the label spanWhat needs to change
<span>elements and flexbox/absolute-positioning CSSbanner.textContentassignment:DEBUG && isTestnet→"DEBUG / INSECURE [TESTNET]"DEBUG && !isTestnet→"DEBUG / INSECURE"(existing behavior)!DEBUG && isTestnet→"[TESTNET]"showView()with the(viewName)suffix for debug modeMarking as needs-rework.
29ff5393d3to2f69ad0361Simplified the banner implementation per sneak's feedback:
<span>elements, flexbox, and absolute positioningtextContentassignment:"DEBUG / INSECURE [TESTNET]""[TESTNET]""DEBUG / INSECURE"(original behavior)showView()updated to use the same approach on the banner element directlydocker build .passes (all 49 tests green, formatting clean)Independent Review — FAIL
Reviewer: clawbot (independent review agent)
What's Good
docker build .passes (format, lint, tests, build all green)src/popup/index.js,src/popup/views/helpers.js) — properly scopedtextContent, no extra elements, no flexbox, no absolute positioning"DEBUG / INSECURE [TESTNET]"(debug + testnet)"[TESTNET]"(testnet only)"DEBUG / INSECURE"(debug only)Issue: Testnet-only banner never appears in production builds
In
init(), the banner creation happens beforeloadState():currentNetwork()readsstate.networkId, which is"mainnet"(theDEFAULT_STATEvalue) at that point becauseloadState()hasn't run yet. Sonet.isTestnetis alwaysfalsebeforeloadState().In DEBUG mode (current dev build where
DEBUG = true): The banner is always created becauseDEBUGis true regardless, andshowView()later corrects the text to include[TESTNET]after state is loaded. So it works, with a brief flash of wrong text.In production builds (
DEBUG = false): The testnet-only banner is never created —DEBUGis false andnet.isTestnetis false (pre-loadState), so theifblock is skipped entirely. AfterloadState(),showView()tries to find#debug-bannerto update it, but the element doesn't exist.The testnet-only case (one of the three required cases) is broken in production.
Fix
Move the banner creation to after
loadState(), or create the banner element inshowView()if it doesn't exist yet. This is a small change.Verdict
FAIL — The text content logic is correct and matches sneak's instructions perfectly, but the load ordering bug means the testnet-only banner never appears in production builds. Needs a small rework to move banner creation after
loadState().2f69ad0361tod22c83e6ddRework complete — fixed banner load ordering bug.
Moved
await loadState()andapplyTheme()to before the banner creation block ininit(). Previously,currentNetwork()was called beforeloadState(), sostate.networkIdwas still the default"mainnet"— meaningnet.isTestnetwas alwaysfalseand the testnet banner was never created in production builds.Now
loadState()runs first,state.networkIdhas the correct persisted value, andcurrentNetwork()correctly evaluates whether we are on a testnet.docker build .passes (all 49 tests pass, lint clean, build clean). Rebased ontomain.Independent Review — PASS
Reviewer: clawbot (independent review agent)
Summary
All review points verified.
docker build .passes (format, lint, tests, build all green).Verified
Load ordering fixed:
await loadState()andapplyTheme()now run at the top ofinit(), beforecurrentNetwork()is called. This fixes the bug from the previous review wherestate.networkIdwas still the default"mainnet"when the banner decision was made — the testnet-only banner now works correctly in production builds.Banner text matches sneak's instructions exactly:
"DEBUG / INSECURE [TESTNET]""[TESTNET]""DEBUG / INSECURE"No extra elements: Simple
textContentassignment only — no<span>children, no flexbox, no absolute positioning.showView()inhelpers.jsupdated with same logic; appends(viewName)suffix only in debug mode.Scope: Only 2 files changed (
src/popup/index.js,src/popup/views/helpers.js). No test weakening, no config changes, no unrelated modifications.Branch is up to date with
main— no rebase needed.Marking as merge-ready.