Contributing and testing
Build turbo-12f binaries safely, run and author Go and TypeScript tests, and follow repository rules.
Use these procedures to build factory/ binaries, run the unit, e2e, and mutation suites, write compliant tests, and satisfy repository checks before opening a pull request.
Build safely
Compile cmd/... without overwriting a running factory/bin/t12.
Fast unit checks
Run gofmt, go vet, and -short unit tests on every edit.
E2E & mutation
Run -p 2 e2e packages, guard tests, and t12-mutate on a quiet host.
PR rules
Keep stdlib-only Go, zero code comments, and a 2-line changelog entry.
Edit, build, and test loop
Build binaries safely
Build all CLI and helper binaries from the repository root:
go -C factory build -o bin/ ./cmd/...Do not overwrite binaries under a live run
Check pgrep -fl factory/bin/t12 before rebuilding factory/bin/. If a request is active, build into /tmp/t12d/ and point scripts at it via T12_BIN:
go -C factory build -o /tmp/t12d/ ./cmd/...
T12_BIN=/tmp/t12d factory/scripts/demo-bakery.sh ~/t12-demo/run-testNever place or run a t12 binary inside a state home (absHome in cli.go refuses it). When editing factory/internal/ui/web/, run factory/scripts/build-ui.sh before go build so embedded dist/ assets update.
Run fast unit and guard checks
Run formatting, go vet, and the fast Go unit suite on every edit cycle (< 10 s total; ~100 ms per test):
gofmt -l factory/
go -C factory vet ./...
go -C factory test -short ./tests/unit/... ./internal/... ./cmd/...Run the Bun guard tests, offline role/seam evals, and the t12 ui Vitest suite when touching harnesses, prompts, or UI code:
bun test factory/adapters
factory/bin/t12 eval run --offline
bun --cwd factory/internal/ui/web run testRun E2E and mutation checks before opening a PR
Run the e2e suite on a quiet machine (-p 2 avoids CPU contention; aim for < 60 s per package):
go -C factory test -p 2 ./tests/e2e/...Check per-package timings across both tiers with:
go -C factory test -count=1 -p 2 ./tests/unit/... ./tests/e2e/... 2>&1 | grep -E '^(ok|FAIL|---)'Use t12-mutate on a quiet tree to find unit coverage gaps (keep mutation-report.json local, never committed). CI runs t12-mutate new-tests -base <REF> (new-tests-kill), requiring every new Test in tests/unit to kill at least one mutant:
go -C factory run ./cmd/t12-mutate -pkg ./internal/store -report mutation-report.json
go -C factory run ./cmd/t12-mutate prune -report mutation-report.jsonReady to open a PR
gofmt -l factory/ prints nothing, go vet and -short unit tests pass, -p 2 e2e passes on a quiet host, and factory/CHANGELOG.md has your entry.
Author Go tests
| Rule | Requirement |
|---|---|
| Red-first | Break production code to observe the test fail before restoring it; write a unit test first for every e2e bug |
| Tier placement | Fast mocked tests (t.Parallel(), < 100 ms) go in tests/unit/; full-binary and omprpc tests go in tests/e2e/ |
| Cage safety | Call cagehost.SkipInside (factory/tests/support/cagehost) in tests binding loopback sockets or expecting uncaged runs |
| Build & git flags | Pass -buildvcs=false when building binaries or running go list on main packages; set local user.name/user.email for commits |
Temp homes (TestMain) | End TestMain with os.Exit(privatetmp.Run(m)) (privatetmp.Setup before hard-linked fixtures); keep out of /dev/shm |
| Go cache seed | After t12 init creates a compile-capable verify-home, call gocacheseed.Seed (~38 s saved per run) |
| Executable fakes | Write fake docker scripts and hooks via exefile.Write (syscall.ForkLock avoids ETXTBSY) |
| Scope | Assert exported behavior against synthetic repos and fakes; leave factory/PARITY.tsv and factory/REWRITE-LOG.md untouched |
Follow repository rules
- Zero Go dependencies: Keep
factory/go.modfree ofrequire,go.sum, andvendor/, and preserveignore ./docs-site. - Offline CLI boundary: Keep
internal/cli/free ofnet/http, credentials, and model calls; place network/model binaries underfactory/cmd/t12-<name>/. - Clean API replacements: Keep control flow in
internal/modelandinternal/orchestrator; migrate callers and delete old internal APIs in the same PR. - Neutral wording: Keep
prompts/,skills/, andcatalogue/*.jsonpassingwording_test.go(use harmless inputs like<b>t12-check</b>andO'Brien). - No source comments: Keep code comments out of source files (
AGENTS.md:"Comments are liability"), leaving only machine directives. - Changelog & commits: Add one entry in
factory/CHANGELOG.mdunder## Unreleased(at most 2 lines of 120 chars, no nested bullets, ending in(#PR)). Use Conventional Commits and merge commits.
Known test quirks (not regressions)
- macOS
jobrunskips:TestACommandJobKeepsPathAndLangandTestACommandThatCannotBeStartedExits1WithOneCheckCommandFindingskip on macOS Docker runs becauseLANGdoes not enter containers and missing binaries exit127. - Busy-host flakes:
TestTheDeployWaitsForAQuietMergeQueue,TestBootstrapMakesTheRepoAndIsIdempotent, andTestProjectGateBlocksOnAMissingBasecan flake under heavy load (green when run alone;devopstakes ~10minutes on Intel Macs).
Next steps
LLMs and agents (llms.txt & AGENTS.md)
Machine-readable docs endpoints (/llms.txt, /llms-full.txt, /llms.mdx/*, /agents.md) and coding-agent setup for turbo-12f.
Extend the factory
Step-by-step recipes to add CLI verbs, UI actions, project settings, prompts, role skills, review rules, catalogues, and diagrams.