CodeNib / test
CLAUDE.md111 starsChanged 14 days agoApache-2.0View on GitHub
Mirrors the codenib/ package layout. Loads on top of the project-wide .claude/CLAUDE.md. A new test defaults to the unit tier — only add a marker if it actually needs the heavier deps, and pick the right tier: anything that mutates a shared repo must be integration_serial, never plain integration — the integration job runs parallel under pytest-xdist and a mutating test breaks it. The CI jobs key off exactly these markers (unit, integration, integration-serial, graph-consumer, slow; scip-core runs the C++…
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- landing/AGENTS.mdAGENTS.md
- web/AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
When executing captured Python source with -I, also pass -B and verify sys.flags.dont_write_bytecode.
- Very specific: line 56
Use the declared test dependencies or pytest.importorskip, rather than inserting a global mock during collection.
- Very specific: line 72
Keep regression watchdogs independent of runner timeouts.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
test/ — rules
Mirrors the codenib/ package layout. Loads on top of the project-wide
.claude/CLAUDE.md.
Marker tiers
| Marker | Scope | Duration |
| (none) | Unit — pure logic, mocks only | ~1 min |
integration | External repos, read-only / parallel-safe: chunkers, fixture-based SCIP | ~2 min |
integration_serial | Mutates shared repos (SCIP indexing, process_instance, git checkout/apply) — must run sequentially | ~25 min |
integration_serial_consumer | Consumes the graph.pkl written by integration_serial (runs in a separate downstream job) | ~5 min |
slow | LLM API calls, GPU embeddings | ~15 min |
make test # unit only; safe local default
pytest -m "not slow and not integration and not integration_serial and not integration_serial_consumer" -x # unit only
pytest -m "integration and not slow" # parallel-safe integration
pytest -m integration_serial # serial (repo-mutating)
pytest -m integration_serial_consumer # graph.pkl consumers
make test-slow # slow only; may make billed callsA new test defaults to the unit tier — only add a marker if it actually needs
the heavier deps, and pick the right tier: anything that mutates a shared
repo must be integration_serial, never plain integration — the
integration job runs parallel under pytest-xdist and a mutating test breaks
it. The CI jobs key off exactly these markers (unit, integration,
integration-serial, graph-consumer, slow; scip-core runs the C++
executables and SCIP/Fact/clangd Python gates through make core-test) — see
docs/ci_cd.md for the job chain.
Fixtures & caches
- Repo fixtures cache clones under
${CODENIB_TEMP_DIR}/gt-test/. - HuggingFace dataset cache lives at
~/.codenib/. - Git fixtures that copy or swap
.gitmust disable automatic maintenance before committing, so transient maintenance files cannot race the snapshot. - When executing captured Python source with
-I, also pass-Band verifysys.flags.dont_write_bytecode. Isolated mode ignoresPYTHON*environment settings; an environment-only bytecode setting can add files and invalidate the source receipt. Retain failed source-preservation attempts separately. - SCIP identity captures use filename-driven parametrization with a fixed single-file shape. Put independently shaped multi-file captures in their own fixture directory so existing globs do not collect them as compatible cases.
- CodeNib's managed loggers do not propagate to the root logger. Attach
caplog.handlerto the actual logger and usecaplog.set_levelfor the expected severity when asserting its records. Console setup can change capture-handler thresholds; attaching the handler alone still depends on another test's logging setup.
Gotchas
- An optional dependency absent from
sys.modulesmay still be installed. Use the declared test dependencies orpytest.importorskip, rather than inserting a global mock during collection. Check neighboring real-object tests in the same invocation when changing import setup. - Metadata-inventory regressions must change file size or entry identity rather than assume separate writes receive distinct timestamps. Source-read content authentication has its own byte-hash checks; keep those assertions separate.
- BM25 eligibility or candidate-limit changes must also run
pytest test/index/sparse_idx/test_bm25_index.py; this real SCIP-backed graph test is serial and excluded from the unit tier. Filtering before a candidate limit may refill the result set. Check test-file exclusion, eligible result capacity and preserved implementation order instead of assuming that filtering must reduce the number of returned results. - Module-local
subprocesstest doubles must preserve the constants and exceptions the exercised path reads, includingPIPEandTimeoutExpired. Reproduce against unchanged code before counting fixture failures as product regressions. - Keep regression watchdogs independent of runner timeouts. Unit CI uses
pytest-timeout, so itsSIGALRMmay already be armed. - For a module-local no-I/O check, replace that module's
osbinding with a guarded proxy. Do not replace process-wideos.open,os.read, oros.stat: pytest-xdist control threads and reporting still need them, and can exit the worker instead of producing a test failure. - Package shadowing: a
test/<name>/__init__.pywhose<name>matches a top-level package (e.g.scripts/) shadows that real package under pytest's rootdir import mode. Two independently-green PRs can break once merged — when a test dir mirrors a top-level package name, revalidate the merged tree, not just per-PR CI. - The
slowjob needs LLM API keys + a GPU; a redslowrun is usually pre-existing infra flake, not a regression in your change — don't block merges on it without checking it failed for the same reason before your PR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

