chore: make the development environment work from a clean checkout - #907
Merged
Conversation
rmdes
force-pushed
the
chore/dev-environment
branch
from
August 23, 2026 19:36
162a8f9 to
5a3df5c
Compare
Collaborator
It was intended that |
Setting up to work on Indiekit needed steps that were either undocumented or documented incorrectly, and the test suite depended on ambient state. `npm test` now needs nothing at all. It already started its own in-memory MongoDB for most tests, but `util/test/unit/mongodb.js` connected to `mongodb://foo:bar@localhost` — port 27017 — and asserted the error was `Authentication failed.`. That only holds when something happens to be listening there. `docs/development.md` tells contributors to run MongoDB on 27018, so following the documented setup exactly produced a failure after a 30-second server-selection timeout. It now starts an in-memory server with authentication enabled, which is deterministic, needs no service, and takes 180ms rather than 30s. The test scripts also supply development defaults for SECRET and PASSWORD_SECRET, overridden by real environment variables when set. Without them the suite reports 115 failures that look like broken code rather than a missing environment. CI passes both from repository secrets, which are not available to pull requests from forks. `compose.yaml` replaces the block of YAML that development.md asked contributors to copy by hand. That copy pinned mongo:7.0.11 — a release the README warns against, being affected by CVE-2025-14847 — and required `docker volume create` first, because it declared the volume external. Also adds `.env.example`, and corrects `npm run dev --production`, which passes the flag to npm rather than to the script.
rmdes
force-pushed
the
chore/dev-environment
branch
from
August 24, 2026 22:28
5a3df5c to
836690a
Compare
Collaborator
Author
|
Ah — npm sets |
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.
Setting up to work on Indiekit needed steps that were either undocumented or documented incorrectly, and the test suite depended on ambient state. After this,
git clone && npm install && npm testpasses with nothing else installed or running.npm testno longer depends on a MongoDB it didn't startMost tests already start their own in-memory MongoDB. One did not:
packages/util/test/unit/mongodb.jsconnected tomongodb://foo:bar@localhost— port 27017 — and asserted the error wasAuthentication failed.. That only holds if something happens to be listening there.docs/development.mdtells contributors to put MongoDB on 27018, so following the documented setup exactly failed this test after a 30-second server-selection timeout. It passes in CI only because the workflow starts MongoDB on 27017.It now uses an in-memory server with authentication enabled: deterministic, no external service, and 180ms instead of 30s.
Test scripts supply development defaults for
SECRETandPASSWORD_SECRETWithout them the suite reports 115 failures that read like broken code rather than a missing environment.
${SECRET:-test}means a real value still wins wherever one is set.Worth noting: CI supplies both from repository secrets, and
pull_requestruns from forks don't receive secrets — so an external contributor's first PR currently fails this way.compose.yamlreplaces YAML copied by handdevelopment.mdasked contributors to hand-copy a compose file. That copy pinnedmongo:7.0.11— a release the README explicitly warns against, being affected by CVE-2025-14847 — used the obsoleteversion:key, and declared its volumeexternal, so it neededdocker volume create mongo-datafirst or it wouldn't start.The shipped file uses
mongo:8, a named volume and a healthcheck, withnpm run db:up/db:down/db:reset. The port stays 27018 (override withMONGO_PORT) so it doesn't collide with a MongoDB already on the host.Also
.env.example.npm run dev --production→npm run dev -- --production; the original passes the flag to npm, not to the script.Verified
npm test, clean checkout, no.env, no Docker, nothing on 27017npm run db:up.env.examplenpm run lintTwo lint warnings pre-date this branch and are untouched:
packages/endpoint-share/README.mdfailsprettier --checkonmain, andwc/no-self-classfires twice inpackages/frontend/components.