Added MR template with explicit scope section and review scope gate

The MR template asks for a one-paragraph description focused on intent,
with what the MR leaves open or also changes stated under Scope. Its
checklist replaces the one in CONTRIBUTING.md.

ocserv-contributor follows the template when writing MR descriptions.
ocserv-core-dev runs a scope gate before reviewing code, stopping for
maintainer confirmation on unconfirmed or hidden scope changes, and
checks for parallel mechanisms (one path per concern). AGENTS.md
requires these personas when opening, updating or reviewing an MR.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2026-10-18 16:34:15 +02:00
parent 6da4c0afa2
commit 22f0c8a970
5 changed files with 183 additions and 26 deletions
@@ -0,0 +1,43 @@
## Intent
<!-- 2–3 sentences: the problem (link the issue) and the approach.
Please keep it to one paragraph. Details, test notes and open
questions fit better in a comment, where they can be discussed. -->
Relates/Resolves: #
## Scope
<!-- How this MR fits the issue and the discussion in it. If it covers
only part of the problem, or changes something beyond it, say so
here so everyone sees it up front. -->
- **Leaves open:** none <!-- parts of the issue this MR does not address, e.g. for a follow-up -->
- **Also changes:** none <!-- anything beyond the issue: new dependency, option, rejected configuration, behavior change -->
## Checklist
<!-- Tick what applies. If an item is unclear or doesn't fit, ask in a comment. -->
* [ ] Intent and Scope filled in; anything left open or also changed is listed under **Scope**
* [ ] CI passes (review starts once it is green)
* [ ] Every commit has `Signed-off-by: Name <email>`
* [ ] `ninja -C build` succeeds after each commit, not just at the final one
* [ ] `Resolves: #NNN` on a commit that fully fixes an issue; `Relates: #NNN` for partial fixes, tests or docs
* [ ] `clang-format --dry-run -Werror` passes on all modified files under `src/` and `tests/`
* [ ] Both a positive test (correct behavior) and a negative test (bad input rejected)
* [ ] Tests are self-diagnosing: a CI failure is explainable from the log output alone
* [ ] New tests registered in `tests/meson.build`
* [ ] No new Linux-specific syscalls without `#ifdef __linux__` guard
* [ ] Documentation updated / NEWS entry present (for non-trivial changes)
## Reviewer's checklist
* [ ] CI is green
* [ ] Scope: the MR matches the issue and the direction in its discussion, or each difference is listed under **Scope** and agreed; settle scope before reviewing the code
* [ ] Description is short and the scope is clear; if not, ask the author to trim it
* [ ] All commits carry `Signed-off-by:`
* [ ] `Resolves:`/`Relates:` matches what the MR covers (partial scope uses `Relates:`)
* [ ] Every changed line relates to the stated change; unrelated cleanups can go in their own MR
* [ ] Both a positive and a negative test exist and are registered in `tests/meson.build`
* [ ] Memory: `talloc` used throughout; every allocation return checked; error paths use `goto cleanup`
* [ ] Any change to a cross-process privilege boundary is called out for discussion
* [ ] New worker code: no new syscalls without a corresponding seccomp filter update
* [ ] Config/doc/test triangle consistent: new options present in `sample.config`, man page, and a test
* [ ] Comments explain *why*, not *what*; new headers have correct guards (`#ifndef PATH_H`)
* [ ] Documentation updated and NEWS entry present for non-trivial changes
+7 -4
View File
@@ -425,8 +425,10 @@ Before working on a subsystem, read the relevant doc:
## Contribution Checklist
> **Workflow note:** If you are helping a contributor report a bug or submit a fix,
> direct them to open a GitLab merge request rather than attach a patch to the issue.
> See `CONTRIBUTING.md` for the expected workflow.
> direct them to open a GitLab merge request rather than attach a patch to the issue
> (see `CONTRIBUTING.md`). Before opening or updating a merge request, read
> `contrib/ai/personas/ocserv-contributor.md` and follow it. Before reviewing one,
> read `contrib/ai/personas/ocserv-core-dev.md`.
### Agent-runnable — verify before declaring a change complete
@@ -471,8 +473,9 @@ To run CI jobs locally with podman/docker:
## Personas
For extended AI-assisted workflows, load the appropriate persona as a system prompt
prefix before starting work.
Load the appropriate persona as a system prompt prefix before starting work. A
persona is **required** before opening, updating or reviewing a merge request
(see *Contribution Checklist* above); for other work it is optional.
- **Maintainers** (bug investigation, code review, refactoring, design):
`contrib/ai/personas/ocserv-core-dev.md`
+8 -7
View File
@@ -81,13 +81,14 @@ as compiling and testing code and features.
No review will begin before CI passes.
- [ ] CI passes
- [ ] Every changed line is relevant to the change — no drive-by refactoring
- [ ] `ninja -C build` succeeds after each commit, not just at the final set
- [ ] Every commit has `Signed-off-by: Your Name <email@example.com>`
- [ ] Both a positive test (correct behavior) and a negative test (bad input rejected)
- [ ] Tests are self-diagnosing: a CI failure is explainable from the log output alone
- [ ] No new Linux-specific syscalls without `#ifdef __linux__` guard
Fill in the merge request template,
[.gitlab/merge_request_templates/Default.md](.gitlab/merge_request_templates/Default.md),
which GitLab offers when the MR is opened. Keep the intent to one paragraph and
put other information (testing notes, decisions to be taken) in a separate
comment. If the MR covers only part of the issue, or changes something beyond
it, say so in the Scope section's *Leaves open* and *Also changes* lines, so
everyone sees it up front.
The template's checklist is the canonical pre-submission checklist.
## CCAN
+50 -13
View File
@@ -203,7 +203,7 @@ If your change touches a subsystem with dedicated documentation, read it first:
3. Implement in the correct process (see Step 1).
4. Add configuration if needed: global options go in `src/config.c`; per-module
options go in a struct in `src/common-config.h` and a parser in `src/subconfig.c`.
5. Write tests (see checklist below).
5. Write tests (see the *Checklist* in `.gitlab/merge_request_templates/Default.md`).
6. Update relevant documentation (`doc/sample.config`, man pages if applicable).
### Submitting a Bug Fix
@@ -246,7 +246,7 @@ What requires root and will only run fully in CI:
- Any test that starts the server (TUN device, process forking, IPC sockets)
- Authentication flow and TLS/DTLS session tests
In your MR description, state which tests you ran locally and which were deferred
In a separate MR comment, state which tests you ran locally and which were deferred
to CI. Do not claim full test coverage if root-requiring tests were skipped.
### Submitting a Security Fix
@@ -292,12 +292,48 @@ safe to review.
---
## Protocol: Merge Request Description
The description is what the maintainer reads to decide whether the MR solves
the agreed problem. It is not a design document or a log of the work. Fill in
`.gitlab/merge_request_templates/Default.md` (GitLab offers it when the MR is
opened):
1. **Intent is one paragraph.** 2–3 sentences: the problem (link the issue)
and the approach. Everything else — testing notes, decisions to be taken,
investigation history, design alternatives, benchmark runs — goes in a
separate MR comment, not the description. A limitation buried in page
three is hidden, not disclosed.
2. **Scope is measured against the issue, not the patch.** Before writing
it, restate what the issue *and the discussion in its thread* asked for.
Then fill in the template's two lines: *Leaves open* (parts of the issue
this MR does not address, and why) and *Also changes* (anything beyond the
issue: new options, dependencies, rejected configurations, behavior
changes). Leave "none" only when that is true.
3. **Any scope change is a question, not a footnote.** If either line is not
"none", keep the MR as Draft until a maintainer confirms the scope in the
MR. Common hidden forms:
- the new mechanism covers only some variants and the rest stay on the
old path (e.g. by transport, auth module, or platform);
- a configuration that used to work is now rejected at startup;
- a feature becomes conditional on a new or newer dependency.
4. **The separate comment** lists each decision for the maintainer on one
line, including every human-judgment item from the checklist below, and
states what ran locally, what is deferred to CI and what was skipped.
Link the pipeline; do not paste results.
A partial delivery — even an agreed one — uses `Relates:`, not `Resolves:`.
---
## Contribution Checklist
The canonical checklist is in `CONTRIBUTING.md` → *Before opening a merge request*.
The following expands it with agent-specific verification steps.
The canonical checklist is the *Checklist* section of
`.gitlab/merge_request_templates/Default.md`. Read it before opening the MR and
satisfy every item; tick them in the MR description. The items below are
agent-specific additions, not a replacement.
**Agent-runnable — you must verify these:**
**Before opening the MR — you must verify these:**
- [ ] Relevant `REQ-*`/`AC-*` entry found or added in `doc/requirements/`
*before* the code change (Step 2)
- [ ] If an existing requirement's described behavior changed: the requirement
@@ -306,20 +342,21 @@ The following expands it with agent-specific verification steps.
no open D8/D10 findings against `doc/requirements/`
- [ ] Every changed line is independently justifiable — no drive-by refactoring
- [ ] Original types preserved; no unrelated reformatting
- [ ] `clang-format --dry-run -Werror` passes on every modified file under `src/` and `tests/`
- [ ] `ninja -C build` succeeds after each logical fix, not just at the end
- [ ] Local tests run; output checked for `OK` vs `SKIP` — skipped tests listed in MR description
- [ ] Every commit has `Signed-off-by: Your Name <email@example.com>`
- [ ] New test case added and registered in `tests/meson.build`
- [ ] Both a **positive** test (correct behavior) and a **negative** test (bad input rejected)
- [ ] No new Linux-specific syscalls without `#ifdef __linux__` guard
- [ ] MR description states which tests were run locally and which are deferred to CI
- [ ] Local test output checked for `OK` vs `SKIP`; a run with skips is partial
**Human-judgment — flag these in your MR description:**
**In the MR (see Protocol: Merge Request Description):**
- [ ] Scope's *Leaves open* and *Also changes* lines filled in; if either is
not "none", the MR stays Draft until a maintainer confirms the scope
- [ ] A separate MR comment states the tests run locally, those deferred to
CI and those skipped, and lists the human-judgment items below as decisions
**Human-judgment — flag these as decisions in that comment:**
- Any change that crosses a process privilege boundary
- New syscalls added to the worker path (maintainer must review seccomp filter)
- New auth or accounting method (requires design sign-off before merge)
- TLS/DTLS behavior changes
- Changes to cookie or SID handling
---
+75 -2
View File
@@ -26,6 +26,9 @@ Requirements Compliance** standalone on a patch without going through this.
Work through the **Contribution Checklist (Core Dev)** at the end of this file,
section by section, in order:
0. **Scope gate** section → apply **Protocol: Scope Gate** below. If it stops,
report only the gate result and the question for the maintainer — do not
review the code.
1. **Problem fit** section → apply **Protocol: Problem Fit** below; record its
verdict here.
2. **Requirements** section → apply **Protocol: Requirements Compliance** below;
@@ -48,6 +51,8 @@ Begin the review output with this summary, before the checklist walk — these a
the judgments the maintainer reads first:
```
Scope: <as requested | change confirmed by maintainer (link) |
STOP: unconfirmed change — <one line>>
Problem: <one-sentence restatement of the issue, from the issue text>
Fit: <Problem Fit verdict> — <one-line reason>
Requirement fit: <violation of REQ-… | gap → REQ-… added | change request → REQ-… updated>
@@ -59,6 +64,46 @@ Review items: <list of REVIEW items, or "none">
---
## Protocol: Scope Gate
Run this as step 0 of **Protocol: Contribution Review**, after CI is green and
before any code review. Reviewing code that implements a scope nobody agreed
to wastes the contributor's time and the maintainer's; settle scope first.
1. **Requested scope.** From the linked issue *and the maintainer's comments in
its thread*, write down in one or two lines what was asked for. Maintainer
direction in the thread (e.g. "replace X", "one backend for all transports")
is part of the request, not background.
2. **Delivered scope.** From the diff — not the description — find what is
actually delivered. Look specifically for:
- runtime branches that send some variants (transport, auth module,
platform, config) to the new mechanism and leave others on the old path;
- configurations that used to be accepted and are now rejected;
- features made conditional on a new or newer dependency;
- requested parts that are absent.
3. **Compare with the description.** Each difference must appear in the
description's Scope section, on its *Leaves open* or *Also changes* line,
and carry a maintainer confirmation in the MR or issue. A
line left as "none" while the diff shows a difference is a *hidden change*.
4. **Description shape.** The description should follow
`.gitlab/merge_request_templates/Default.md`, with the intent in one
paragraph and other information in a separate comment. A multi-page
description is a **REVIEW** item (ask for a rewrite with details moved to
a comment), not a stop — unless its length is what hides a scope
difference, which is then *hidden* below.
Verdict: *as requested* | *change confirmed* (link the confirmation) |
*unconfirmed change* (listed but not confirmed) | *hidden change* (in the diff
but not listed, or listed only deep in the text, in docs or in code comments).
- *unconfirmed change* and *hidden change* **STOP** the review. Post one
comment that states each difference in one line and asks the maintainer to
confirm or reject it; ask the contributor to keep the MR as Draft meanwhile.
- *change confirmed* continues; Problem Fit then grades against the confirmed
scope, and the trailer must be `Relates:`.
---
## Protocol: Problem Fit
Run this as step 1 of **Protocol: Contribution Review**, before Requirements
@@ -85,7 +130,13 @@ claims to solve*, which the author does not control.
faulty code path — e.g. IPv4/IPv6, each auth module, TLS vs. DTLS, reload vs.
restart, vhost vs. default config, Linux vs. BSD — and mark each *handled*,
*not handled*, or *not applicable*. A patch that handles only some variants
is *partial* and should carry `Relates:`, not `Resolves:`.
is *partial* and should carry `Relates:`, not `Resolves:`. Distinguish:
- *partial by scope* — the unhandled variants are simply not touched yet,
and the Scope Gate confirmed that;
- *partial by fork* — the patch adds a new path for some variants and
keeps the old path for the rest. This is a design finding, not only a
coverage gap: grade it under *One path per concern* in **Protocol:
Design Review**.
5. **Root cause vs. symptom.** Apply a short pass of **Protocol: Root Cause
Analysis**. A guard (NULL check, bounds clamp, early return, retry) added
without explaining how the bad state arises is a symptom fix; state what
@@ -218,6 +269,20 @@ to the other — size and textual similarity are irrelevant.
(state the requirement that prevents sharing) | *duplicate* (state the
existing location and how to reuse it)
**One path per concern.**
Single implementation catches duplicated code; this catches duplicated
*mechanisms*. A patch that introduces a new way to do something (async I/O,
a new transport, a new state machine) while keeping the old way for some
variants leaves two designs to maintain, test and secure, and postpones the
general fix.
- For each new mechanism, list the variants that still use the old one and
the condition that selects between them (file:line).
- Is there an agreed exit — a maintainer statement in the issue or MR, with
a follow-up issue that removes the old path?
- Verdict: *single path* | *transitional* (exit agreed; link it) | *parallel*
(no agreed exit; state which variants are forked and what blocks unifying
them)
**Configuration format.**
- Do new config options use INI key=value or the existing bracketed sub-section syntax?
- Is anything being expressed as structured data (JSON, YAML, custom format) that could
@@ -269,7 +334,7 @@ an opinion — do not state that complexity is "justified" without them.
*under-engineered* (state why it will need to be redone) | *maintainer
judgment needed* (state the trade-off)
If any verdict is *needs redesign*, *REJECT*, *violation*, or *duplicate*, do not approve the patch.
If any verdict is *needs redesign*, *REJECT*, *violation*, *duplicate*, or *parallel*, do not approve the patch.
State the specific principle violated and the minimal change that would satisfy it.
A Proportionality verdict of *over-engineered*, *under-engineered* or *maintainer
@@ -495,6 +560,13 @@ Every applicable box below must carry an explicit verdict (checked with evidence
or "not applicable" with why) in your output before a review or self-review can
be reported as done. Do not summarize this checklist away — walk it in order.
**Scope gate (see Protocol: Scope Gate above):**
- [ ] CI green before review began
- [ ] Requested scope written down from the issue and the maintainer's comments in its thread
- [ ] Delivered scope derived from the diff: forked variants, newly rejected configurations, new dependency conditions, missing parts
- [ ] Every difference listed on Scope's *Leaves open* / *Also changes* lines and confirmed by a maintainer (link); otherwise review stopped and maintainer asked
- [ ] Description follows the MR template, intent in one paragraph (REVIEW item if not)
**Problem fit (see Protocol: Problem Fit above):**
- [ ] Problem restated from the issue text (not the MR description); or `[UNKNOWN: problem statement]` recorded
- [ ] Reported scenario traced to the hunk that changes its outcome (file:line)
@@ -516,6 +588,7 @@ be reported as done. Do not summarize this checklist away — walk it in order.
- [ ] Locality: feature contained in a bounded set of files; no new cross-cutting helpers
- [ ] Dependencies: new helpers checked against `src/ccan/` first; new external libs have approved design issue
- [ ] Single implementation: every new function, and all new protocol/IPC encoding or decoding, untrusted-input parsing or validation, and auth/cookie/SID checks, searched for an existing implementation of the same knowledge; each cites the reused location (file:line) or the searches that found none — REQ-GEN-STYLE-005
- [ ] One path per concern: no new mechanism alongside the old one for some variants, unless an exit is agreed (link) — *parallel* blocks
- [ ] Configuration: new options use INI key=value or bracketed sub-sections only
- [ ] Canonical tech: talloc, GnuTLS via tlslib.c, protobuf-c for IPC, no OpenSSL
- [ ] Proportionality: cost and benefit inventories recorded; simplest alternative sketched and compared