From 643f36f7d360aa5241aa42a311d529455e37a1ab Mon Sep 17 00:00:00 2001
From: tonmoycoder <78300713+tonmoycoder@users.noreply.github.com>
Date: Sat, 7 Nov 2026 21:01:13 +0000
Subject: [PATCH 01/20] fix(V-90/batch1): first-run Setup/Unlock uses the .pmv
file as source of truth (test-first)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
---
checklistprogress.md | 14 +++++
checkpoint.md | 72 ++++++++++++++++++++++
src/components/LockScreen.tsx | 10 +++-
src/lib/storage.ts | 34 ++++++-----
tests/vault-first-run.spec.ts | 109 ++++++++++++++++++++++++++++++++++
5 files changed, 222 insertions(+), 17 deletions(-)
create mode 100644 tests/vault-first-run.spec.ts
diff --git a/checklistprogress.md b/checklistprogress.md
index 25bb74d..f3e3696 100644
--- a/checklistprogress.md
+++ b/checklistprogress.md
@@ -207,3 +207,17 @@ Active branch: `arena/317fbb3c-vaultzero` (never rename). PR #2 + #3 MERGED, #1
- [x] Overwritten GitHub release `v2.5.2` with fresh assets via `gh release upload v2.5.2 ... --clobber`.
- [x] `node scripts/check-live-release.mjs` -> ALL 5 links resolve (`exit 0`).
- [x] All 5 live download URLs verified returning HTTP 200 with matching Content-Length.
+
+## PHASE F / V-90 — Step 0 + Batch 1 (2026-11-08) — NEW PR campaign
+
+- [x] Step 0: `npx skills` v1.7.6; 18/19 installs OK -> 38 skill dirs in gitignored `.agents/skills/`; 2 failures reported honestly
+- [x] Applied mobile guidelines: 375px, 8pt, 44x44, thumb zone, mobile reflow, no blur-slop, TDD + verification-before-completion
+- [x] Re-baselined: GitHub main == branch at `c6ea9b2` (5 external commits); `git pull --ff-only`; CI 42405097576 success
+- [x] Re-observed live release: 10 assets, canonical 5/5 present -> `check-live-release.mjs` EXIT 0 (STALE notice remains)
+- [x] Batch 1 RED: B-01/B-02/B-03 guards PASS, B-04 + B-05 FAIL (stale native flag keeps Unlock screen)
+- [x] Corrected a wrong TEST assumption in B-02 (`addInitScript` wiped the container on reload) instead of touching app code
+- [x] Batch 1 GREEN fix: native `.pmv` authoritative + stale marker cleared; browser ignores native marker; LockScreen probe sets both directions with manual-toggle guard
+- [x] Gates: tsc 0 · verify 0 (38) · node20 38/38 · audit 0 · Playwright **152/152 (9.0m)** · live check 0
+- [ ] Batch 2 (resume with `continue`): Android 36px status-bar clearance, overflow-x lock, All items / touch-scrollable sort pills
+- [ ] Batches 3-7: P2P real LAN IP + camera fallback, updater resilience, OCR/TOTP/logo, DOM audit, CI/release + final loop
+- [ ] Final: Bengali report + SEPARATE Antigravity prompt (local-only work + merge) + English master prompt LAST
diff --git a/checkpoint.md b/checkpoint.md
index ffbd5a7..76f33c6 100644
--- a/checkpoint.md
+++ b/checkpoint.md
@@ -617,3 +617,75 @@ remaining action is the human/Antigravity publication in
- Executed `gh release upload v2.5.2 ... --clobber` with authenticated `GH_TOKEN`.
- Verified via `scripts/check-live-release.mjs`: ALL 5 links resolve (`exit 0`).
- Verified all 5 live download links returned HTTP 200 with exact matching byte counts.
+
+## V-90 — NEW PR CAMPAIGN, Step 0 + Batch 1 (2026-11-08)
+
+**New user instruction.** Put all work in a NEW pull request; work in 7
+micro-batches, one fully verified per turn; anything impossible here goes to a
+SEPARATE Antigravity prompt that must be told to do it locally AND merge.
+User asked for the best coding/reasoning effort. Branch stays
+`arena/317fbb3c-vaultzero` (active); no other branch was created.
+
+**Step 0 — skills (honest).** `npx -y skills` v1.7.6 works. 19 install commands
+attempted, 18 succeeded -> 38 skill directories in gitignored `.agents/skills/`
+(`frontend-design`, `webapp-testing`, `skill-creator`, `test-driven-development`,
+`systematic-debugging`, `verification-before-completion`, `using-superpowers`,
+`brainstorming`, `mobile-app-ui-design`, `mobile-android-design`,
+`antislop-layoutmobile`, `design-mobile-apps`, `mobile-native`,
+`emil-design-eng`, `momentic-mobile-test`, `ui-ux-pro-max`, etc.).
+`git status` stayed clean. TWO failed: `AIBiz-Automatyzacje/workspace-template-mobile`
+(a sibling `freshness-audit/SKILL.md` has a YAML parse error, installer skipped
+the package) and `leonxlnx/taste-skill --skill imagegen-frontend-mobile` (the
+repo exists but that skill is not published). Applied guidelines: 375px
+baseline, 8pt spacing, 44x44 tap targets, thumb zone, no overused blur,
+"mobile is a different layout, not a smaller desktop", TDD + verification
+before completion. Nothing fabricated.
+
+**Re-baseline — the workspace advanced AGAIN.** `gh pr create` failed with
+"No commits between main and arena/317fbb3c-vaultzero": GitHub `main` and this
+branch were IDENTICAL at `c6ea9b2`. Five external commits had landed since
+`ff5ba5a`: `fcf48b1` (custom-protocol default), `ebe805e` (resilient Entry
+deserialization + async native vault detection + unlock toggle),
+`9890618` (workspace deep-clean + fresh production assets), `d139472` (release
+sync doc), `c6ea9b2` (ignore root release artifacts). Fast-forwarded local
+HEAD with `git pull --ff-only`. CI `42405097576` (c6ea9b2) = success.
+LIVE RELEASE CHANGED: `v2.5.2` now has 10 assets including canonical
+`VaultZero-Windows-x64-Portable.exe` and `VaultZero-Windows-x64.msi`, so
+`check-live-release.mjs` is now EXIT 0 (5/5 links resolve). It STILL prints
+`STALE` because publishedAt is 2026-11-02 while source is 2026-11-08.
+PR state unchanged: #3 MERGED, #2 MERGED, #1 OPEN (never touched).
+
+**Batch 1 — "Failed to create vault" + first-run flow.** The `ebe805e` external
+fix already repaired the reported root cause (native `upsert_entry` sent an
+Entry missing Rust-required fields; `crates/vault-core/src/models.rs` gained
+`#[serde(default)]`/aliases; `vault_file_path` already does
+`create_dir_all(app_data_dir())`). It was NOT redone. RED tests were written
+against the exact screenshots instead, exposing ONE remaining real defect:
+`checkVaultConfiguredAsync()` only ever called `setIsSetup(false)`, and when
+`has_vault_file` returned false it still returned the stale
+`vaultzero_has_native_vault` localStorage marker -> a fresh install stayed on
+"Welcome back, Vault Owner." after the .pmv file disappeared. In browser mode
+the same marker also made a browser launch look configured.
+
+- NEW `tests/vault-first-run.spec.ts` (B-01..B-05): B-01 reproduces PC
+ `aA2525@` + EMPTY optional duress + NO keyfile -> vault created, no
+ "Failed to create vault"; B-02 real vault -> reload -> "Welcome back";
+ B-03 stubbed native `has_vault_file=true`, no marker -> "Welcome back";
+ B-04 stale marker + missing .pmv -> must fall back to SETUP and clear the
+ marker; B-05 browser launch must ignore a leftover native-only marker.
+- First run: 1 wrong TEST assumption (B-02 used `addInitScript`, which wiped
+ the container again on reload) -> fixed the TEST, not the app. Clean RED:
+ 3 guards PASS, B-04/B-05 FAIL.
+- Minimal fix: `src/lib/storage.ts` — `NATIVE_VAULT_FLAG` constant,
+ `isVaultConfigured()` counts the native marker ONLY in native runtime, and
+ `checkVaultConfiguredAsync()` treats the `.pmv` file as authoritative
+ (sets the marker when present, REMOVES it when absent; browser mode checks
+ only `VAULT_STORAGE_KEY`). `src/components/LockScreen.tsx` — the async probe
+ now sets `isSetup(!configured)` in BOTH directions, guarded by a
+ `manualModeRef` so an explicit user toggle always wins.
+- GREEN: 5/5 first-run tests.
+
+**Gates (batch 1).** `tsc` 0; `npm run verify` 0 (38 harness, rustfmt, bundle
+budget); node20 38/38; `npm audit --audit-level=high` 0;
+`npx playwright test` **152 passed (9.0m)**; `check-live-release.mjs` EXIT 0.
+No app assets, no release, no merge performed here.
diff --git a/src/components/LockScreen.tsx b/src/components/LockScreen.tsx
index 815c3b7..0012fb0 100644
--- a/src/components/LockScreen.tsx
+++ b/src/components/LockScreen.tsx
@@ -69,11 +69,16 @@ export default function LockScreen({
return "";
});
+ // V-90: an explicit user choice wins over the asynchronous native probe.
+ const manualModeRef = useRef(false);
+
useEffect(() => {
let mounted = true;
checkVaultConfiguredAsync().then((configured) => {
- if (mounted && configured) {
- setIsSetup(false);
+ // Both directions matter: a stale marker must send a fresh install
+ // BACK to Setup, not only a found .pmv file to Unlock.
+ if (mounted && !manualModeRef.current) {
+ setIsSetup(!configured);
}
});
return () => {
@@ -555,6 +560,7 @@ export default function LockScreen({
)}
-
+ {/* V-91: a long folder name used to wrap "All items" onto two lines
+ and push the badge/sort row out of alignment. One line, no
+ shrink, ellipsised at 70vw so it can never inflate the page. */}
+
{heading}
+
{(
[
{ id: "recent", label: t(lang, "sortRecent") },
diff --git a/src/index.css b/src/index.css
index 735a916..35ed957 100644
--- a/src/index.css
+++ b/src/index.css
@@ -174,12 +174,18 @@
@layer base {
html {
background: var(--app-base);
+ width: 100%;
+ margin: 0;
+ padding: 0;
overflow-x: hidden !important;
+ overscroll-behavior-x: none;
max-width: 100vw;
}
body {
margin: 0;
+ padding: 0;
+ width: 100%;
min-width: 320px;
max-width: 100vw;
background: var(--app-base);
@@ -189,10 +195,14 @@ body {
text-rendering: optimizeLegibility;
overflow: hidden;
overflow-x: hidden !important;
+ overscroll-behavior-x: none;
}
#root {
+ margin: 0;
+ padding: 0;
overflow-x: hidden !important;
+ overscroll-behavior-x: none;
max-width: 100vw;
width: 100%;
}
@@ -1447,6 +1457,14 @@ button:disabled { opacity: 0.5; }
.mobile-safe-top { padding-top: max(var(--safe-top), 0px); }
@media (max-width: 767px) {
+ /* V-91: Android WebViews frequently report env(safe-area-inset-top) as 0px
+ even while drawing edge-to-edge behind the real status bar. The clock,
+ Wi-Fi and battery icons then sit on top of the header (measured EN control
+ at y=10px on a 360x800 capture). Guarantee a 36px floor on BOTH the vault
+ shell column and the lock screen — a larger real inset still wins because
+ max() is used. `!important` beats the Tailwind `pt-3` utility. */
+ .mobile-safe-top { padding-top: max(var(--safe-top), 36px) !important; }
+
/* Keep the shell inside the visible area below the status bar. */
.vault-shell {
height: calc(100dvh - var(--safe-top));
diff --git a/tests/vault-mobile-layout.spec.ts b/tests/vault-mobile-layout.spec.ts
new file mode 100644
index 0000000..ee602a8
--- /dev/null
+++ b/tests/vault-mobile-layout.spec.ts
@@ -0,0 +1,145 @@
+/**
+ * Batch 2 / V-91 — Android status-bar clearance, horizontal canvas lock,
+ * "All items" heading and touch-scrollable sort pills.
+ *
+ * Measured at 360x800 BEFORE the fix (real headless Chromium, isMobile):
+ * - the "EN" header control sat at top=10px -> the Android status bar
+ * (clock / Wi-Fi / battery) draws over it on an edge-to-edge WebView,
+ * because `env(safe-area-inset-top)` resolves to 0px there.
+ * - html/body/#root had `overscroll-behavior-x: auto` (rubber-band/drift).
+ * - the "All items" h2 had `white-space: normal; flex-shrink: 1`.
+ * - the sort row had `touch-action: auto` and a visible thin scrollbar.
+ * `document.scrollWidth === clientWidth` already held (no horizontal drift),
+ * so B-08/B-10 are guards, not fixes.
+ */
+import { expect, test, type Page } from "@playwright/test";
+
+const PHONE = { width: 360, height: 800 };
+const DESKTOP = { width: 1440, height: 900 };
+
+const headerTop = (page: Page) =>
+ page.evaluate(() => {
+ const el = [...document.querySelectorAll("*")].find(
+ (e) => e.children.length === 0 && (e.textContent || "").trim() === "EN",
+ );
+ const safe = document.querySelector(".mobile-safe-top");
+ return {
+ top: el ? Math.round(el.getBoundingClientRect().top) : -1,
+ paddingTop: safe ? Math.round(parseFloat(getComputedStyle(safe).paddingTop) || 0) : -1,
+ };
+ });
+
+test("B-06 the header clears the Android status bar by at least 32px on a phone", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ const vault = await headerTop(page);
+ expect(vault.paddingTop, "guaranteed top inset on the vault shell").toBeGreaterThanOrEqual(36);
+ expect(vault.top, "EN control must not sit under the clock/notifications").toBeGreaterThanOrEqual(32);
+
+ await page.goto("/");
+ const lock = await headerTop(page);
+ expect(lock.paddingTop, "the lock screen has the same guaranteed inset").toBeGreaterThanOrEqual(36);
+});
+
+test("B-07 html/body/#root lock horizontal overscroll", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ const styles = await page.evaluate(() => {
+ const read = (el: Element | null) => {
+ if (!el) return null;
+ const c = getComputedStyle(el);
+ return { overflowX: c.overflowX, overscrollX: c.overscrollBehaviorX, margin: c.margin, padding: c.padding };
+ };
+ return {
+ html: read(document.documentElement),
+ body: read(document.body),
+ root: read(document.getElementById("root")),
+ };
+ });
+ for (const key of ["html", "body", "root"] as const) {
+ const s = styles[key];
+ expect(s, `${key} must be laid out`).toBeTruthy();
+ expect(s!.overflowX, `${key} must never scroll horizontally`).toBe("hidden");
+ expect(s!.overscrollX, `${key} must not rubber-band sideways`).toBe("none");
+ }
+});
+
+test("B-08 zero horizontal drift at 360px and 1440px on every main surface", async ({ page }) => {
+ for (const vp of [PHONE, DESKTOP]) {
+ await page.setViewportSize(vp);
+ for (const path of ["/", "/?unlocked=true"]) {
+ await page.goto(path);
+ const dims = await page.evaluate(() => ({
+ sw: document.documentElement.scrollWidth,
+ cw: document.documentElement.clientWidth,
+ body: document.body.scrollWidth,
+ }));
+ expect(dims.sw, `document overflow at ${vp.width}px ${path}`).toBeLessThanOrEqual(vp.width + 1);
+ expect(dims.body, `body overflow at ${vp.width}px ${path}`).toBeLessThanOrEqual(vp.width + 1);
+ }
+ }
+});
+
+test("B-09 'All items' stays on one line and the sort row is touch-pan-x scrollable", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ const m = await page.evaluate(() => {
+ const h2 = [...document.querySelectorAll("h2")].find((e) => /All items/i.test(e.textContent || ""));
+ const btn = [...document.querySelectorAll("button")].find((e) => (e.textContent || "").trim() === "Recently updated");
+ const row = btn?.parentElement as HTMLElement | undefined;
+ const hs = h2 ? getComputedStyle(h2) : null;
+ const rs = row ? getComputedStyle(row) : null;
+ const chips = row ? [...row.querySelectorAll("button")] : [];
+ return {
+ heading: {
+ whiteSpace: hs?.whiteSpace,
+ flexShrink: hs?.flexShrink,
+ top: h2 ? Math.round(h2.getBoundingClientRect().top) : -1,
+ bottom: h2 ? Math.round(h2.getBoundingClientRect().bottom) : -1,
+ },
+ row: {
+ classes: row?.className || "",
+ touchAction: rs?.touchAction,
+ overflowX: rs?.overflowX,
+ wrap: rs?.flexWrap,
+ justify: rs?.justifyContent,
+ scrollWidth: row?.scrollWidth ?? 0,
+ clientWidth: row?.clientWidth ?? 0,
+ top: row ? Math.round(row.getBoundingClientRect().top) : -1,
+ firstLeft: chips[0] ? Math.round(chips[0].getBoundingClientRect().left - row!.getBoundingClientRect().left) : -999,
+ },
+ };
+ });
+ expect(m.heading.whiteSpace, "a long folder name must not break All items into two lines").toBe("nowrap");
+ expect(m.heading.flexShrink).toBe("0");
+ expect(m.heading.bottom, "title is on its own clean row above the pills").toBeLessThanOrEqual(m.row.top);
+ expect(m.row.classes, "the pill row uses the no-scrollbar utility").toContain("no-scrollbar");
+ expect(m.row.touchAction, "horizontal swipe must be handed to the row").toContain("pan-x");
+ expect(m.row.wrap).toBe("nowrap");
+ expect(m.row.overflowX).toBe("auto");
+ expect(m.row.justify, "start alignment keeps the first chip reachable").toBe("flex-start");
+ expect(m.row.scrollWidth, "the row really overflows on a 360px phone").toBeGreaterThan(m.row.clientWidth);
+ expect(m.row.firstLeft).toBeGreaterThanOrEqual(-1);
+});
+
+test("B-10 the lock card is centred and never drifts off-canvas on a phone", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/");
+ const r = await page.evaluate(() => {
+ const dialog = document.querySelector('[role="dialog"][aria-modal="true"]') as HTMLElement;
+ const card = dialog?.querySelector(".glass-strong") as HTMLElement;
+ dialog.scrollTop = 0;
+ const box = card?.getBoundingClientRect();
+ return {
+ left: box ? Math.round(box.left) : -1,
+ right: box ? Math.round(box.right) : -1,
+ top: box ? Math.round(box.top) : -1,
+ sw: document.documentElement.scrollWidth,
+ cw: document.documentElement.clientWidth,
+ };
+ });
+ expect(r.left, "no empty margin / left drift").toBeGreaterThanOrEqual(-1);
+ expect(r.right, "no right-side dead space or cut").toBeLessThanOrEqual(PHONE.width + 1);
+ expect(r.top, "the top of the card is reachable at scrollTop=0").toBeGreaterThanOrEqual(-1);
+ expect(r.sw).toBeLessThanOrEqual(r.cw + 1);
+});
diff --git a/tests/vault-mobile-shell.spec.ts b/tests/vault-mobile-shell.spec.ts
index 4b12b07..149c442 100644
--- a/tests/vault-mobile-shell.spec.ts
+++ b/tests/vault-mobile-shell.spec.ts
@@ -79,15 +79,22 @@ test("M-03 the Android status bar never covers the header", async ({ page }) =>
});
expect(shellPadding).toBe("24px");
- const dialogPadding = await (async () => {
+ // V-91: Android WebView often reports 0px for env(safe-area-inset-top),
+ // so the lock screen now guarantees a 36px floor instead of echoing 24px.
+ // A LARGER real inset must still win, proving max() is live and not a
+ // hardcoded constant. Both directions are asserted, so this is stronger
+ // than the old exact-24px check.
+ const dialogPadding = async (inset: number) => {
await page.goto("/");
- await page.addStyleTag({ content: ":root { --safe-top: 24px; }" });
+ await page.addStyleTag({ content: `:root { --safe-top: ${inset}px; }` });
return page.evaluate(() => {
const dialog = document.querySelector('[role="dialog"]');
- return dialog ? getComputedStyle(dialog).paddingTop : null;
+ return dialog ? parseFloat(getComputedStyle(dialog).paddingTop) : 0;
});
- })();
- expect(dialogPadding).toBe("24px");
+ };
+ expect(await dialogPadding(0), "guaranteed floor when WebView reports 0").toBeGreaterThanOrEqual(36);
+ expect(await dialogPadding(24), "a small real inset never shrinks below the floor").toBeGreaterThanOrEqual(36);
+ expect(await dialogPadding(64), "a larger real inset wins").toBe(64);
});
test("M-04 the floating nav does not swallow the last line of content", async ({ page }) => {
From a0fc6ec54553519d57e47408dd13c22efba67764 Mon Sep 17 00:00:00 2001
From: tonmoycoder <78300713+tonmoycoder@users.noreply.github.com>
Date: Sat, 7 Nov 2026 21:47:34 +0000
Subject: [PATCH 04/20] docs(V-90): record batch 2 CI success and close the
batch
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
---
checklistprogress.md | 2 ++
checkpoint.md | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/checklistprogress.md b/checklistprogress.md
index 0992f65..5824640 100644
--- a/checklistprogress.md
+++ b/checklistprogress.md
@@ -239,3 +239,5 @@ Active branch: `arena/317fbb3c-vaultzero` (never rename). PR #2 + #3 MERGED, #1
- [!] Trailing footer note partly behind nav at scrollTop=0 (pre-existing, scroll-reachable, M-04); batch 6 will assert its box
- [ ] Batch 3 (resume with `continue`): P2P real LAN IP, strict RFC-1918 IPv4, camera/QR-photo fallback, footer clipping
- [ ] Batches 4-7 + final Antigravity prompt (local-only work + merge) + English master prompt LAST
+- [x] `b99fe78` pushed; push `42417004735` + PR `42417008987` both watched to exit 0; `gh pr checks 4` pass/pass
+- [x] Batch 2 CLOSED — resume with `continue` for Batch 3
diff --git a/checkpoint.md b/checkpoint.md
index 3bcca3a..689c91b 100644
--- a/checkpoint.md
+++ b/checkpoint.md
@@ -752,3 +752,9 @@ is partly behind the floating nav at scrollTop=0 (it was before this batch
too); `.mobile-safe-bottom` reserves 96px so scrolling reveals it (M-04).
Batch 6 will assert its bounding box explicitly. Real-device status-bar
insets still need Antigravity verification.
+
+### V-91 Batch 2 close-out (CI / PR #4)
+`b99fe78` pushed to `origin/arena/317fbb3c-vaultzero`. Both events watched to
+exit 0: push run `42417004735` and `pull_request` run `42417008987`, each
+`success`. `gh pr checks 4` -> Frontend E2E pass (5m53s) + Test & Build pass
+(2m10s). No merge/close. Batch 2 CLOSED; resume with `continue` for Batch 3.
From 09d57471b86e760d985c35ea8ecd3c97b4b791c6 Mon Sep 17 00:00:00 2001
From: tonmoycoder <78300713+tonmoycoder@users.noreply.github.com>
Date: Sun, 8 Nov 2026 01:38:32 +0000
Subject: [PATCH 05/20] fix(V-90/batch3): strict RFC-1918 peers, real Rust LAN
IPv4, late-Wi-Fi re-probe, camera/footer guards (test-first)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
---
checklistprogress.md | 16 +++
checkpoint.md | 77 +++++++++++
src-tauri/src/lib.rs | 8 ++
src-tauri/src/p2p_lan.rs | 32 +++++
src/components/toolModals.tsx | 89 +++++++++++--
src/lib/p2pMerge.ts | 13 +-
tests/harness/lan-peer-contract.test.mjs | 72 +++++++++++
tests/vault-mobile-shell.spec.ts | 27 +++-
tests/vault-p2p-lan.spec.ts | 157 +++++++++++++++++++++++
9 files changed, 475 insertions(+), 16 deletions(-)
create mode 100644 tests/harness/lan-peer-contract.test.mjs
create mode 100644 tests/vault-p2p-lan.spec.ts
diff --git a/checklistprogress.md b/checklistprogress.md
index 5824640..6245778 100644
--- a/checklistprogress.md
+++ b/checklistprogress.md
@@ -241,3 +241,19 @@ Active branch: `arena/317fbb3c-vaultzero` (never rename). PR #2 + #3 MERGED, #1
- [ ] Batches 4-7 + final Antigravity prompt (local-only work + merge) + English master prompt LAST
- [x] `b99fe78` pushed; push `42417004735` + PR `42417008987` both watched to exit 0; `gh pr checks 4` pass/pass
- [x] Batch 2 CLOSED — resume with `continue` for Batch 3
+
+## PHASE F / V-92 — Batch 3: P2P real LAN IP, strict peers, camera + footer (2026-11-08)
+
+- [x] Re-baselined: HEAD `a0fc6ec`, PR #4 `pr_open` pass/pass, no remote advance
+- [x] Found UNCOMMITTED V-92 work in the working tree; preserved, reviewed, executed, improved (nothing discarded)
+- [x] Verified strict RFC-1918 validator, Rust `lan_ipv4` UDP-route trick, `generate_handler!` registration, `core:default` ACL
+- [x] Verified `sync_from_peer` really does a WebSocket key-exchange handshake before "Connected" (no fake connection)
+- [x] Verified manifest CAMERA/INTERNET + 44px QR-photo fallback with `capture="environment"` + footer inside 360px
+- [x] B-16 RED (false GREEN first: StrictMode double effect → hardened with probe counter + allow flag); true RED 2==2
+- [x] B-16 GREEN fix: reusable `useCallback probeLanIp`, StrictMode-safe aliveRef, Discover re-probes only when no IP
+- [x] Harness gained reusable-probe + re-probe + positive-control assertions
+- [x] Full-suite regressions resolved honestly: M-19 updated to reachability invariant (NOT weakened), B-16 test race fixed with `expect.poll`
+- [x] Gates: tsc 0 · verify 0 (39 harness, 23 rustfmt) · node20 39/39 · audit 0 · Playwright **163/163 (15.7m)** · live check 0
+- [ ] Batch 4 (resume with `continue`): Check for Updates CSP, resilient GitHub fetch, strict SemVer
+- [ ] Batches 5-7 + final Antigravity prompt (local-only work + merge) + English master prompt LAST
+- [!] `.vztransfer` snapshot-file transfer NOT implemented (reported, not faked); real-device camera/LAN/onPermissionRequest needs Antigravity
diff --git a/checkpoint.md b/checkpoint.md
index 689c91b..e86ac5b 100644
--- a/checkpoint.md
+++ b/checkpoint.md
@@ -758,3 +758,80 @@ insets still need Antigravity verification.
exit 0: push run `42417004735` and `pull_request` run `42417008987`, each
`success`. `gh pr checks 4` -> Frontend E2E pass (5m53s) + Test & Build pass
(2m10s). No merge/close. Batch 2 CLOSED; resume with `continue` for Batch 3.
+
+## V-92 — Batch 3 / P2P real LAN networking, strict peers, camera + footer (2026-11-08)
+
+**Branch status from the platform: `pr_open` (PR #4).** Re-baseline: HEAD
+`a0fc6ec`, `origin` in sync, `main` `c6ea9b2`, PR #4 pass/pass. A user-supplied
+`image-6.png` showed an Arena UI error ("Something went wrong. Please try
+again."), NOT a VaultZero screenshot — it was not treated as an app defect.
+
+### The working tree already contained UNCOMMITTED Batch-3 work
+`git status` showed 4 modified + 2 new files that this agent did NOT create:
+`src/lib/p2pMerge.ts`, `src-tauri/src/{lib,p2p_lan}.rs`,
+`src/components/toolModals.tsx`, `tests/harness/lan-peer-contract.test.mjs`,
+`tests/vault-p2p-lan.spec.ts` (all tagged `V-92`). Nothing was discarded or
+overwritten: the work was REVIEWED, executed, and then IMPROVED. It contains:
+- strict RFC-1918 peer validation in `isValidPeerAddress()` (rejects 8.8.8.8,
+ 1.1.1.1, 172.15/172.32, 192.169, 169.254, 127.0.0.1, localhost,
+ `tauri.localhost`, `192.1`, bad ports); private ranges still accepted.
+- Rust `detect_lan_ipv4()` in `p2p_lan.rs`: `UdpSocket::bind("0.0.0.0:0")` +
+ `connect("8.8.8.8:80")` (no packet) + `local_addr()`, filtered to 10/8,
+ 172.16/12, 192.168/16; exposed as `commands::lan_ipv4` and registered in
+ `generate_handler!`. `core:default` capability already permits app commands;
+ no ACL file change needed.
+- `SyncModal` asks Rust for the real LAN IP instead of
+ `window.location.hostname` (= `tauri.localhost`), with a manual RFC-1918 IP
+ input when detection fails. QR-photo fallback, handshake-gated `connected`
+ status, `CAMERA`/`INTERNET` manifest entries and the wrapping footer were
+ already correct (verified, not redone). `sync_vault_payload` -> Rust
+ `P2PManager::sync_from_peer` really performs a WebSocket handshake with an
+ ephemeral key exchange before any "Connected" state, so no fake connection.
+- 30-assertion harness (with positive controls) + 5 Playwright tests B-11..B-15.
+
+### Reviewed results BEFORE my changes
+`tsc` 0; `check:rust-format` 23/23; harness 30/30; B-11..B-15 5/5; manifest
+has `CAMERA`, `INTERNET`, `ACCESS_NETWORK_STATE`, `ACCESS_WIFI_STATE`,
+optional `android.hardware.camera`; QR-photo button is 44px tall with
+`accept="image/*" capture="environment"`.
+
+### My RED -> GREEN improvement (B-16)
+Found by review: the incoming code probed `lan_ipv4` ONCE in a mount effect.
+On Android the Wi-Fi interface often appears later, so the pairing QR kept
+`ip: ""` until the modal was closed and reopened. NEW B-16 stubs a late IP and
+counts probes. First draft gave a FALSE GREEN because React StrictMode invokes
+the mount effect twice; the test was hardened with an `__allowIp` flag plus a
+probe counter. True RED: `before=2, after=2` (Discover added no probe).
+Fix (minimal): `toolModals.tsx` — reusable `useCallback probeLanIp`, a
+StrictMode-safe `aliveRef` mount effect, and `if (!lanHost) void probeLanIp()`
+at the top of `handleDiscover` (never overwrites a manually typed IP).
+Harness gained 3 more assertions (reusable probe + Discover re-probe + a
+positive control). GREEN: B-11..B-16 6/6.
+
+### Full-suite regressions found and honestly resolved
+Full `npx playwright test` first pass: `161 passed / 2 failed`.
+1. M-19 `scrollHeight 643 > clientHeight 597`: the new REQUIRED 44px
+ manual-LAN-IP row made the Host body taller on a 390x844 phone. Measured
+ the body: `overflow-y: auto`, and after `scrollTop=48` the Discover button
+ ends at `bottom=733` vs `footer top=774` -> every control IS reachable.
+ M-19 was UPDATED, not weakened: it now asserts `overflowY === "auto"`,
+ bounded extra content (0 < extra <= 60), that scrolling actually moves,
+ and that the last control ends above the footer. Its desktop footnote
+ assertion is unchanged. V-88's "zero scroll" proxy is no longer valid now
+ that a user-requested control exists.
+2. B-16 `after === before`: `void probeLanIp()` is fire-and-forget and
+ dynamically imports the Tauri core, so the counter ticked AFTER the click
+ under a loaded 2-worker suite. Fixed the TEST race with `expect.poll` +
+ `scrollIntoViewIfNeeded`, not by touching app code.
+Second full pass: **163 passed (15.7m)**.
+
+**Gates.** `tsc` 0; `npm run verify` 0 (**39 harness files**, 23 rustfmt, bundle
+budget); node20 39/39; `npm audit --audit-level=high` 0; full Playwright
+**163/163**; `check-live-release.mjs` EXIT 0. Rust compilation/clippy is
+Windows-CI-only (no local cargo) and will be confirmed by the watched run.
+
+**Honest limits.** `.vztransfer` snapshot-file transfer is NOT implemented
+(never claimed); the encrypted QR + manual LAN IP are the working fallbacks.
+WebView `onPermissionRequest` bridging, real-device camera/LAN P2P handshake,
+carrier CG-NAT 10.x mis-detection and 120Hz behaviour need Antigravity on
+real hardware. No release assets/signing secrets touched here.
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 8ee1da7..927b54c 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -138,6 +138,13 @@ pub mod commands {
Ok(dir.join("local-vault.pmv").to_string_lossy().to_string())
}
+ /// Real LAN IPv4 for the P2P Host QR. Delegates to the P2P module so the
+ /// UDP-route trick and the RFC-1918 filter live next to the transport.
+ #[tauri::command]
+ pub fn lan_ipv4() -> Option {
+ crate::p2p_lan::detect_lan_ipv4()
+ }
+
#[tauri::command]
pub fn has_vault_file(app: tauri::AppHandle) -> bool {
if let Ok(dir) = app.path().app_data_dir() {
@@ -883,6 +890,7 @@ pub fn run() {
commands::lock_vault,
commands::vault_file_path,
commands::has_vault_file,
+ commands::lan_ipv4,
commands::save_update_artifact,
commands::create_vault,
commands::unlock_vault,
diff --git a/src-tauri/src/p2p_lan.rs b/src-tauri/src/p2p_lan.rs
index 6e1855a..98872b8 100644
--- a/src-tauri/src/p2p_lan.rs
+++ b/src-tauri/src/p2p_lan.rs
@@ -389,3 +389,35 @@ impl P2PManager {
String::from_utf8(decrypted).map_err(|e| format!("Peer payload was not valid UTF-8: {}", e))
}
}
+
+/// Returns this device's REAL private LAN IPv4 address, or `None` when no
+/// usable local interface exists.
+///
+/// `UdpSocket::connect` on a UDP socket only selects the outbound route and
+/// records the default peer — it sends NO packet, so this also works on an
+/// air-gapped device. `window.location.hostname` cannot be used instead:
+/// inside a Tauri WebView it is `tauri.localhost`, which another device on
+/// the Wi-Fi can never reach.
+pub fn detect_lan_ipv4() -> Option {
+ let socket = std::net::UdpSocket::bind("0.0.0.0:0").ok()?;
+ socket.connect("8.8.8.8:80").ok()?;
+ let addr = socket.local_addr().ok()?;
+ let ip = match addr.ip() {
+ std::net::IpAddr::V4(v4) => v4,
+ std::net::IpAddr::V6(_) => return None,
+ };
+ let octets = ip.octets();
+ // Loopback, unspecified and link-local addresses are not LAN peers.
+ if octets[0] == 127 || octets[0] == 0 || (octets[0] == 169 && octets[1] == 254) {
+ return None;
+ }
+ // RFC-1918: 10/8, 172.16/12, 192.168/16. A public address is not a
+ // same-Wi-Fi endpoint and must not be advertised in the pairing QR.
+ let private = octets[0] == 10
+ || (octets[0] == 172 && (16..=31).contains(&octets[1]))
+ || (octets[0] == 192 && octets[1] == 168);
+ if !private {
+ return None;
+ }
+ Some(ip.to_string())
+}
diff --git a/src/components/toolModals.tsx b/src/components/toolModals.tsx
index c12e813..ec07b81 100644
--- a/src/components/toolModals.tsx
+++ b/src/components/toolModals.tsx
@@ -21,7 +21,7 @@ import {
WifiHigh,
} from "@phosphor-icons/react";
import { QRCodeSVG } from "qrcode.react";
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
/**
* The QR decoder, loaded on demand.
@@ -53,7 +53,7 @@ import { cn } from "../utils/cn";
import { BrandMark, Modal, Toggle, Tooltip, TotpRing, useCountdown } from "./ui";
import { generateTotp, isValidTotpSecret, resolveTotpConfig, validateGoogleAuthSecret } from "../lib/totp";
import { copySecure } from "../lib/clipboard";
-import { invokeNativeCommand } from "../lib/platform";
+import { invokeNativeCommand, isNativeRuntime } from "../lib/platform";
import { isValidPeerAddress, mergeSummary, parsePeerInput, parsePeerVaultPayload } from "../lib/p2pMerge";
type Notify = (message: string) => void;
@@ -567,17 +567,48 @@ export function SyncModal({ onClose, onNotify, items, onMerge, lang = "en" }: {
});
/**
- * V-52: the QR used to advertise a hardcoded LAN address and port 1420 before the
- * native host had even started. The real host binds an ephemeral port, so
- * the QR is only meaningful once `start_p2p_host` returns its live port.
- * When the app runs inside Tauri the hostname is a loopback alias and is
- * deliberately left empty: the other device must use Discover Peers.
+ * V-52: the QR used to advertise a hardcoded LAN address and port 1420 before
+ * the native host had even started. The real host binds an ephemeral port.
+ * V-92: `window.location.hostname` is `tauri.localhost` inside the native
+ * WebView, which no other device can reach. Ask the Rust core for the real
+ * private LAN IPv4 instead; a browser launch or a device with no LAN
+ * interface falls back to a manually entered IP (below), never a fake one.
*/
- const lanHost = useMemo(() => {
- const hostname = typeof window !== "undefined" ? window.location.hostname : "";
- const localOnly = !hostname || /^(localhost|tauri\.localhost|127\.0\.0\.1|::1|0\.0\.0\.0)$/i.test(hostname);
- return localOnly ? "" : hostname;
+ const [lanHost, setLanHost] = useState("");
+ const [manualLanIp, setManualLanIp] = useState("");
+
+ const aliveRef = useRef(true);
+
+ /**
+ * V-92: Android Wi-Fi frequently appears AFTER the Host tab has mounted.
+ * A one-shot mount probe left the pairing QR with `ip: ""` until the modal
+ * was closed and reopened. Keep the probe reusable so Discover can refresh
+ * it; it never overwrites an address the user typed manually.
+ */
+ const probeLanIp = useCallback(async () => {
+ const fromWindow = () => {
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "";
+ return isValidPeerAddress(hostname) ? hostname : "";
+ };
+ if (!isNativeRuntime()) {
+ if (aliveRef.current) setLanHost(fromWindow());
+ return;
+ }
+ try {
+ const ip = await invokeNativeCommand("lan_ipv4");
+ if (aliveRef.current) setLanHost(ip && isValidPeerAddress(ip) ? ip : fromWindow());
+ } catch {
+ if (aliveRef.current) setLanHost(fromWindow());
+ }
}, []);
+
+ useEffect(() => {
+ // StrictMode mounts, cleans up and mounts again: re-arm the guard each
+ // time, otherwise the second mount would see `false` forever.
+ aliveRef.current = true;
+ void probeLanIp();
+ return () => { aliveRef.current = false; };
+ }, [probeLanIp]);
const hostPayload = useMemo(() => JSON.stringify({
app: "vaultzero",
version: 2,
@@ -618,6 +649,10 @@ export function SyncModal({ onClose, onNotify, items, onMerge, lang = "en" }: {
* Discovers VaultZero peers broadcasting on the local network.
*/
const handleDiscover = async () => {
+ // V-92: the LAN interface may have come up after this modal mounted.
+ // Re-probe only while no address is known, so a manually entered IP is
+ // never silently replaced by a browser hostname.
+ if (!lanHost) void probeLanIp();
try {
const peers = await invokeNativeCommand>(
"discover_peers",
@@ -1066,6 +1101,38 @@ export function SyncModal({ onClose, onNotify, items, onMerge, lang = "en" }: {
+ {/* V-92: browser / no-LAN fallback. The pairing QR must carry a
+ routable IP, so the user can supply one instead of silently
+ advertising an empty or loopback address. Invalid input is
+ rejected with the same strict RFC-1918 rule as Connect. */}
+ {!lanHost && (
+
+ setManualLanIp(e.target.value)}
+ placeholder={S("নিজের LAN IP লিখুন (যেমন ১৯২.১৬৮.১.৫)", "Enter your LAN IP (e.g. 192.168.1.5)")}
+ className="min-h-[44px] min-w-0 flex-1 rounded-[10px] border border-[var(--border-soft)] bg-[var(--glass-input)] px-3 text-[10px] text-main"
+ aria-label="Manual LAN IP"
+ />
+
+
+ )}
+
{/* V-17: the real host control. Without this the QR code advertised a
transfer that never happened. */}
diff --git a/src/lib/p2pMerge.ts b/src/lib/p2pMerge.ts
index 4de37d7..9730f96 100644
--- a/src/lib/p2pMerge.ts
+++ b/src/lib/p2pMerge.ts
@@ -202,8 +202,17 @@ export function isValidPeerAddress(value: string): boolean {
const raw = value.trim();
const match = /^(\d{1,3}(?:\.\d{1,3}){3})(?::(\d{1,5}))?$/.exec(raw);
if (!match) return false;
- const octets = match[1].split(".");
- if (!octets.every((part) => /^(0|[1-9]\d{0,2})$/.test(part) && Number(part) <= 255)) return false;
+ const parts = match[1].split(".");
+ if (!parts.every((part) => /^(0|[1-9]\d{0,2})$/.test(part) && Number(part) <= 255)) return false;
+ const [first, second] = parts.map(Number);
+ // V-92: a peer must live on THIS local network. Accepting any dotted IPv4
+ // let 8.8.8.8 / 1.1.1.1 (or a link-local 169.254 address) become a
+ // "selected peer" even though no VaultZero host can ever be there.
+ const isRfc1918 =
+ first === 10 ||
+ (first === 172 && second >= 16 && second <= 31) ||
+ (first === 192 && second === 168);
+ if (!isRfc1918) return false;
if (match[2]) {
const port = Number(match[2]);
if (port < 1 || port > 65535) return false;
diff --git a/tests/harness/lan-peer-contract.test.mjs b/tests/harness/lan-peer-contract.test.mjs
new file mode 100644
index 0000000..7b5a7ec
--- /dev/null
+++ b/tests/harness/lan-peer-contract.test.mjs
@@ -0,0 +1,72 @@
+// V-92 / Batch 3 — strict RFC-1918 peers + a REAL LAN IPv4 from the Rust core.
+// Positive controls prove the detector would have caught the old behaviour.
+import { readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { fileURLToPath, pathToFileURL } from "node:url";
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
+const read = (p) => readFileSync(join(ROOT, p), "utf8");
+const bundle = (name) => pathToFileURL(join(ROOT, ".harness-build", name)).href;
+const m = await import(bundle("p2pMerge-built.mjs"));
+
+let failures = 0;
+const t = (name, ok, extra = "") => {
+ console.log(`${ok ? "PASS" : "FAIL"} ${name}${extra ? " — " + extra : ""}`);
+ if (!ok) failures++;
+};
+
+console.log("=== positive control: the OLD validator accepted public IPs ===");
+const legacy = (v) => /^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?$/.test(v.trim());
+t("legacy shape check WOULD accept 8.8.8.8:1420", legacy("8.8.8.8:1420"));
+t("detector is sensitive (a blank snippet has no UdpSocket)", !/UdpSocket::bind/.test("fn lan_ipv4() {}"));
+
+console.log("=== strict RFC-1918 peer validation ===");
+const PRIVATE = [
+ "10.0.0.5", "10.255.255.254:52137", "172.16.0.1", "172.31.255.254:52137",
+ "192.168.1.5:52137", "192.168.0.1",
+];
+const PUBLIC = [
+ "8.8.8.8:1420", "1.1.1.1", "172.15.0.1:52137", "172.32.0.1",
+ "192.169.1.5", "169.254.1.1", "127.0.0.1:1420", "localhost",
+ "tauri.localhost", "192.1", "192.168.1.5:99999", "999.1.1.1:1420",
+];
+for (const v of PRIVATE) t(`accepts private ${v}`, m.isValidPeerAddress(v) === true);
+for (const v of PUBLIC) t(`rejects ${v}`, m.isValidPeerAddress(v) === false);
+t(
+ "QR JSON with a public ip yields no peer",
+ m.parsePeerInput('{"app":"vaultzero","ip":"8.8.8.8","port":1420,"code":"729184"}').address === null,
+);
+t(
+ "QR JSON with a private ip:port still works",
+ m.parsePeerInput('{"ip":"10.0.0.7","port":42222,"code":"112233"}').address === "10.0.0.7:42222",
+);
+
+console.log("=== Rust: real LAN IPv4 via the UDP-socket trick ===");
+const p2pRust = read("src-tauri/src/p2p_lan.rs");
+const libRust = read("src-tauri/src/lib.rs");
+const rust = p2pRust + "\n" + libRust;
+t("a lan_ipv4 command is defined", /fn lan_ipv4\s*\(/.test(rust));
+t("binds an ephemeral UDP socket", /UdpSocket::bind\("0\.0\.0\.0:0"\)/.test(rust));
+t("uses the connect-to-a-route trick (no packet is sent)", /connect\("8\.8\.8\.8:80"\)/.test(rust));
+t("reads local_addr()", /local_addr\(\)/.test(rust));
+t("filters to private LAN ranges", /10\.|192\.168|172\.16/.test(rust));
+t("registered in generate_handler!", /commands::lan_ipv4/.test(libRust));
+
+console.log("=== Renderer: uses it, never advertises tauri.localhost ===");
+const modals = read("src/components/toolModals.tsx");
+t("the renderer calls lan_ipv4", /"lan_ipv4"/.test(modals));
+t("native runtime is detected before the call", /isNativeRuntime\s*\(/.test(modals));
+t("a manual LAN-IP fallback exists", /manualLanIp|Enter your LAN IP/.test(modals));
+t("hostname is not the only source of truth", /hostPayload[\s\S]{0,220}lanHost/.test(modals));
+t("no hardcoded tauri.localhost advertisement", !/IP:\s*\{?\s*["']tauri\.localhost/.test(modals));
+
+console.log("=== V-92 review fix: the LAN probe must be REUSABLE ===");
+const reProbeRe = /const handleDiscover = async \(\) => \{[\s\S]{0,400}?if \(!lanHost\) void probeLanIp\(\)/;
+t("the probe is a reusable callback, not a one-shot effect", /const probeLanIp = useCallback/.test(modals));
+t("Discover re-probes when Wi-Fi appeared after mount", reProbeRe.test(modals));
+t("positive control: a handler WITHOUT re-probe is rejected", !reProbeRe.test(
+ "const handleDiscover = async () => { await invoke('discover_peers'); " + "x".repeat(500) + " }; const probeLanIp = () => {};"
+));
+
+console.log(`=== ${failures === 0 ? "GREEN" : "RED"}: ${failures} failure(s) ===`);
+process.exit(failures === 0 ? 0 : 1);
diff --git a/tests/vault-mobile-shell.spec.ts b/tests/vault-mobile-shell.spec.ts
index 149c442..735ece8 100644
--- a/tests/vault-mobile-shell.spec.ts
+++ b/tests/vault-mobile-shell.spec.ts
@@ -448,12 +448,33 @@ test("M-19 the P2P Host tab fits a phone with no clipped footnote", async ({ pag
const dialog = page.locator('[role="dialog"][aria-modal="true"]');
await expect(dialog.getByRole("button", { name: /Host \/ Show QR/ })).toBeVisible();
const footer = dialog.locator("footer");
+ // V-92: the Host tab gained a REQUIRED 44px "enter your LAN IP" control, so
+ // a 390x844 phone can no longer show every row without scrolling. The old
+ // `scrollHeight <= clientHeight` proxy is no longer the right invariant:
+ // assert the user-visible property instead — the body is scrollable, the
+ // extra content is bounded, and the LAST control ends above the footer.
const metrics = await footer.evaluate((f) => {
const body = f.previousElementSibling as HTMLElement;
- return { scrollHeight: body.scrollHeight, clientHeight: body.clientHeight };
+ const cs = getComputedStyle(body);
+ const buttons = [...body.querySelectorAll("button")];
+ const last = buttons[buttons.length - 1];
+ body.scrollTop = body.scrollHeight;
+ return {
+ overflowY: cs.overflowY,
+ scrollHeight: body.scrollHeight,
+ clientHeight: body.clientHeight,
+ scrollTop: body.scrollTop,
+ lastBottom: last ? last.getBoundingClientRect().bottom : -1,
+ footerTop: f.getBoundingClientRect().top,
+ };
});
- expect(metrics.scrollHeight, "no content may be clipped behind the footer on a phone")
- .toBeLessThanOrEqual(metrics.clientHeight + 2);
+ expect(metrics.overflowY, "the Host body must be scrollable, not clipped").toBe("auto");
+ const extra = metrics.scrollHeight - metrics.clientHeight;
+ expect(extra, "there is extra content to scroll").toBeGreaterThan(0);
+ expect(extra, "extra content stays bounded").toBeLessThanOrEqual(60);
+ expect(metrics.scrollTop, "scrolling actually moves the content").toBeGreaterThan(0);
+ expect(metrics.lastBottom, "the last control is fully reachable above the footer")
+ .toBeLessThanOrEqual(metrics.footerTop + 1);
// The security note was hidden on phones, NOT deleted: on a desktop it
// must still be visible, so no information was lost.
diff --git a/tests/vault-p2p-lan.spec.ts b/tests/vault-p2p-lan.spec.ts
new file mode 100644
index 0000000..cffc227
--- /dev/null
+++ b/tests/vault-p2p-lan.spec.ts
@@ -0,0 +1,157 @@
+/**
+ * Batch 3 / V-92 — P2P real networking, strict peers and camera fallback.
+ *
+ * BEFORE the fix (measured): `isValidPeerAddress` accepted ANY dotted IPv4,
+ * including 8.8.8.8, and the Host tab derived its IP from
+ * `window.location.hostname` — which is `tauri.localhost` inside Tauri, so it
+ * printed "IP: not detected · use Discover" and the QR carried an empty IP.
+ * The QR-photo fallback, the handshake-gated "connected" status, the footer
+ * wrapping and the CAMERA/INTERNET permissions were already correct; B-14/B-15
+ * are guards, not fixes.
+ */
+import { expect, test, type Page } from "@playwright/test";
+
+const PHONE = { width: 360, height: 800 };
+
+/** Simulate Tauri's IPC. `has_vault_file` keeps first-run detection honest. */
+async function stubNative(page: Page, lanIp: string | null) {
+ await page.addInitScript(
+ ({ ip }) => {
+ const w = window as unknown as {
+ __TAURI_INTERNALS__: { invoke: (cmd: string) => Promise };
+ };
+ w.__TAURI_INTERNALS__ = {
+ invoke: async (cmd: string) => {
+ if (cmd === "lan_ipv4") return ip;
+ if (cmd === "has_vault_file") return true;
+ return undefined;
+ },
+ };
+ },
+ { ip: lanIp },
+ );
+}
+
+const openSync = (page: Page) => page.getByRole("button", { name: "Sync" }).click();
+const openScan = async (page: Page) => {
+ await openSync(page);
+ await page.getByRole("button", { name: /Scan QR/ }).click();
+};
+
+test("B-11 a public IP is rejected as a peer (no fake Peer selected)", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ await openScan(page);
+ await page.getByPlaceholder(/10\.0\.0\.5/).fill("8.8.8.8:1420");
+ await page.getByRole("button", { name: "Connect", exact: true }).click();
+ await expect(page.getByText(/not a valid peer address/i)).toBeVisible();
+ await expect(page.getByText(/Peer selected: 8\.8\.8\.8|Connected: 8\.8\.8\.8/)).toHaveCount(0);
+});
+
+test("B-12 the Host tab shows the REAL LAN IP reported by Rust, never tauri.localhost", async ({ page }) => {
+ await stubNative(page, "192.168.1.23");
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ await openSync(page);
+ await expect(page.getByText(/IP:\s*192\.168\.1\.23/)).toBeVisible();
+ await expect(page.getByText(/not detected/i)).toHaveCount(0);
+ await expect(page.getByText(/IP:\s*tauri\.localhost/i)).toHaveCount(0);
+});
+
+test("B-13 with no detected LAN IP the user can enter one manually", async ({ page }) => {
+ await stubNative(page, null);
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ await openSync(page);
+ await expect(page.getByText(/not detected/i)).toBeVisible();
+ const input = page.getByPlaceholder(/Enter your LAN IP/i);
+ await expect(input).toBeVisible();
+ // A hostname is not a LAN endpoint and must not be accepted. Check this
+ // FIRST: once a valid IP is accepted the fallback row is no longer needed.
+ await input.fill("tauri.localhost");
+ await page.getByRole("button", { name: /^Use IP$/ }).click();
+ await expect(page.getByText(/IP:\s*tauri\.localhost/i)).toHaveCount(0);
+ await expect(input).toBeVisible();
+ await input.fill("192.168.1.44");
+ await page.getByRole("button", { name: /^Use IP$/ }).click();
+ await expect(page.getByText(/IP:\s*192\.168\.1\.44/)).toBeVisible();
+});
+
+test("B-14 connecting alone never claims Connected; the QR-photo fallback is prominent", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ await openScan(page);
+ await page.getByPlaceholder(/10\.0\.0\.5/).fill("192.1");
+ await page.getByRole("button", { name: "Connect", exact: true }).click();
+ await expect(page.getByText(/Connected: 192\.1/)).toHaveCount(0);
+ const fallback = page.getByRole("button", { name: /Read QR from an image|ছবি থেকে QR/i });
+ await expect(fallback).toBeVisible();
+ const box = await fallback.boundingBox();
+ expect(box, "the always-working photo fallback must be laid out").toBeTruthy();
+ expect(box!.height, "44px thumb-zone target").toBeGreaterThanOrEqual(44);
+});
+
+test("B-15 Close / Send Vault / Receive & Merge stay inside a 360px viewport", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.goto("/?unlocked=true");
+ await openScan(page);
+ // The two transfer actions are intentionally hidden until a VALID peer is
+ // selected; select one first (same sequence as the existing M-13 guard).
+ await page.getByPlaceholder(/10\.0\.0\.5/).fill("192.168.1.5:52137");
+ await page.getByRole("button", { name: "Connect", exact: true }).click();
+ const footer = page.locator("footer");
+ for (const name of ["Close", "Send Vault", "Receive & Merge"]) {
+ const box = await footer.getByRole("button", { name, exact: true }).boundingBox();
+ expect(box, `${name} must be laid out`).toBeTruthy();
+ expect(box!.x, `${name} must not be clipped on the left`).toBeGreaterThanOrEqual(-1);
+ expect(box!.x + box!.width, `${name} must not be clipped on the right`).toBeLessThanOrEqual(PHONE.width + 1);
+ }
+});
+
+/**
+ * V-92 improvement found by review: the incoming one-shot `useEffect` probed
+ * `lan_ipv4` ONLY on mount. On Android the Wi-Fi interface frequently appears
+ * after the app has drawn the Host tab, so the pairing QR kept `ip: ""`
+ * until the modal was closed and reopened. Re-probing on Discover fixes that.
+ */
+test("B-16 a LAN interface that appears after the modal opens is picked up", async ({ page }) => {
+ await page.setViewportSize(PHONE);
+ await page.addInitScript(() => {
+ const w = window as unknown as {
+ __TAURI_INTERNALS__: { invoke: (cmd: string) => Promise };
+ __lanProbeCalls: number;
+ __allowIp: boolean;
+ };
+ w.__lanProbeCalls = 0;
+ w.__allowIp = false;
+ w.__TAURI_INTERNALS__ = {
+ invoke: async (cmd: string) => {
+ // Count EVERY probe. React StrictMode may invoke the mount effect
+ // twice, so "the IP appeared" alone is NOT proof of a re-probe.
+ if (cmd === "lan_ipv4") {
+ w.__lanProbeCalls += 1;
+ return w.__allowIp ? "192.168.1.77" : null;
+ }
+ if (cmd === "has_vault_file") return true;
+ if (cmd === "discover_peers") return [];
+ return undefined;
+ },
+ };
+ });
+ await page.goto("/?unlocked=true");
+ await openSync(page);
+ await expect(page.getByText(/not detected/i)).toBeVisible();
+ const before = await page.evaluate(() => (window as any).__lanProbeCalls as number);
+ await page.evaluate(() => { (window as any).__allowIp = true; });
+ const discover = page.getByRole("button", { name: /Discover nearby VaultZero peers/i });
+ await discover.scrollIntoViewIfNeeded();
+ await discover.click();
+ // `void probeLanIp()` is fire-and-forget and dynamically imports the Tauri
+ // core first, so the counter can tick a few ms AFTER the click resolves.
+ // A one-shot read is a race under a loaded full suite: poll instead.
+ await expect.poll(
+ () => page.evaluate(() => (window as any).__lanProbeCalls as number),
+ { message: "Discover must actively re-probe the LAN interface", timeout: 10000 },
+ ).toBeGreaterThan(before);
+ await expect(page.getByText(/IP:\s*192\.168\.1\.77/)).toBeVisible();
+});
From 8945e62713919451904263d04e681c44d11e2d71 Mon Sep 17 00:00:00 2001
From: tonmoycoder <78300713+tonmoycoder@users.noreply.github.com>
Date: Sun, 8 Nov 2026 01:48:20 +0000
Subject: [PATCH 06/20] docs(V-90): record batch 3 CI success (incl. Windows
Rust build) and close the batch
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
---
checklistprogress.md | 2 ++
checkpoint.md | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/checklistprogress.md b/checklistprogress.md
index 6245778..934426e 100644
--- a/checklistprogress.md
+++ b/checklistprogress.md
@@ -257,3 +257,5 @@ Active branch: `arena/317fbb3c-vaultzero` (never rename). PR #2 + #3 MERGED, #1
- [ ] Batch 4 (resume with `continue`): Check for Updates CSP, resilient GitHub fetch, strict SemVer
- [ ] Batches 5-7 + final Antigravity prompt (local-only work + merge) + English master prompt LAST
- [!] `.vztransfer` snapshot-file transfer NOT implemented (reported, not faked); real-device camera/LAN/onPermissionRequest needs Antigravity
+- [x] `09d5747` pushed; push `42435123882` + PR `42435126914` both watched to exit 0 (Windows Rust compile/clippy green); `gh pr checks 4` pass/pass
+- [x] Batch 3 CLOSED — resume with `continue` for Batch 4
diff --git a/checkpoint.md b/checkpoint.md
index e86ac5b..b7a117d 100644
--- a/checkpoint.md
+++ b/checkpoint.md
@@ -835,3 +835,10 @@ Windows-CI-only (no local cargo) and will be confirmed by the watched run.
WebView `onPermissionRequest` bridging, real-device camera/LAN P2P handshake,
carrier CG-NAT 10.x mis-detection and 120Hz behaviour need Antigravity on
real hardware. No release assets/signing secrets touched here.
+
+### V-92 Batch 3 close-out (CI / PR #4)
+`09d5747` pushed. Both events watched to exit 0: push `42435123882` and
+`pull_request` `42435126914`, each `success` for BOTH `Test & Build
+Verification` (Windows Rust compile/clippy) and `Frontend End-to-End &
+Security Tests`. `gh pr checks 4` -> pass (8m57s) + pass (2m2s). No
+merge/close. Batch 3 CLOSED; resume with `continue` for Batch 4.
From 0e616c701d57dfc656f1089feeb6ef00253186dc Mon Sep 17 00:00:00 2001
From: tonmoycoder <78300713+tonmoycoder@users.noreply.github.com>
Date: Sun, 8 Nov 2026 07:17:15 +0000
Subject: [PATCH 07/20] fix(V-90/batch4): resilient release check never claims
false offline; CSP + 10s timeout (test-first)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
---
checklistprogress.md | 15 ++
checkpoint.md | 71 +++++++
src-tauri/tauri.conf.json | 4 +-
src/components/UpdateModal.tsx | 20 ++
src/lib/updater.ts | 223 ++++++++++++++--------
tests/harness/updater-resilience.test.mjs | 164 ++++++++++++++++
tests/vault-updater-resilience.spec.ts | 99 ++++++++++
7 files changed, 516 insertions(+), 80 deletions(-)
create mode 100644 tests/harness/updater-resilience.test.mjs
create mode 100644 tests/vault-updater-resilience.spec.ts
diff --git a/checklistprogress.md b/checklistprogress.md
index 934426e..3b11a4d 100644
--- a/checklistprogress.md
+++ b/checklistprogress.md
@@ -259,3 +259,18 @@ Active branch: `arena/317fbb3c-vaultzero` (never rename). PR #2 + #3 MERGED, #1
- [!] `.vztransfer` snapshot-file transfer NOT implemented (reported, not faked); real-device camera/LAN/onPermissionRequest needs Antigravity
- [x] `09d5747` pushed; push `42435123882` + PR `42435126914` both watched to exit 0 (Windows Rust compile/clippy green); `gh pr checks 4` pass/pass
- [x] Batch 3 CLOSED — resume with `continue` for Batch 4
+
+## PHASE F / V-93 — Batch 4: resilient update check, CSP, strict SemVer (2026-11-08)
+
+- [x] Re-baselined: HEAD `8945e62`, PR #4 `pr_open` pass/pass, no remote advance
+- [x] Measured CORS for real: api.github.com = `ACAO:*`; github.com 302 has NO CORS header (cannot read Location from renderer)
+- [x] Reproduced the screenshot's false "Offline" in real Chromium (`ERR_CERT_AUTHORITY_INVALID` -> offline)
+- [x] RED: 11 harness FAIL (CSP tokens, 8s timeout, API version header, no fallback, false offline)
+- [x] GREEN fix 1: connect-src += `*.githubusercontent.com`, `ipc:`, `http://ipc.localhost`
+- [x] GREEN fix 2: 10s timeout, pinned API version, `/releases?per_page=1` fallback, no-cors reachability probe, `error` != `offline`
+- [x] GREEN fix 3: new bilingual `error` render in UpdateModal (previously invisible); up_to_date/Update Now unchanged (already strict SemVer)
+- [x] Review after fix: all 3 endpoints attempted in order; sandbox cert-fails all -> offline is honest; B-17/B-18/B-20 prove online behaviour
+- [x] Gates: tsc 0 · verify 0 (**40 harness**) · node20 40/40 · audit 0 · Playwright **167/167 (13.0m)** · live check 0
+- [!] Renderer cannot read the 302 Location (CORS); a native Rust HTTP command to do so is NOT implemented — reported, not faked
+- [ ] Batch 5 (resume with `continue`): offline OCR (eng+ben), strict RFC 6238 TOTP, official APK/Windows logo parity
+- [ ] Batches 6-7 + final Antigravity prompt (local-only work + merge) + English master prompt LAST
diff --git a/checkpoint.md b/checkpoint.md
index b7a117d..8e2fbb1 100644
--- a/checkpoint.md
+++ b/checkpoint.md
@@ -842,3 +842,74 @@ real hardware. No release assets/signing secrets touched here.
Verification` (Windows Rust compile/clippy) and `Frontend End-to-End &
Security Tests`. `gh pr checks 4` -> pass (8m57s) + pass (2m2s). No
merge/close. Batch 3 CLOSED; resume with `continue` for Batch 4.
+
+## V-93 — Batch 4 / "Check for Updates" resilience, CSP, strict SemVer (2026-11-08)
+
+**Branch status from platform: `pr_open` (PR #4).** Baseline HEAD `8945e62`,
+clean, remote in sync, `main` `c6ea9b2`, PR #4 pass/pass. No external advance
+this turn.
+
+### Empirical CORS measurement (no guesses)
+`curl -I -H "Origin: https://tauri.localhost"`:
+- `https://api.github.com/repos/tonmoycoder/VaultZero/releases/latest` -> 200,
+ `access-control-allow-origin: *` (CORS-readable from a WebView).
+- `https://github.com/tonmoycoder/VaultZero/releases/latest` -> **302 ->
+ `/releases/tag/v2.5.2`, but NO CORS header**. A renderer therefore CANNOT
+ read the redirect `Location`; it can only use that URL as an opaque
+ `no-cors` REACHABILITY probe. No `tauri-plugin-http` and no direct
+ `reqwest` dependency were added (over-engineering for this batch).
+- `src-tauri/Cargo.toml` has no HTTP plugin; `reqwest` exists only in
+ Cargo.lock as a transitive dependency.
+
+### Root cause of the screenshot's false "Offline" message
+`fetchLatestRelease()` made ONE request to `/releases/latest` and mapped ANY
+thrown error straight to `status: "offline"`. A TLS/UA/CORS failure on an
+otherwise online phone therefore rendered "Offline / Air-gapped network:
+Cannot reach remote release server." Reproduced in real headless Chromium
+before the fix (`.artifacts/probe-update.mjs`), where the cert error is
+`ERR_CERT_AUTHORITY_INVALID`.
+
+### Test-first RED -> GREEN
+NEW `tests/harness/updater-resilience.test.mjs` (40th harness) stubs
+`globalThis.fetch` and drives `checkReleaseStatus(true)`; NEW
+`tests/vault-updater-resilience.spec.ts` (B-17..B-20) drives the real UI with
+`page.route`. RED = 11 harness FAIL (3 CSP tokens, 8s timeout, missing
+`X-GitHub-Api-Version`, no fallback, false offline) + the real modal showing
+Offline. Guards already passing: strict SemVer (same/newer/prerelease),
+`Accept` header, genuine all-paths-down offline.
+
+### Fixes (minimal)
+- `src-tauri/tauri.conf.json` `connect-src` gained
+ `https://*.githubusercontent.com`, `ipc:`, `http://ipc.localhost`
+ (kept `'self'`, `api.github.com`, `github.com`,
+ `objects.githubusercontent.com`).
+- `src/lib/updater.ts`: `RELEASE_CHECK_TIMEOUT_MS` 8s -> **10s**; pinned
+ `X-GitHub-Api-Version: 2022-11-28`; one `withReleaseTimeout` helper bounds
+ BOTH fetch and JSON body read; `statusFromRelease` extracted so the primary
+ object and the fallback ARRAY share one strict-SemVer path. New chain:
+ `/releases/latest` -> `/releases?per_page=1` (403/429/5xx/throw/404) ->
+ opaque `no-cors` probe of the public redirect URL -> only if all three fail
+ is `offline` returned. A reachable network with unreadable metadata now
+ returns `status: "error"` with "The network IS reachable ...".
+- `src/components/UpdateModal.tsx`: added the missing `status === "error"`
+ bilingual render block; otherwise the new honest message would be invisible.
+ `up_to_date` already printed `v2.5.2` ("✓ ... up-to-date"), so it was NOT
+ changed; `Update Now` still requires `compareSemver(remote, local) > 0`.
+
+### Review -> improve -> review
+Unmocked probe AFTER the fix logs all three attempts in order
+(`/releases/latest`, `/releases?per_page=1`, public redirect), each failing
+with `ERR_CERT_AUTHORITY_INVALID` in this sandbox -> "Offline" here is HONEST,
+not a false claim. On an online device B-17 (primary throw + fallback ->
+up-to-date), B-18 (403 + fallback v2.6.0 -> Update Now) and B-20 (reachable
+but malformed -> honest error) prove the false offline is gone.
+
+**Gates.** `tsc` 0; `npm run verify` 0 (**40 harness files**, 23 rustfmt,
+bundle budget); node20 40/40; `npm audit --audit-level=high` 0;
+`npx playwright test` **167 passed (13.0m)**; `check-live-release.mjs` EXIT 0.
+
+**Honest limits.** The renderer cannot read the 302 `Location` from
+`github.com` (no CORS); reading that tag would need a native Rust HTTP command
+which was NOT implemented here — no fake fallback was added. Real-device
+TLS/UA behaviour needs Antigravity verification. `AndroidManifest.xml`
+already had `INTERNET`, so it was not touched.
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 6a5e90a..369f227 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -12,11 +12,11 @@
"app": {
"withGlobalTauri": true,
"security": {
- "csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https://api.github.com https://github.com https://objects.githubusercontent.com; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'none'"
+ "csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https://api.github.com https://github.com https://*.githubusercontent.com https://objects.githubusercontent.com ipc: http://ipc.localhost; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'none'"
},
"windows": [
{
- "title": "VaultZero — 100% Offline Password Manager",
+ "title": "VaultZero \u2014 100% Offline Password Manager",
"width": 1200,
"height": 800,
"minWidth": 480,
diff --git a/src/components/UpdateModal.tsx b/src/components/UpdateModal.tsx
index a9db403..27d265e 100644
--- a/src/components/UpdateModal.tsx
+++ b/src/components/UpdateModal.tsx
@@ -362,6 +362,26 @@ export default function UpdateModal({
)}
+ {/* V-93: the network IS reachable but release metadata could not be
+ read (rate limit / blocked WebView UA / malformed body). This is
+ NOT an air-gapped device, so the offline notice must not appear. */}
+ {statusState.status === "error" && (
+
+
+
+
+ {lang === "bn"
+ ? "রিলিজ তথ্য পড়া যায়নি — তবে নেটওয়ার্ক চালু আছে"
+ : "Release information unavailable — the network is reachable"}
+
+
+
+ {statusState.message ||
+ (lang === "bn" ? "কিছুক্ষণ পরে আবার চেষ্টা করুন।" : "Please try again shortly.")}
+