Skip to content

fix(dev): bootstrap config.json + secrets and unblock test container#323

Open
KrishnaSuravarapu wants to merge 1 commit into
mainfrom
fix/local-dev-test-bootstrap
Open

fix(dev): bootstrap config.json + secrets and unblock test container#323
KrishnaSuravarapu wants to merge 1 commit into
mainfrom
fix/local-dev-test-bootstrap

Conversation

@KrishnaSuravarapu

Copy link
Copy Markdown
Contributor

Problem

On a fresh checkout, local make dev / make build / make test fail with two errors — both caused by gitignored files that CI creates but local bootstrap didn't:

Container Error Root cause
dev (web) FileNotFoundError: 'config.json' Dockerfile bakes config.json, but the .:/srv/code/dev bind mount (docker-compose.yml:15) shadows it with the host dir, which has no local config.json.
test pluggy PluginValidationError: Plugin 'pylama' pylama's pytest11 plugin uses pytest_collect_file(path, ...), an arg removed in pytest 9. CI worked around it with -p no:pylama; the Docker/Makefile pytest invocations never got the fix.

Changes

  • scripts/bootstrap_secrets.sh (new) — idempotently creates secrets/*.env from samples with a consistent MYSQL_ROOT_PASSWORD across files. Honors MYSQL_ROOT_PASSWORD / APP_TOKEN env overrides for deterministic runs (e.g. CI/debugging) before falling back to reuse-existing, then random.
  • Makefile — new idempotent setup_config target that materializes config.json from its sample; wired (with setup_secrets) into setup, setup_mounts, dev, and build.
  • pytest.ini — added -p no:pylama to addopts so the fix applies to every pytest invocation (test-container CMD + make test), not just CI. Standalone python -m pylama linting is unaffected.

Verification

  • make setup_config creates config.json, and is a no-op on re-run (idempotent).
  • dev container boots past config load and serves — HTTP 302 on http://localhost:8000 (redirect to auth).
  • python -m pytest --co inside the container collects 115 tests with no PluginValidationError.

Notes / follow-up

  • config.json stays gitignored — only bootstrapped locally.
  • .github/workflows/unit-tests.yml can now drop its inline -p no:pylama (redundant with pytest.ini) — left in place for now as belt-and-suspenders; happy to remove if preferred.

🤖 Generated with Claude Code

Local `make dev` / `make build` / `make test` were failing on a fresh
checkout for two reasons, both stemming from gitignored files that CI
creates but local bootstrap did not:

- dev/web container crashed with `FileNotFoundError: 'config.json'`.
  The Dockerfile bakes config.json, but the `.:/srv/code/dev` bind mount
  shadows it with the host dir, which has no config.json locally.
- test container aborted with a pylama PluginValidationError: pylama's
  pytest11 plugin uses `pytest_collect_file(path, ...)`, an argument
  removed in pytest 9. CI worked around it with `-p no:pylama`, but the
  Docker/Makefile pytest invocations never got the same fix.

Changes:
- scripts/bootstrap_secrets.sh: create secrets/*.env from samples,
  idempotently and with consistent MYSQL_ROOT_PASSWORD across files.
  Honors MYSQL_ROOT_PASSWORD / APP_TOKEN env overrides for deterministic
  (e.g. CI) runs before falling back to reuse-existing, then random.
- Makefile: add idempotent `setup_config` target that materializes
  config.json from its sample; wire it (plus setup_secrets) into setup,
  setup_mounts, dev, and build.
- pytest.ini: add `-p no:pylama` to addopts so the fix applies to every
  pytest invocation (test container CMD + `make test`), not just CI.
  Standalone `python -m pylama` linting is unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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