agentleFS
sysevol-aisysevol-ai/CodeNib/test/CLAUDE.md

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++…

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
  1. Very specific:

    When executing captured Python source with -I, also pass -B and verify sys.flags.dont_write_bytecode.

    line 40
  2. Very specific:

    Use the declared test dependencies or pytest.importorskip, rather than inserting a global mock during collection.

    line 56
  3. Very specific:

    Keep regression watchdogs independent of runner timeouts.

    line 72

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

test/ — rules

Mirrors the codenib/ package layout. Loads on top of the project-wide .claude/CLAUDE.md.

Marker tiers

MarkerScopeDuration
(none)Unit — pure logic, mocks only~1 min
integrationExternal repos, read-only / parallel-safe: chunkers, fixture-based SCIP~2 min
integration_serialMutates shared repos (SCIP indexing, process_instance, git checkout/apply) — must run sequentially~25 min
integration_serial_consumerConsumes the graph.pkl written by integration_serial (runs in a separate downstream job)~5 min
slowLLM 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 calls

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++ 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 .git must disable automatic maintenance before committing, so transient maintenance files cannot race the snapshot.
  • When executing captured Python source with -I, also pass -B and verify sys.flags.dont_write_bytecode. Isolated mode ignores PYTHON* 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.handler to the actual logger and use caplog.set_level for 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.modules may still be installed. Use the declared test dependencies or pytest.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 subprocess test doubles must preserve the constants and exceptions the exercised path reads, including PIPE and TimeoutExpired. Reproduce against unchanged code before counting fixture failures as product regressions.
  • Keep regression watchdogs independent of runner timeouts. Unit CI uses pytest-timeout, so its SIGALRM may already be armed.
  • For a module-local no-I/O check, replace that module's os binding with a guarded proxy. Do not replace process-wide os.open, os.read, or os.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__.py whose <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 slow job needs LLM API keys + a GPU; a red slow run 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.