Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ third_party/sashiko/
third_party/gcc/
third_party/qemu/
third_party/e2fsprogs/
third_party/llvm/
benchmarks/runs/
benchmark_results.json
*.db
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ third_party/sashiko/
third_party/gcc/
third_party/qemu/
third_party/e2fsprogs/
third_party/llvm/
benchmarks/runs/
review_trees/
sashiko.log
Expand Down
5 changes: 3 additions & 2 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Sashiko reviews changes to its own repository using the `--project sashiko` prof
- `benchmark.rs`: Built-in benchmark runner, per-run database/artifact preservation, and structured AI judge telemetry (`#[cfg(feature = "server")]`).
- `worker/`: Background workers (`bug_worker.rs`, `email.rs`, `forge.rs`, `patchwork.rs`, `repack.rs`, `sync.rs`, `prefetch.rs`, `prompts.rs`).
- `workflow/`: Core state-machine LLM workflow engine.
- `workflows/`: Declarative review, bug, and scan pipelines per project (`linux_patch_review.rs`, `linux_bug.rs`, `linux_scan.rs`, `sashiko_patch_review.rs`, `gcc_patch_review.rs`, `qemu_patch_review.rs`, `zephyr_patch_review.rs`, `e2fsprogs_patch_review.rs`), prior-version feedback auditing (`prior_feedback.rs`), shared security/normalization helpers (`guard.rs`), and the review-map lineage builder (`review_map.rs`).
- `workflows/`: Declarative review, bug, and scan pipelines per project (`linux_patch_review.rs`, `linux_bug.rs`, `linux_scan.rs`, `sashiko_patch_review.rs`, `gcc_patch_review.rs`, `qemu_patch_review.rs`, `zephyr_patch_review.rs`, `e2fsprogs_patch_review.rs`, `llvm_patch_review.rs`), prior-version feedback auditing (`prior_feedback.rs`), shared security/normalization helpers (`guard.rs`), and the review-map lineage builder (`review_map.rs`).
- `authority.rs` & `prior_context.rs`: Programmatic contributor social score engine (`ContributorAuthority`) and transport-agnostic ancestor feedback context (`PriorVersionContext`).
- `toolbox/`: Agent tools for inspecting git repositories and worktrees.
- `ai/`: LLM provider integrations, session runner, and response caching.
Expand All @@ -75,7 +75,7 @@ Sashiko reviews changes to its own repository using the `--project sashiko` prof
- `api.rs`: Shared HTTP protocol request/response types (unconditional).
- `server.rs`: Axum HTTP API server handlers (`#[cfg(feature = "server")]`).
- `settings.rs`: Application settings and ACL configuration.
- `project.rs` & `prompt_bundle.rs`: Target project profiles (`linux`, `sashiko`, `gcc`, `qemu`, `zephyr`, `e2fsprogs`) and prompt bundle loading.
- `project.rs` & `prompt_bundle.rs`: Target project profiles (`linux`, `sashiko`, `gcc`, `qemu`, `zephyr`, `e2fsprogs`, `llvm`) and prompt bundle loading.
- `events.rs`, `metrics.rs`, `logging.rs`, `compression.rs`, `utils.rs`: Internal event bus, metrics, logging, and utilities.

## Cargo Feature Profiles
Expand All @@ -92,6 +92,7 @@ Sashiko reviews changes to its own repository using the `--project sashiko` prof
- `projects/qemu/prompts/`: QEMU pilot review prompts (`--project qemu`): review procedures (`*.md`) and maintainer notes (`maintainers/`); generated code notes (`notes/`) are not produced for QEMU yet.
- `projects/zephyr/prompts/`: Zephyr RTOS pilot review prompts (`--project zephyr`), laid out like the QEMU prompts; each rule cites the Zephyr document or source file it comes from. See `docs/zephyr-review.md`.
- `projects/e2fsprogs/prompts/`: The e2fsprogs review prompts (`--project e2fsprogs`): review procedures (`*.md`), maintainer notes (`maintainers/`), and code notes profile (`notes/`).
- `projects/llvm/prompts/`: LLVM/clang review prompts (`--project llvm`): review procedures (`*.md`) and maintainer notes (`maintainers/`); generated code notes (`notes/`) are not produced yet.
- `static/`: Web UI assets (`static/index.html`, images).
- `docs/`: User and operator documentation (`configuration.md`, `daemon.md`, `sashiko-cli.md`, `llm-providers.md`, `benchmarking.md`, `zephyr-review.md`, forge setup guides).
- `designs/`: Architecture and design documents.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The Linux kernel is Sashiko's primary focus and most mature target (`--project l
| **Sashiko** | `sashiko` | **Production** | [sashiko.sashiko.dev](https://sashiko.sashiko.dev) | Local review, GitHub pull requests, bug tracking |
| **QEMU** | `qemu` | **Pilot** | None | Local review, mailing lists (self-hosted) |
| **Zephyr RTOS** | `zephyr` | **Pilot** | None | Local review |
| **LLVM** | `llvm` | **Pilot** | None | Local review |

Compute infrastructure and LLM tokens for the public Sashiko instances are generously provided and funded by **Google**.

Expand Down Expand Up @@ -54,7 +55,7 @@ Gemini is used by default. For Claude, OpenAI-compatible endpoints, AWS Bedrock,

### 3. Review Your Patches

Run `sashiko review` from inside your Linux kernel checkout (or pass `--project <gcc|qemu|zephyr|sashiko>` in another supported repository):
Run `sashiko review` from inside your Linux kernel checkout (or pass `--project <gcc|qemu|zephyr|llvm|sashiko>` in another supported repository):

```bash
# Review the latest Linux kernel commit
Expand All @@ -67,7 +68,7 @@ sashiko review --report-preexisting
# Report only the one or two pre-existing bugs closely related to the change
sashiko review --report-related-preexisting [--related-preexisting-min-severity medium]

# Review commits in another supported project (gcc, qemu, zephyr, sashiko)
# Review commits in another supported project (gcc, qemu, zephyr, llvm, sashiko)
sashiko review --project gcc

# Continue a review cut short by a quota stop, a timeout or Ctrl-C
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Optional. Describes the project this configuration is for.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `kind` | string | -- | Project this file is for: `"linux"`, `"sashiko"`, `"gcc"`, `"qemu"`, or `"zephyr"`. When set, it is checked against the project selected by `--project` / `SASHIKO_PROJECT`, and a mismatch is an error. When absent, the file is accepted for any project. |
| `kind` | string | -- | Project this file is for: `"linux"`, `"sashiko"`, `"gcc"`, `"qemu"`, `"zephyr"`, `"e2fsprogs"`, or `"llvm"`. When set, it is checked against the project selected by `--project` / `SASHIKO_PROJECT`, and a mismatch is an error. When absent, the file is accepted for any project. |
| `name` | string | `""` | Display name shown in the web UI. |
| `description` | string | `""` | Optional instance note shown in the web UI About dialog (in addition to the standard Sashiko overview). |
| `domain` | string | `""` | Public hostname used to build links to the web UI in forge comments (`https://<domain>/#/patchset/...`). Falls back to `sashiko.sashiko.dev` when empty. |
Expand Down Expand Up @@ -442,7 +442,7 @@ pass.

### `[linux_bug]`

Controls pre-existing bug tracking and background analysis for the configured project (`linux`, `gcc`, `sashiko`, `qemu`, or `zephyr`).
Controls pre-existing bug tracking and background analysis for the configured project (`linux`, `gcc`, `sashiko`, `qemu`, `zephyr`, `e2fsprogs`, or `llvm`).
The section is also accepted as `[bugs]` (preferred for non-Linux configurations), and `fix_check_enabled` as
`verify_fixes`.
By default (`enabled = false`), pre-existing issues discovered during patch
Expand Down Expand Up @@ -703,7 +703,7 @@ startup reconciles stored access rows across existing bugs and patchsets.
| `ANTHROPIC_VERTEX_PROJECT_ID`, `GOOGLE_CLOUD_PROJECT` | GCP project ID for the Vertex AI provider, in that order. |
| `CLOUD_ML_REGION`, `GOOGLE_CLOUD_LOCATION` | GCP region for the Vertex AI provider, in that order. |
| `SASHIKO_CONFIG` | Settings file to read when `--settings` is not given. |
| `SASHIKO_PROJECT` | Project to review (`linux`, `sashiko`, `gcc`, `qemu` or `zephyr`), like `--project`. |
| `SASHIKO_PROJECT` | Project to review (`linux`, `sashiko`, `gcc`, `qemu`, `zephyr`, `e2fsprogs` or `llvm`), like `--project`. |
| `SASHIKO_SERVER` | Override daemon URL for CLI commands. |
| `SASHIKO__*` | Override any Settings.toml value (e.g. `SASHIKO__AI__PROVIDER`). |
| `SASHIKO__FORGE__WEBHOOK_SECRET` | Override webhook secret from Settings.toml. Avoids storing the secret on disk. |
Expand Down
13 changes: 13 additions & 0 deletions projects/llvm/mailing_lists.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Per-mailing-list configuration for LLVM (--project llvm).
# LLVM patches go through GitHub pull requests against llvm/llvm-project,
# and this initial support covers local review only, so no list is tracked
# and nothing is mailed.

[defaults]
track = false
embargo_hours = 0
reply_to = []
positive_review = "none"
mute_all = true
cc = []
ignored_emails = []
19 changes: 19 additions & 0 deletions projects/llvm/prompts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# LLVM Review Prompts

First-party prompts for Sashiko's LLVM patch review, used by the `llvm`
project profile (`--project llvm`). `build.rs` compiles this directory into
the prompt bundle under the `llvm/` namespace.

## Layout

| Path | Loaded by |
|---|---|
| `review-core.md` | Orientation: what LLVM is, which defect classes matter, and how to review compiler changes |
| `severity.md` | The verification stages |
| `false-positive-guide.md` | The verification stages |
| `inline-template.md` | The inline report stage |
| `maintainers/*.md` | Maintainer notes: review preferences and conventions of LLVM/clang maintainers, selected per patch by their `paths` and `symbols` (see `src/notes/maintainer_notes.rs`) |

These prompts carry review procedures and judgment, not volatile codebase
facts: what the code does and must preserve comes from the tree the patch is
applied to. Generated code notes (`notes/`) are not produced for LLVM yet.
64 changes: 64 additions & 0 deletions projects/llvm/prompts/false-positive-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# LLVM False Positive Prevention Guide

Check these conventions before validating a finding, so that real defects are
not rationalized away and non-bugs are not reported.

## 1. Patterns that are NOT bugs

1. **Invariants established immediately before the use**: an `assert()` or a
`cast<>` that is guaranteed by the preceding construction (a `dyn_cast`
that just succeeded, a `getType()` that was produced by the matching
builder call) is fine. Report it only if some input can reach the
assertion or the wrong cast from valid source.
2. **NFC and pure refactors**: commits that claim NFC do not need new tests
and do not need release notes. Only report a missing test when behaviour
changes.
3. **Release notes**: clang asks for a release note for user-visible changes
(new diagnostic, accepted/rejected code, new flag). Do not ask for one for
internal refactoring, test-only changes or fixes of a crash that produced
no output change.
4. **Formatting, naming, include order**: enforced by CI and local style.
Never report these as findings.
5. **Test inputs**: `clang/test/**`, `llvm/test/**` files intentionally
contain invalid, weird or undefined constructs. Never report a defect
inside them; use them as documentation of the intended behaviour.
6. **`llvm_unreachable` in a fully handled switch**: unless a new enum
value or a new node kind makes it reachable, that is a design decision,
not a bug.
7. **Language extensions and target-specific behaviour**: clang implements C
and C++ plus documented extensions (C23, `-ffixed-point`, `_BitInt`,
HLSL, OpenCL, CUDA). Behaviour that differs from the ISO text only where
the extension says so is not a bug.
8. **Existing upstream behaviour**: a defect that predates the patch is not a
regression of this patch, so do not report it as one. Do not drop it either:
if the patch touches the code or its immediate callers and the defect is
real, report it with `"preexisting": true` so it is tracked separately from
the patch's own regressions.

## 2. Real bugs you must NOT dismiss

1. **The symmetric path is left unfixed**: clang usually has more than one
implementation of the same conversion (Sema vs CodeGen, classic CodeGen vs
CIR, constant evaluator vs runtime, C vs C++ frontend). If a patch fixes
one and misses its twin in the same change, that is a finding.
2. **Assertions versus release builds**: an assertion that fires from valid
code means release builds silently misbehave. Never dismiss it as "just a
debug assertion".
3. **`isBooleanType()` is not the whole story**: an enumeration with a fixed
`bool` underlying type converts like `bool` (C23 6.7.3.3p16) but is not
`isBooleanType()`. Any check that gates on `isBooleanType()` and drives a
conversion, a normalization or a fast path has to handle such enums too.
4. **Missing normalization after an operation**: a value of bool-like
representation must be renormalized after arithmetic. Fast paths
(`atomicrmw`, direct adds) that skip the conversion back through the bool
representation produce non-canonical objects that later reads or
`memcpy`/union access can observe.
5. **Sanitizers firing on defined code**: a UBSan/ASan check that fires on a
conversion the standard defines (for example converting any scalar to
`_Bool`) is itself the bug.
6. **Diagnostics on one language mode only**: a fix that works in C but not
in C++, or under `-fms-compatibility`, is incomplete unless the patch says
why.
7. **Duplicated or leftover code**: a call or state update moved under a
guard while the original unguarded call remains, or a fix applied to one
operator/overload and not its sibling, is a real bug.
40 changes: 40 additions & 0 deletions projects/llvm/prompts/inline-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Produce inline review comments suitable for a GitHub pull request on
`llvm/llvm-project`.

- The report is Markdown. Short fenced code blocks are fine; use only `###`
headings (no `#`, `##`, or `####` and deeper) and do not produce tables.
- Reference the code as `path:line` (for example
`clang/lib/Sema/SemaExpr.cpp:7933`) and quote only the lines that matter.
- Keep each comment to a few sentences: what is wrong, the input that
triggers it, and the suggested fix. Longer analysis belongs in the summary.
- Never include findings that were disproved as false positives.
- Use LLVM terminology (`CastKind`, `QualType`, `Sema`, `CodeGen`,
`llvm_unreachable`, `poison`, `undef`, `atomicrmw`, `FileCheck`,
`-verify`), and frame comments as technical observations, not as
accusations.
- Do not cite line numbers that the patch does not touch.
- Do not mention Sashiko or earlier automated reviews.

## Required structure

1. A one-paragraph summary: what the patch does, whether the approach is
sound, and how many findings follow.
2. One bullet per finding, most severe first:

```
- [Severity: <Critical|High|Medium|Low>] `path:line`: <one-line summary>
```

3. For every finding, an inline-style block:

```
[Severity: <Critical|High|Medium|Low>]
<What the code does now and what it should do. Include the smallest
reproducer (source + flags) and the expected vs actual behaviour, then
the suggested fix.>
```

4. If any finding has `"preexisting": true`, say explicitly at the start of
its comment that the problem was not introduced by this patch.
5. If nothing survived verification, end with a single sentence saying so and
do not pad the report.
16 changes: 16 additions & 0 deletions projects/llvm/prompts/maintainers/clang-frontend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
+++
title = "Clang Frontend (AST and Sema)"
paths = ["clang/lib/Sema/", "clang/lib/AST/", "clang/lib/Parse/", "clang/include/clang/AST/", "clang/include/clang/Sema/"]
symbols = ["Sema", "QualType", "CastKind"]
+++
# Clang Frontend: maintainer notes

Review guidance for patches touching clang parsing, the AST, and semantic
analysis.

- A conversion must pick the `CastKind` that matches the standard's wording for that source and destination type; `CK_IntegralCast` where a boolean normalization is required silently changes behaviour.
- An enumeration with a fixed underlying type (C23 6.7.3.3, C++11 `enum class` with a `bool` underlying type) converts like its underlying type even when `isBooleanType()` is false; any check gating a conversion, fast path, or normalization on `isBooleanType()` must account for it.
- After diagnosing, Sema recovers with an invalid type or expression rather than by stopping. Code that consumes a recovered expression must check `isInvalidType()` or `containsErrors()` before asserting on the type.
- A diagnostic emitted while forming a template argument or during deduction must go through the SFINAE-aware path: `Sema::Diag` inside an `SFINAETrap`, suppressed when `isSFINAEContext()` is true, or deferred as a `DelayedDiagnostic`. Reporting unconditionally turns a substitution failure into a hard error.
- CodeGen and CIR re-implement parts of the frontend's decisions. When a patch changes `ScalarExprEmitter`, `CGExprScalar`, `CIRGen`, or the constant evaluator, check the counterpart implementation for the same input.
- The `-verify` diagnostics tests assert the exact message text, location, and `expected-` annotation; a diagnostic change that does not update them fails the suite, and a test that only updates the text without adding the triggering case does not cover the new behaviour.
16 changes: 16 additions & 0 deletions projects/llvm/prompts/maintainers/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
+++
title = "General"
paths = ["*"]
symbols = []
+++
# General: maintainer notes

Generic code-quality, testing, and commit-message review guidance for
LLVM/clang changes.

- Do not flag formatting, naming, `const` placement, or include ordering: clang-format and the style guides cover them, and CI enforces them.
- Do not ask for a release note for internal refactoring, test-only changes, or a fix that produces no output change. Do ask for one when clang starts accepting or rejecting previously diagnosed code, gains a flag, or changes user-visible diagnostics.
- A change that fixes behaviour needs a regression test in the matching `test/` tree. Name the specific missing case instead of asking generically for tests.
- Keep one logical change per commit; call out unrelated refactoring mixed into a fix only when it obscures the fix or changes behaviour.
- Never suggest bypassing the verifier or the assertion infrastructure to make a test pass; assertions encode IR and AST invariants the rest of the compiler relies on.
- Check that the commit title and message describe the actual change, including the language mode or target it affects, and do not claim NFC when behaviour changes.
30 changes: 30 additions & 0 deletions projects/llvm/prompts/maintainers/llvm-backend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
+++
title = "LLVM Backend and Targets"
paths = ["llvm/lib/CodeGen/", "llvm/lib/Target/", "llvm/include/llvm/CodeGen/"]
symbols = ["SelectionDAG", "MachineInstr", "TargetLowering"]
+++
# LLVM Backend: maintainer notes

Review guidance for patches touching instruction selection, machine passes,
and target backends.

- A calling-convention, register-class, or ABI decision is mirrored in the
frontend, the target lowering, and the assembler/disassembler surfaces.
When a patch changes one, check whether the counterparts need the same
change; an ABI mismatch is user-visible and cannot be repaired by a later
pass.
- `TargetLowering` and TableGen lowering code may only assume a type is
legal, a value is in a register, or a node has the expected operand count
when a target hook (`isTypeLegal`, `hasOperation`, `allowsMemoryAccess`,
`shouldExpand*`) has established it for every subtarget the code can run
under.
- If a flag, target feature, or subtarget predicate gates an instruction
variant, the same predicate must gate every place that selection, assembly
printing, code emission, and optimization identity assume the variant.
- `MachineInstr` bundles, implicit operands, and physical-register liveness
are invariants of the machine scheduler and register allocator; a patch
that removes or rewrites an instruction must update `MachineRegisterInfo`
uses and defs and the `LiveIntervals`/`LivePhysRegs` state consistently.
- Do not flag a target-specific change because it does not apply to other
targets when the feature or instruction does not exist there; ask whether
the same source-level semantic must be preserved on every target instead.
Loading