Skip to content

Latest commit

 

History

History
115 lines (90 loc) · 6.85 KB

CONTRIBUTING.md

File metadata and controls

115 lines (90 loc) · 6.85 KB

Working on CodeXray in parallel

The pipeline is a chain: each stage reads what the one before it wrote. To let everyone start at once, the scaffold fixes the things stages hand to each other and gives every lane something to test against before the stage upstream exists.

Lanes

Pick a lane and put your name in the Owner column in your first pull request.

Lane Owner You write Spec Reads Start without waiting by
repository Pranav, Aryan src/codexray/repository/, core/schema/01_repository.sql, settings/repository.yaml §5 a Git repository the tiny_repo test fixture
parse Pranav src/codexray/parse/, core/schema/02_parse.sql, settings/parse.yaml, settings/grammars.yaml §6 snapshot_files, file contents reading files from tiny_repo with git ls-tree and git cat-file
model Pranav src/codexray/model/, core/schema/03_model.sql, settings/model.yaml §7 links, snapshot_files, path_map inserting a few rows into an in-memory database (db.connect(":memory:"))
analyze Pranav, Aryan src/codexray/analyze/, the measured-habit and built-in parts of src/codexray/decisions/, core/schema/05_analyze.sql, settings/analyze.yaml §9, §12 nodes, edges, history tables inserting a small map by hand
judge Pranav, Aryan src/codexray/judge/, job A in src/codexray/decisions/, settings/judge.yaml §8 candidate_findings, the map the findings in web/public/bundles/fixture/findings.json
report Pranav, Aryan src/codexray/report/, src/codexray/check/, settings/report.yaml §11 candidate_findings, decision_checks, judgements/ inserting candidate findings by hand
web Viraj, Pranav web/ §10 the web bundle the synthetic bundle in web/public/bundles/fixture/

Each package's __init__.py is that lane's brief: what it reads, what it writes, when it is done, and which probe or starter kit to begin from. The order in which the product comes together is spec.md §16; step 6 there is the first end-to-end demo.

Two lanes share src/codexray/decisions/. Keep job A and the computed decisions in separate files so they do not collide.

What is shared

Everything in src/codexray/core/ is read by more than one lane.

File Holds
core/contracts.py The evidence record, the map's nodes and edges, decisions, findings, judgements, the web bundle files
core/schema/*.sql The database tables, one file per stage
core/runs.py The run folder layout, params_hash, sorted JSON writing
core/db.py Opening the run's database; fingerprint() for "two runs give the same tables"
core/settings.py Loads settings/*.yaml

Use these instead of building your own: write JSON with runs.write_json, open the database with db.connect, take paths from RunPaths.

Changing a contract

A stage's own schema file and settings file are yours to change. Tell the lane that reads your tables when a column changes.

For core/contracts.py, core/runs.py and another lane's schema file:

  1. Say what you need in the team chat before writing it.
  2. Make the change in its own small pull request, with nothing else in it.
  3. Run make contracts. It regenerates schemas/codexray.schema.json, the fixture bundle and web/src/contracts/generated.ts. Commit all three.
  4. Merge it quickly, so nobody builds on the old shape for long.

The tests fail if the generated files are out of date, and if a table is added or renamed without updating the list in tests/core/test_db.py.

Day-to-day

  • Branch from main, named <lane>/<what>. Keep branches short-lived: merge several times a day.
  • make check before you push. CI runs the same thing.
  • Rebase on main before opening a pull request. main stays green.
  • When your stage works, delete its line from STUBS in tests/test_cli.py and add your own tests.
  • Nothing under runs/ or repos/ is committed. The gateway key lives in .env only.

The principles, as checks

These come from spec.md §2. A change that breaks one needs a team decision.

  • Facts before AI. Detection, counting and ranking are ordinary code.
  • No fact without evidence. Evidence refuses a record without its lines or commits.
  • The snapshot is a key. Every row carries a repo and a snapshot commit. A stage never assumes it is looking at the newest snapshot: the bonus is the same stage run on two.
  • No language or project names in the engine. tests/test_engine_neutral.py fails if one appears in src/codexray/**/*.py or *.sql. Put it in a settings file.
  • Same input, same output. Sort everything you write. No clock time, no random order, no absolute paths in output.
  • State the limits, report what is healthy, blame no one, never guess AI authorship. The label for code without an explicit marker is "no AI signal".

Choices the scaffold made that the spec does not

These were needed to make the pieces fit. Each is open to change by the lanes it affects.

  1. Finding the run. codexray ingest records the run in runs/<repo_id>/CURRENT; later commands take --repo <id> and read it.
  2. params_hash and the rules file. Rules are written after ingest, so params_hash covers only the git flags, tool and grammar versions and settings, and reviewing a rule does not move the run. The rules file has its own rules_hash (runs.compute_rules_hash), recorded in the manifest and part of the cache key of anything that depends on rules. Recorded in spec.md §4.3.
  3. Repo ids are short lower-case names (artemis), set in repos.yaml or with ingest --id; the full name (ls1intum/Artemis) is the repo field in records.
  4. Timestamps are stored as UTC without a zone, so they print the same everywhere.
  5. Tables beyond spec.md §5.8 and §6.2: blobs_read, links, parse_coverage, candidate_findings, yardsticks, module_order.
  6. The web bundle is index.json, findings.json, decisions.json and map.json. Only the finding record is fixed by the spec; the rest is a first draft for the report and web lanes to settle. Code slices for the code pane are not in it yet.
  7. Web navigation has seven tabs per repository: Overview, Decisions, Findings, Map, Change, Trust and Size. A finding opens on its own page from the Findings tab, and the Map shows a finding or its simulated fix from a link on that page. The routes are in web/src/App.tsx and the screens in web/src/routes/.
  8. Python 3.12, pinned in .python-version, because every dependency has ready-built packages for it.

Design

The visual direction for the web app is in .impeccable/surfaces/prototype-codexray-demo.md. The clickable prototype is at https://claude.ai/artifact/LmwJSrUkE3Bf1PPdTEHxVU (ask Pranav to share it with you). PRODUCT.md says who the app is for and how it should speak.