This is a working guide for contributors and coding agents in this repository. It captures practical rules that prevent avoidable CI and PR churn.
- This repository is an npm workspaces monorepo.
- root package:
testcontainers-monorepo - workspaces:
packages/testcontainersandpackages/modules/* - shared lockfile: root
package-lock.json(workspace installs update this single file)
- root package:
- For workspace-scoped dependency changes, prefer targeted commands to reduce lockfile churn:
npm install -w @testcontainers/<module>npm uninstall -w @testcontainers/<module> <package>
- If a public API changes, update the relevant docs in the same PR.
- If new types are made part of the public API, export them from the package's
index.tsin the same PR. - If new learnings or misunderstandings are discovered, propose an
AGENTS.mdupdate in the same PR. - Tests should verify observable behavior changes, not only internal/config state.
- Example: for a security option, assert a real secure/insecure behavior difference.
- Test-only helper files under
src(for example*-test-utils.ts) must be explicitly excluded from packagetsconfig.build.jsonso they are not emitted intobuildand accidentally published. - Vitest runs tests concurrently by default (
sequence.concurrent: trueinvitest.config.ts).- Tests that rely on shared/global mocks (for example
vi.spyOnon shared loggers/singletons) can be flaky due to interleaving or automatic mock resets. - Prefer asserting observable behavior instead of shared global mock state when possible.
- If a test must depend on shared/global mock state, use
it.sequential(...)ordescribe.sequential(...).
- Tests that rely on shared/global mocks (for example
npm installrequires escalated permissions for outbound network access to npm registries.npm testcommands should be run with escalation so tests can access the Docker socket.
- Use specific commands and clear justifications.
- Prefer narrow reruns rather than broad full-suite reruns when iterating.
- Start from
main. - Create a branch prefixed with
codex/. - Implement scoped changes only.
- Run required checks:
npm run format,npm run lint, and targeted tests. - Verify git diff only contains intended files.
- Never commit, push, or post on GitHub (issues, PRs, or comments) without first sharing the proposed diff/message and getting explicit user approval.
- Commit with focused message(s), using
git commit --no-verify.- Never bypass signing (for example, do not use
--no-gpg-sign). - If signing fails (for example, passphrase/key issues), stop and ask the user to resolve signing, then retry.
- Never bypass signing (for example, do not use
- Push branch. Ask for explicit user permission before any force push.
- Open PR against
mainusing a human-readable title (nofeat(...)/fix(...)prefixes).- When using
ghto create/edit PR descriptions, prefer--body-file <path>over inline--body. - This avoids shell command substitution issues when the body contains backticks.
- When using
- Add labels for both change type and semantic version impact.
- Ensure PR body includes:
- summary of changes
- verification commands run
- test results summary
- if semver impact is not
major, evidence that the change is not breaking Closes #<issue>only when the PR is intended to close a specific issue
enhancementbugdependenciesdocumentationmaintenance
majorminorpatch
- backward-compatible feature:
enhancement+minor - backward-compatible bug fix:
bug+patch - breaking change: type label +
major - docs-only change:
documentation+ usuallypatch - dependency update:
dependencies+ impact label based on user-facing effect
- Recheck
package-lock.jsonafternpm installfor unrelated drift and revert unrelated changes.