# large-project — "megalith" (generated large Python codebase)

A deliberately large codebase (~500 files) for scale-testing coding tools:
search/indexing speed, cross-module refactors, bulk edits, test discovery.

It is a fictional logistics platform with 24 domain packages
(`inventory`, `shipping`, `billing`, …), each containing 18 modules. Every
module has a dataclass and 3 deterministic compute functions that all funnel
through the shared kernel `megalith.core.math_utils.cyclic_hash` — so a
change to that one function is observable across the entire tree (useful for
testing impact-analysis and refactoring tools).

## Layout

```
src/megalith/core/       hand-written shared utilities (math, text, registry)
src/megalith/<domain>/   24 generated domain packages x 18 modules
tests/                   one generated unittest file per domain (~460 tests)
docs/                    generated per-domain markdown docs
data/                    generated per-domain JSON fixtures
tools/generate.py        the generator (seeded, fully deterministic)
run_tests.sh             convenience test runner
```

## Run the tests

```bash
./run_tests.sh          # all domains
./run_tests.sh -v       # verbose
PYTHONPATH=src python3 -m unittest tests.test_billing   # one domain
```

## Regenerate

The tree is fully deterministic (seeded RNG). To rebuild from scratch:

```bash
python3 tools/generate.py
```

Ideas for tool tests against this project:

- Rename `cyclic_hash` and watch ~430 call sites update.
- Ask a tool "which modules use mod=503?" (grep-scale question).
- Break `clamp()` and see every domain's record test fail.

## Existing test examples

The `tests/` tree provides broad generated unittest coverage. Its additional
`manual-change-impact.md` charter makes the scale-demo intent explicit. CARBON
Demo can omit the tree for an analysis-from-source comparison or retain it to
show test inventory, impact, and duplication review.
