diff --git a/.changeset/review-bot-config.md b/.changeset/review-bot-config.md new file mode 100644 index 000000000..d56f40ee0 --- /dev/null +++ b/.changeset/review-bot-config.md @@ -0,0 +1,9 @@ +--- +--- +chore(review): give the review bots the plan and put the rules where they are free + +`docs/rewrite/plan.md` states the goal, the four cutover gates and the capabilities deliberately +out of scope until cutover; both bots are pointed at it, so an absent post-v4 capability reads as +out of scope rather than as a defect. The rules themselves live in `.greptile/`, five entries each +carrying the evidence for it and the event that retires it, and `.coderabbit.yaml` is kept to a +quiet profile and path instructions with no rule list of its own. diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 000000000..1b539028c --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,51 @@ +# CodeRabbit: the second opinion, not the rule book. +# Rules live in `.greptile/` and only there; see `.greptile/README.md` for why. +language: en-US + +reviews: + # CodeRabbit skips any base branch but the default one by default, which is why every pull + # request into rewrite/main got "Review skipped". Name the base explicitly. + auto_review: + enabled: true + base_branches: + - "rewrite/main" + + # `quiet` keeps the inline comments to what matters and groups the rest in the summary. + # Raise to `chill` only if a class of defect starts getting through. + profile: quiet + sequence_diagrams: false + estimate_code_review_effort: false + in_progress_fortune: false + + path_instructions: + - path: "**" + instructions: | + Read `docs/rewrite/plan.md` first. It states the goal, the four cutover gates and the + capabilities deliberately out of scope until cutover: the absence of one of those is + not a finding, and a pull request adding one is out of scope for this branch. The base + branch is `rewrite/main`, not the default branch, so a missing `Closes #N` is not a + defect here. + - path: "docs/**" + instructions: | + Prose, ADRs and runbooks. Do not ask for tests, coverage or a changelog entry on a + documentation-only change. Check two things instead: that every measurement names the + commit it was taken at, and that every command quoted exists in this repository as + written. + + - path: ".changeset/**" + instructions: | + Every pull request into `rewrite/main` carries exactly one changeset whose frontmatter + is empty on purpose; the prose below it is the release note. Do not flag the empty + frontmatter and do not ask for a version bump. + + - path: "crates/nostream-admin/**" + instructions: | + Read `docs/rewrite/decisions/0014-admin-http-surface.md` before commenting on this + crate. Files the daemon creates under a config directory are 0600 at creation and after + a rename, and any compaction staging file is pid-scoped. + + - path: "crates/nostream-*/**" + instructions: | + The base branch is `rewrite/main`, not the default branch, so a missing `Closes #N` is + not a defect here: issues are closed by hand after merge. `CLAUDE.md` holds the + validation commands; a pull request is expected to quote their real output. diff --git a/.greptile/README.md b/.greptile/README.md new file mode 100644 index 000000000..28d0a54de --- /dev/null +++ b/.greptile/README.md @@ -0,0 +1,43 @@ +# Review rules: where they live and how they die + +Two review bots run on every pull request into this repository. This folder configures one of +them (Greptile); `.coderabbit.yaml` at the root configures the other. + +**The rules belong to the bots, not to us.** A rule in this folder costs a Greptile token, not +one of ours, and a rule that stops earning its place can be switched off without touching code. + +## The four entries in `config.json` + +| id | severity | evidence it exists | retire when | +|---|---|---|---| +| `closing-keyword-inert` | low | #1328 and #1187 were both fixed by merged PRs and stayed open, because `Closes` does nothing against a non-default base | the repository starts merging into a default branch | +| `changeset-empty-frontmatter` | low | every PR into `rewrite/main` carries one empty changeset; `CLAUDE.md` states the rule and `Changeset Required` enforces it | the release plan starts deriving versions from changeset frontmatter | +| `docs-need-no-tests` | low | docs PRs (#1338, #1359, this one) drew test-coverage findings for prose | a docs change starts shipping executable code | +| `config-files-0600` | high | #1187 (audit log created 0644) and its fix #1365, plus `crates/nostream-config/src/store.rs` | the daemon stops writing under a config directory | + +## Adding an entry + +Only when the same class of finding has reached us **three times** and is not already enforced by +a test, a linter or a CI gate. The entry must name, in this table, the evidence for it and the +event that deletes it. A rule with no retire condition does not go in. + +## Removing an entry + +Delete its object from `config.json` and its row from this table in the same commit. To withdraw a +rule for one directory while keeping it everywhere else, add its `id` to that directory's +`disabledRules` in a nested `.greptile/config.json`; every rule here has an `id` for that reason. + +## What is not here + +Dashboard rules live in the Greptile app, not in this repository, and cannot be reviewed or +deleted from here. Export them from the review settings page when auditing, or they stay invisible. + +CodeRabbit's rules live in `.coderabbit.yaml`. It is deliberately kept to a profile and path +instructions, with no rule list of its own: the same rule in two prompts doubles the noise rather +than the coverage. + +## Removed + +| id | why it went | when | +|---|---|---| +| `unwrap-in-tests` | Never earned its place: no repeated finding motivated it, and the clippy gate already fails a test file that lacks an allowance, so the rule could only suppress a true positive or argue about where the allowance lives. Two review rounds on it, both of them arguing about Rust lint scope rather than about the code. | 2026-12-04, on its own pull request | diff --git a/.greptile/config.json b/.greptile/config.json new file mode 100644 index 000000000..d8d50953a --- /dev/null +++ b/.greptile/config.json @@ -0,0 +1,41 @@ +{ + "commentTypes": [ + "logic", + "syntax" + ], + "instructions": "Read `docs/rewrite/plan.md` before judging scope: it states the goal, the four cutover gates and the capabilities deliberately out of scope until cutover, so the absence of one of those is not a finding. This repository merges into `rewrite/main`, a non-default branch, and a PR into it carries one empty changeset. For every finding, state the consequence if it is left unaddressed. When a decision record constrains the code, cite it by number from docs/rewrite/decisions/. Do not report the absence of a changelog entry: a changeset is the record here. Do not flag missing issue-closing keywords: `Closes` is inert against this base and issues are closed by hand after merge.", + "rules": [ + { + "id": "closing-keyword-inert", + "rule": "`Closes`/`Fixes` does not close an issue when the PR base is not the default branch. This repository merges into `rewrite/main`; the issue stays open until someone closes it by hand with the merge sha. Do not report a missing closing keyword, a missing linked issue, or an unaddressed issue for that reason.", + "severity": "low" + }, + { + "id": "changeset-empty-frontmatter", + "rule": "Every PR into `rewrite/main` carries exactly one changeset whose frontmatter is empty; the prose below it is the release note and the frontmatter stays empty on purpose, including for a Rust-only change. Do not flag the empty frontmatter and do not ask for a version bump.", + "scope": [ + ".changeset/**" + ], + "severity": "low" + }, + { + "id": "docs-need-no-tests", + "rule": "A diff that adds no executable code needs no test, no coverage and no new dependency. Do not ask for one on a documentation, ADR or changeset-only change.", + "scope": [ + "docs/**", + ".changeset/**", + "**/*.md" + ], + "severity": "low" + }, + { + "id": "config-files-0600", + "rule": "Files this daemon creates under a config directory \u2014 settings, audit logs and their compaction staging files \u2014 must be created mode 0600 and must still be 0600 after a rename, and a staging file's name must be pid-scoped. Flag any create, append or replace path that does not.", + "scope": [ + "crates/nostream-admin/**", + "crates/nostream-config/**" + ], + "severity": "high" + } + ] +} diff --git a/.greptile/files.json b/.greptile/files.json new file mode 100644 index 000000000..22fd5226a --- /dev/null +++ b/.greptile/files.json @@ -0,0 +1,34 @@ +{ + "files": [ + { + "path": "docs/rewrite/plan.md", + "description": "The stable plan: the goal, the four cutover gates, and the capabilities deliberately out of scope until the flag flips. A pull request that adds one of those before cutover is out of scope for review, not a defect for its absence." + }, + { + "path": "CLAUDE.md", + "description": "How work is done on rewrite/main: the one-empty-changeset rule, the exact validation commands, and the conventions an agent gets wrong. Treat it as the project's own instruction sheet." + }, + { + "path": "docs/rewrite/crate-map.md", + "description": "Which crate owns which surface of the rewrite, and where each v3 module landed.", + "scope": [ + "crates/**" + ] + }, + { + "path": "docs/rewrite/decisions/0014-admin-http-surface.md", + "description": "Decision record for the admin HTTP surface, including the audit log's append and compaction behaviour (D2, D9, D16).", + "scope": [ + "crates/nostream-admin/**" + ] + }, + { + "path": "docs/rewrite/decisions/0011-lmdb-backend.md", + "description": "Decision record for the LMDB backend and the storage seam.", + "scope": [ + "crates/nostream-storage/**", + "crates/nostream-core/**" + ] + } + ] +} diff --git a/docs/rewrite/plan.md b/docs/rewrite/plan.md new file mode 100644 index 000000000..66486f237 --- /dev/null +++ b/docs/rewrite/plan.md @@ -0,0 +1,72 @@ +# Plan: the rewrite, the cutover, and what waits + +This is the stable half of the plan, written for a reader who is reviewing a pull request and +needs to know what the change is *for*. The daily half lives on the trackers named at the +bottom; nothing that changes week to week belongs in this file. + +## The goal + +`rewrite/main` is the Rust relay that replaces the TypeScript one **in place, crate by crate**. +It takes over on **1 January 2027**. From that date new features ship here only. `v3` receives +security and bug fixes until **30 June 2027**, then retires. The website is not part of this and +does not move. + +Both lines live in one tree until cutover: `src/` is v3 TypeScript, `crates/` is v4 Rust, and +they are separate pipelines. A change to one is not a change to the other. + +## What "done" means + +Cutover is a checklist, not a date. Four gates decide it, and a pull request that weakens one of +them is a regression even when its tests pass: + +1. **The NIP ledger is complete.** Every advertised NIP is `ported` with a Rust test and a + recorded inversion. The ledger and its readings are in [`nip-porting.md`](nip-porting.md); + the rule that keeps it honest is in [`kpis.md`](kpis.md) §1. +2. **The differential harness runs clean.** Both relays side by side on the production corpus + snapshot for 48 hours with zero divergences. Divergence here is a finding, not flakiness. +3. **The PG→LMDB migration is gated by checksums.** The migration is the offline step of the + cutover and its checksum gate must match a production-corpus snapshot; see + [`migrating.md`](migrating.md) and [ADR 0013](decisions/0013-pg-to-lmdb-migration.md). +4. **Release packaging exists.** `nostreamd` image, the release workflow, and a recorded decision + on how release notes are produced. + +The cutover checklist itself is [cameri/nostream#869](https://github.com/cameri/nostream/issues/869). + +## What is deliberately out of scope until after cutover + +A capability in this list is **not a defect for its absence**, and a pull request that adds one +before the flag flips is out of scope for review: + +- the operator write-policy plugin surface (strfry's sifter) — [#1373](https://github.com/cameri/nostream/issues/1373) +- relay-to-relay tooling: sync, stream, router, export — [#1374](https://github.com/cameri/nostream/issues/1374) +- zero-downtime restart and hot config reload — [#1375](https://github.com/cameri/nostream/issues/1375) +- LMDB compaction, filter-addressed delete, dictionary compression — [#1376](https://github.com/cameri/nostream/issues/1376) + +Row [#1371](https://github.com/cameri/nostream/issues/1371) audits the v3 commits that have not +been ported; its verdicts are the authority on whether a v3 behaviour is missing or obsolete. + +## What the reader should not assume + +- The default branch is not what this work merges into. `rewrite/main` is the base, `Closes #N` + is inert against it, and an issue stays open after merge until someone closes it by hand. +- A missing feature is not automatically a gap: some v3 behaviours were deliberately not carried + over, and the decision records under [`decisions/`](decisions/) say why. +- The phase plan and the daily queue are written elsewhere and move constantly. If a change + looks out of order, check the trackers rather than this file. + +## Where the live plan is + +| what | where | +|---|---| +| cutover checklist and its gates | [#869](https://github.com/cameri/nostream/issues/869) | +| what the factory is building this week | [#122](https://github.com/cameri/phoenix-server/issues/122) | +| demand and the ranked backlog | [#123](https://github.com/cameri/phoenix-server/issues/123) | +| the numbers and the thresholds that fire | [`kpis.md`](kpis.md) | +| architecture decisions, one file each | [`decisions/`](decisions/) | +| crate ownership and what landed where | [`crate-map.md`](crate-map.md) | + +## Maintenance + +This file changes only when a date, a gate or the out-of-scope list changes. If it goes stale, +regenerate it from #869 and delete the parts that are no longer true — a plan a reviewer cites +must be one someone would defend.