Skip to content

Dev backend: route test admin emails to nemar.org and add DEV banner - #400

Merged
neuromechanist merged 1 commit into
devfrom
feature/issue-399-dev-email-banner
May 1, 2026
Merged

neuromechanist merged 1 commit into
devfrom
feature/issue-399-dev-email-banner

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #399

Summary

  • Renames the seeded test admin/owner emails from unreachable `nemar.test` to `[email protected]` / `[email protected]` so dev admin notifications actually reach a human
  • Adds `isDev` to `resolveEmailConfig` (driven by `ENVIRONMENT=development`) and threads it through every email helper plus `sendBroadcast`
  • `applyDevWrap` injects a red "DEV BACKEND - NOT PRODUCTION" banner inside the email body and a `[DEV]` subject prefix when sent from dev

Why

A real signup hitting the dev API (e.g., the `arnodelorme` registration on 2026-05-01) caused admin notifications to be sent to `[email protected]` / `[email protected]`, which Resend marks as "delivery delayed" and no human ever receives. The banner also makes any inadvertent dev send obvious so we never mistake it for a production event.

Live update of `[email protected]` / `[email protected]` is already applied to `nemar-db-dev`; the seed scripts in this PR make future resets consistent.

Test plan

  • `bunx tsc --noEmit` clean (backend)
  • `bun test backend/test/email-config.test.ts` 10 pass (3 new `applyDevWrap` cases plus updated `resolveEmailConfig` shape)
  • Full `bun test` suite: 831 pass, 36 skip, 3 pre-existing failures on `dev` HEAD unrelated to this change (`broadcast.test.ts:100` expects "osc.earth" in template, `cli.test.ts:692` and `datalad-commands.test.ts:191` are network-dependent)
  • Deploy to dev (`-c backend/wrangler-sccn.toml --env dev`) and confirm a self-triggered signup notification renders the red banner and `[DEV]` subject

Adds isDev to resolveEmailConfig (driven by ENVIRONMENT=development) and
injects a red 'DEV BACKEND - NOT PRODUCTION' banner plus '[DEV]' subject
prefix into every outgoing email when the worker runs against the dev
backend. Threads isDev through every email helper and the broadcast
sender. Renames the seeded test admin/owner emails from the unreachable
nemar.test domain to [email protected] / [email protected] so admin
notifications hitting nemar-db-dev land in a mailbox a human checks.

Refs #399
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR400

Version: 0.8.9-PR400.0163fbd
Commit: 0163fbd


🤖 Updated on each push.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

/review-pr (code-reviewer agent)

No high-confidence issues found. Ship-ready.

Verified:

  • `isDev` detection (`ENVIRONMENT === "development"`) matches the value set in both `wrangler.toml` and `wrangler-sccn.toml` for the dev environment; case-insensitive and trimmed.
  • Banner regex `<body([^>]*)>` matches every template in `email.ts` and `broadcast.ts`; no-body fallback test covers the prepend path.
  • All 11 Resend call sites (`auth.ts`x4, `admin.ts`x5, `datasets.ts`x2) flow `isDev` through `resolveEmailConfig`. No bypass paths.
  • `applyDevWrap` test coverage: not-dev passthrough, dev-with-body injection, no-body fallback.
  • Email rename (`[email protected]` -> `[email protected]`, `[email protected]` -> `[email protected]`) propagated to all three seed scripts plus `test/cli.test.ts:194`. Remaining `[email protected]` references in `test/api.test.ts` are intentionally untouched. Snapshot SQL dumps under `backups/` carry old values but are not loaded by any test.

Pre-existing test failures on `dev` HEAD (`broadcast.test.ts:100` expects "osc.earth" in template, `cli.test.ts:692` and `datalad-commands.test.ts:191` are network-dependent) reproduced on a clean tree before these changes — not caused by this PR.

@neuromechanist
neuromechanist merged commit 44457b4 into dev May 1, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-399-dev-email-banner branch May 1, 2026 18:23
neuromechanist added a commit that referenced this pull request Sep 21, 2026
A lot of its state moved on 2026-09-20 and 2026-09-21. #387 and #397
merged, #399 landed the Python 3.12 floor and the Pyodide-bounded
dependency floors, #402 corrected #399, and #403 is open to merge
develop into the epic branch.

Records the correction rather than quietly restating the conclusion:
only compiled floors are a ceiling in the browser, because the test is
whether the package publishes a pure-Python wheel and not whether
Pyodide bundles it. The earlier claim that threadpoolctl>=3.6.0 was a
live broken install was wrong.

Also records the integration bug #403 exposed, since it is the argument
for not letting the epic branch drift again: MemmapData.__array_function__
returned NotImplemented for everything except copyto and put, and
defining that method opts a type into numpy's dispatch protocol where
NotImplemented raises rather than falling back. Develop's #351 test
covers that path and the epic branch never had it.

Notes that the case for holding #386 is weaker now that the epic branch
is no longer behind, and carries #400 and #401 as open.

This branch was previously deployed

1 inactive deployment
npm — 0163fbdb Deployed May 1, 2026 by neuromechanist via publish #701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant