commit c853a137656fbe925bfd0913e9a8896d88b517ed
parent b738b79a1c9e938def6bd9b0413ca284f498a0e2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 12 Sep 2026 02:27:45 -0400
plans: S1 note 3 says why the bare env read is fine, and it is not inlining
The review checked the claim: INSTANCE_MODE is not a NEXT_PUBLIC_ variable
and is not in an env: block, so Next never inlines it. The predicate is safe
because its one caller is a server component. S2c is told to keep it that
way rather than reason from the wrong premise.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/plans/one-core-phase-2.md b/plans/one-core-phase-2.md
@@ -284,14 +284,16 @@ instead is make mcp's `HubSite` a `Pick<HubCorpusSite, "siteId"|"title"|"url">`,
so the read-back spelling can no longer drift from the published one.
**3. `shipsPwa` reads `process.env.INSTANCE_MODE` bare, with no `typeof process`
-guard** — unlike `io-stats.ts` and the page-cache knob, which are guarded. That
-is deliberate and the guard would be a BUG: Next inlines the literal member
-expression `process.env.INSTANCE_MODE` into the client bundle at build time, but
-a browser has no `process` global, so `typeof process !== "undefined" &&
-process.env.INSTANCE_MODE === "hub"` evaluates to `false` in a hub build's
-browser and silently turns the PWA off. The two knobs that ARE guarded use the
-dynamic `process.env?.[name]` form, which Next does not inline — correct for a
-server-only setting whose browser answer is "take the default".
+guard** — unlike `io-stats.ts` and the page-cache knob, which are guarded. The
+S1 note first claimed Next inlines that expression into the client bundle; the
+S1 review checked and it does not (`INSTANCE_MODE` is neither `NEXT_PUBLIC_`
+nor in a `next.config.ts` `env:` block). The real reason the bare read is fine:
+the predicate is byte-equivalent to `mode.ts:26-29` and `compose-site.ts:207-209`,
+and its only caller today is `export/app/layout.tsx` — a **server** component —
+so no browser ever evaluates it. `contract.ts` is not reachable from any
+browser-but-not-Next context (the service workers import nothing; the search
+worker keeps its own copy). **S2c: keep `shipsPwa` server-called when it deletes
+the two copies**, or add the guard then; do not reason from the inlining claim.
**4. `stats/` gets URLs without joining `CONTRACT.layers`.** It follows the same
manifest → page walk, but `corpus.json`'s `shardScheme` does not document it, so