From 695416ed01c7ccedfb72e6950d727a2780c2dd81 Mon Sep 17 00:00:00 2001 From: pctablet505 <55033230+pctablet505@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:49:20 +0530 Subject: [PATCH 1/3] ci(review): add core non-e2e CI gate, SHA-pin workflows, and add review rules - Create .github/workflows/ci.yml running all 35 non-e2e pytest modules (-n auto --maxprocesses=12) and strict mkdocs build on push/pull_request. - Pin all actions in .github/workflows/pages.yml to verified 40-char SHAs with persist-credentials: false on actions/checkout. - Add self-contained public AGENTS.md and append the three-stage Review & Verification Gate plus two-column Negative-Rule Ledger to CONTRIBUTING.md. --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++++++++ .github/workflows/pages.yml | 10 ++++++---- AGENTS.md | 29 ++++++++++++++++++++++++++++ CONTRIBUTING.md | 22 +++++++++++++++++++++ 4 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 AGENTS.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4254b58 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + test: + name: Core test suite & docs strict build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Python 3.12 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + + - name: Install package and dev dependencies + run: pip install -e ".[dev]" + + - name: Run non-e2e test suite + run: > + python -m pytest -q -n auto --maxprocesses=12 -p no:cacheprovider + --ignore=tests/test_e2e_real.py + --ignore=tests/test_app_e2e.py + --ignore=tests/test_control_e2e.py + --ignore=tests/test_gateway_e2e.py + + - name: Build documentation site (strict) + run: python -m mkdocs build --strict diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3d73cb5..422d7b4 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -32,8 +32,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 - - uses: actions/setup-python@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" - name: Install @@ -42,7 +44,7 @@ jobs: run: python -m pytest tests/test_site.py -q -rs -p no:cacheprovider - name: Build run: python -m mkdocs build --strict - - uses: actions/upload-pages-artifact@v5 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 if: github.event_name != 'pull_request' with: path: site @@ -59,4 +61,4 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment - uses: actions/deploy-pages@v5 + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f460c3a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,29 @@ +# ServeDeck — Agent & Contributor Card + +Self-contained working guide for automated coding and review agents operating on this public repository. Full ground rules, test discipline, and the two-pass review gate live in [CONTRIBUTING.md](CONTRIBUTING.md). + +## Key Commands + +- **Everyday non-e2e test suite (35 modules including `tests/test_hygiene.py` and `tests/test_site.py`; caps parallel workers at `12`):** + ```bash + python -m pytest -q -n auto --maxprocesses=12 -p no:cacheprovider \ + --ignore=tests/test_e2e_real.py \ + --ignore=tests/test_app_e2e.py \ + --ignore=tests/test_control_e2e.py \ + --ignore=tests/test_gateway_e2e.py + ``` +- **Documentation site strict build:** + ```bash + python -m mkdocs build --strict + ``` +- **CI workflows:** `.github/workflows/ci.yml` runs on every `push` to `main` and every `pull_request` (core non-e2e tests + `mkdocs build --strict`); `.github/workflows/pages.yml` builds and publishes the site with SHA-pinned GitHub Actions. + +## Non-Negotiable Invariants + +- **Never run `sudo`.** All control-plane operations use `systemctl --user` and `journalctl --user`. Where host-level privilege is needed, emit a copyable command for the operator. +- **Never use `pgrep -f` or `pkill -f`.** Enforced by AST scan in `tests/test_hygiene.py`. +- **Keep transient e2e units strictly under the `sd-test-` namespace.** Never start, stop, or mutate live `model-*` units from automated tests. +- **No host-specific paths, machine names, or hardcoded GPU sizes** in code or docs (`models.toml`, `servedeck/settings.py`, and `servedeck/limits.py` own machine config). Keep documentation free of user-specific home paths and scratch temp paths. +- **Measured vs. estimated numbers:** Label any derived value explicitly as estimated; every measured figure must cite a real log or live probe. +- **Review & proof discipline:** Every behavioral fix ships a regression test seen to fail before the fix (`fail-before` / mutant proof). Follow the author-blind two-pass review gate and `### Negative-Rule Ledger` in [CONTRIBUTING.md](CONTRIBUTING.md). +- **Commit identity:** Commit solely as the repository owner identity with explicit staged paths and zero `Co-Authored-By:` or AI attribution trailers. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27690e1..7bac2c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -92,3 +92,25 @@ as part of a normal check. How to contribute: [CONTRIBUTING.md](CONTRIBUTING.md) | Use it | [Operations](https://servedeck.rlalphalabs.com/operations/) · [Clients](https://servedeck.rlalphalabs.com/clients/) · [Configuration](https://servedeck.rlalphalabs.com/configuration/) | | How it is built | [Architecture](https://servedeck.rlalphalabs.com/architecture/) · [Builds](https://servedeck.rlalphalabs.com/builds/) · [Host](https://servedeck.rlalphalabs.com/host/) · [Decisions](https://servedeck.rlalphalabs.com/decisions/) | | Each model, measured | [Flash-Next](https://servedeck.rlalphalabs.com/models/flashnext/) · [Qwen3.8-27B](https://servedeck.rlalphalabs.com/models/qwen27b/) · [GLM-5.3](https://servedeck.rlalphalabs.com/models/glm53/) · [LFM2.5-350M](https://servedeck.rlalphalabs.com/models/lfm2/) | + +## Review & Verification Gate + +Every pull request clears three sequential stages before being marked ready for review: + +1. **Deterministic gate (Stage A):** + - CI workflow `.github/workflows/ci.yml` passes (`pytest -q -n auto --maxprocesses=12 -p no:cacheprovider` excluding the 4 GPU/systemd e2e modules, covering all 35 non-e2e test modules including `tests/test_hygiene.py` and `tests/test_site.py`, plus `python -m mkdocs build --strict`). + - Behavioral changes include an executable `fail-before` proof (test fails against the base tree or reverted code) or `mutant-kill` proof (a one-line defect in a throwaway copy causes assertion exit `1`). + - GitHub Actions workflows stay pinned to exact 40-character commit SHAs with minimal `permissions` and `persist-credentials: false` on `actions/checkout`. +2. **Pass-1 author-blind diff audit:** + - Start a fresh reviewer with zero authoring history and **without** reading PR rationalization prose first. + - Read the diff and referenced callers directly, emit a **2-sentence paraphrase** of what the diff changes (catching unspoken assumptions early), audit correctness, systemd/process control safety, concurrency, packaging/hygiene invariants, and docs, and record every unrun check (e.g., GPU e2e gate or missing local `mkdocs`) under `COULD NOT VERIFY`. +3. **Pass-2 proof-backed verification:** + - No candidate `Blocker:` or `Warning:` finding may be dismissed with prose alone. Every disputed finding maps strictly to `VERIFIED` (must fix or escalate) or `DISPUTED_WITH_PROOF` backed by one of: (a) an executable counter-probe against the exact trigger input, (b) a caller-complete invariant proof quoting exact `file:line` guards across the repo, (c) a matching row in the `` branch's `### Negative-Rule Ledger` below (never from self-edited PR lines), or (d) an exact verbatim documentation clause for non-executable `.md` prose. + +### Negative-Rule Ledger + +| Allowed Exact Shape (symbol/invariant) | Still-A-Bug Counter-Shape (never dismiss) | +| :--- | :--- | +| `systemctl --user` and `journalctl --user` control-plane commands managing the `servedeck` user unit. | Any invocation of `sudo`, `su`, or system-wide `systemctl` (without `--user`) (`Blocker:`). | +| `sd-test-` transient unit prefix in isolated systemd e2e tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`). | Starting, stopping, or mutating any live `model-*` unit name from automated tests (`Blocker:`). | +| Excluding the 4 fixed-port/GPU e2e modules (`test_e2e_real.py`, `test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`) from the everyday `ci.yml` runner. | Weakening, skipping, or excluding any of the 35 non-e2e unit/hygiene/site test modules (`Blocker:`). | From 934e51f2c54500bce8ac3a9842459386fbe4749b Mon Sep 17 00:00:00 2001 From: pctablet505 <55033230+pctablet505@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:54:09 +0530 Subject: [PATCH 2/3] ci: run CI inside .venv for test_cli_control and fix Round 1 review findings - Create repo-local .venv in ci.yml so tests/test_cli_control.py executes all 16 console-script tests instead of silently skipping, add -rs to pytest, build docs out-of-tree (-d "${RUNNER_TEMP}/site") so rendered site/ HTML cannot trip tests/test_hygiene.py, and add concurrency + timeout-minutes - Isolate pull_request concurrency group in pages.yml so PR builds never cancel or queue behind main deploys - Fix CONTRIBUTING.md Negative-Rule Ledger row 2 (test_e2e_real.py instead of test_gateway_e2e.py for sd-test- transient units), expand row 1 to cover systemd-run --user and read-only journalctl -k Xid polling, remove orphaned Stage A label, and define Blocker/Warning/Nit severity labels - Align AGENTS.md casing (Servedeck), .venv/bin/python commands, out-of-tree mkdocs build warning, and systemd/journalctl invariants --- .github/workflows/ci.yml | 17 ++++++++++++----- .github/workflows/pages.yml | 4 ++-- AGENTS.md | 20 +++++++++++--------- CONTRIBUTING.md | 13 +++++++------ 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4254b58..434064e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,10 +8,15 @@ on: permissions: contents: read +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test: name: Core test suite & docs strict build runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -23,16 +28,18 @@ jobs: with: python-version: "3.12" - - name: Install package and dev dependencies - run: pip install -e ".[dev]" + - name: Install package and dev dependencies into .venv + run: | + python -m venv .venv + .venv/bin/python -m pip install -e ".[dev]" - name: Run non-e2e test suite run: > - python -m pytest -q -n auto --maxprocesses=12 -p no:cacheprovider + .venv/bin/python -m pytest -q -rs -n auto --maxprocesses=12 -p no:cacheprovider --ignore=tests/test_e2e_real.py --ignore=tests/test_app_e2e.py --ignore=tests/test_control_e2e.py --ignore=tests/test_gateway_e2e.py - - name: Build documentation site (strict) - run: python -m mkdocs build --strict + - name: Build documentation site (strict, out-of-tree) + run: .venv/bin/python -m mkdocs build --strict -d "${RUNNER_TEMP}/site" diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 422d7b4..d9d9597 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -25,8 +25,8 @@ permissions: contents: read concurrency: - group: pages - cancel-in-progress: false + group: ${{ github.event_name == 'pull_request' && format('pages-pr-{0}', github.event.pull_request.number) || 'pages' }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: diff --git a/AGENTS.md b/AGENTS.md index f460c3a..b713057 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,29 +1,31 @@ -# ServeDeck — Agent & Contributor Card +# Servedeck — Agent & Contributor Card Self-contained working guide for automated coding and review agents operating on this public repository. Full ground rules, test discipline, and the two-pass review gate live in [CONTRIBUTING.md](CONTRIBUTING.md). ## Key Commands -- **Everyday non-e2e test suite (35 modules including `tests/test_hygiene.py` and `tests/test_site.py`; caps parallel workers at `12`):** +*(Create a repo-local `.venv` via `python3 -m venv .venv && .venv/bin/python -m pip install -e ".[dev]"` so `tests/test_cli_control.py` executes all 16 console-script tests instead of skipping.)* + +- **Everyday non-e2e test suite (35 modules including `tests/test_cli_control.py`, `tests/test_hygiene.py`, and `tests/test_site.py`; caps parallel workers at `12`):** ```bash - python -m pytest -q -n auto --maxprocesses=12 -p no:cacheprovider \ + .venv/bin/python -m pytest -q -rs -n auto --maxprocesses=12 -p no:cacheprovider \ --ignore=tests/test_e2e_real.py \ --ignore=tests/test_app_e2e.py \ --ignore=tests/test_control_e2e.py \ --ignore=tests/test_gateway_e2e.py ``` -- **Documentation site strict build:** +- **Documentation site strict build (write output outside the repo tree so rendered HTML under `site/` does not trip `tests/test_hygiene.py` on subsequent local runs):** ```bash - python -m mkdocs build --strict + .venv/bin/python -m mkdocs build --strict -d ``` -- **CI workflows:** `.github/workflows/ci.yml` runs on every `push` to `main` and every `pull_request` (core non-e2e tests + `mkdocs build --strict`); `.github/workflows/pages.yml` builds and publishes the site with SHA-pinned GitHub Actions. +- **CI workflows:** `.github/workflows/ci.yml` runs on every `push` to `main` and every `pull_request` (`.venv` editable install, all 35 non-e2e modules with `-rs`, and out-of-tree `mkdocs build --strict`); `.github/workflows/pages.yml` builds and publishes the site with SHA-pinned GitHub Actions. ## Non-Negotiable Invariants -- **Never run `sudo`.** All control-plane operations use `systemctl --user` and `journalctl --user`. Where host-level privilege is needed, emit a copyable command for the operator. +- **Never run `sudo`.** Control-plane operations use `systemctl --user`, `systemd-run --user` (managing transient `model-*` / `sd-test-*` user units in `servedeck/units.py`), and `journalctl --user`; read-only kernel Xid polling uses `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). Where host-level privilege is needed, emit a copyable command for the operator. - **Never use `pgrep -f` or `pkill -f`.** Enforced by AST scan in `tests/test_hygiene.py`. -- **Keep transient e2e units strictly under the `sd-test-` namespace.** Never start, stop, or mutate live `model-*` units from automated tests. +- **Keep transient e2e units strictly under the `sd-test-` namespace.** Never start, stop, or mutate live `model-*` units from automated tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`). - **No host-specific paths, machine names, or hardcoded GPU sizes** in code or docs (`models.toml`, `servedeck/settings.py`, and `servedeck/limits.py` own machine config). Keep documentation free of user-specific home paths and scratch temp paths. - **Measured vs. estimated numbers:** Label any derived value explicitly as estimated; every measured figure must cite a real log or live probe. - **Review & proof discipline:** Every behavioral fix ships a regression test seen to fail before the fix (`fail-before` / mutant proof). Follow the author-blind two-pass review gate and `### Negative-Rule Ledger` in [CONTRIBUTING.md](CONTRIBUTING.md). -- **Commit identity:** Commit solely as the repository owner identity with explicit staged paths and zero `Co-Authored-By:` or AI attribution trailers. +- **Commit identity (maintainer / automated-agent commits):** Automated agent commits use sole repository owner identity with explicit staged paths and zero `Co-Authored-By:` or AI attribution trailers (external contributors retain their own authorship attribution). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7bac2c9..167fa7b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,13 +97,14 @@ as part of a normal check. How to contribute: [CONTRIBUTING.md](CONTRIBUTING.md) Every pull request clears three sequential stages before being marked ready for review: -1. **Deterministic gate (Stage A):** - - CI workflow `.github/workflows/ci.yml` passes (`pytest -q -n auto --maxprocesses=12 -p no:cacheprovider` excluding the 4 GPU/systemd e2e modules, covering all 35 non-e2e test modules including `tests/test_hygiene.py` and `tests/test_site.py`, plus `python -m mkdocs build --strict`). +1. **Deterministic gate:** + - CI workflow `.github/workflows/ci.yml` passes: editable install inside repo-local `.venv` (ensuring `tests/test_cli_control.py` executes all 16 console-script tests instead of skipping), `.venv/bin/python -m pytest -q -rs -n auto --maxprocesses=12 -p no:cacheprovider` excluding the 4 GPU/systemd e2e modules (covering all 35 non-e2e test modules including `tests/test_cli_control.py`, `tests/test_hygiene.py`, and `tests/test_site.py`), plus out-of-tree `.venv/bin/python -m mkdocs build --strict -d ` (preventing generated HTML under `site/` from tripping `tests/test_hygiene.py`). - Behavioral changes include an executable `fail-before` proof (test fails against the base tree or reverted code) or `mutant-kill` proof (a one-line defect in a throwaway copy causes assertion exit `1`). - - GitHub Actions workflows stay pinned to exact 40-character commit SHAs with minimal `permissions` and `persist-credentials: false` on `actions/checkout`. + - GitHub Actions workflows stay pinned to exact 40-character commit SHAs with minimal `permissions` and `persist-credentials: false` strictly on `actions/checkout`. 2. **Pass-1 author-blind diff audit:** - Start a fresh reviewer with zero authoring history and **without** reading PR rationalization prose first. - Read the diff and referenced callers directly, emit a **2-sentence paraphrase** of what the diff changes (catching unspoken assumptions early), audit correctness, systemd/process control safety, concurrency, packaging/hygiene invariants, and docs, and record every unrun check (e.g., GPU e2e gate or missing local `mkdocs`) under `COULD NOT VERIFY`. + - Severity labels: **`Blocker:`** (correctness, safety, security, test-gate weakening, or ledger counter-shape — must fix), **`Warning:`** (high-risk defect or missing edge-case coverage — must fix or clear via Pass-2 proof), **`Nit:`** (non-blocking polish). 3. **Pass-2 proof-backed verification:** - No candidate `Blocker:` or `Warning:` finding may be dismissed with prose alone. Every disputed finding maps strictly to `VERIFIED` (must fix or escalate) or `DISPUTED_WITH_PROOF` backed by one of: (a) an executable counter-probe against the exact trigger input, (b) a caller-complete invariant proof quoting exact `file:line` guards across the repo, (c) a matching row in the `` branch's `### Negative-Rule Ledger` below (never from self-edited PR lines), or (d) an exact verbatim documentation clause for non-executable `.md` prose. @@ -111,6 +112,6 @@ Every pull request clears three sequential stages before being marked ready for | Allowed Exact Shape (symbol/invariant) | Still-A-Bug Counter-Shape (never dismiss) | | :--- | :--- | -| `systemctl --user` and `journalctl --user` control-plane commands managing the `servedeck` user unit. | Any invocation of `sudo`, `su`, or system-wide `systemctl` (without `--user`) (`Blocker:`). | -| `sd-test-` transient unit prefix in isolated systemd e2e tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`). | Starting, stopping, or mutating any live `model-*` unit name from automated tests (`Blocker:`). | -| Excluding the 4 fixed-port/GPU e2e modules (`test_e2e_real.py`, `test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`) from the everyday `ci.yml` runner. | Weakening, skipping, or excluding any of the 35 non-e2e unit/hygiene/site test modules (`Blocker:`). | +| `systemctl --user`, `systemd-run --user` (managing `servedeck` and transient `model-*` / `sd-test-*` user units in `servedeck/units.py`), `journalctl --user`, and read-only kernel Xid polling via `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). | Any invocation of `sudo`, `su`, or system-wide mutating `systemctl` (without `--user`) (`Blocker:`). | +| `sd-test-` transient unit prefix in isolated systemd e2e tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`). | Starting, stopping, or mutating any live `model-*` unit name from automated tests (`Blocker:`). | +| Excluding the 4 fixed-port/GPU e2e modules (`test_e2e_real.py`, `test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`) from the everyday `ci.yml` runner. | Weakening, skipping (e.g., omitting `.venv` so `tests/test_cli_control.py` silently skips), or excluding any of the 35 non-e2e unit/hygiene/site test modules (`Blocker:`). | From 6ad389da9de91aeb383cb3cb4a76f19f2401b83c Mon Sep 17 00:00:00 2001 From: pctablet505 <55033230+pctablet505@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:13:44 +0530 Subject: [PATCH 3/3] fix(review): tighten systemd ledger scope, add pages.yml timeouts, and guard RUNNER_TEMP --- .github/workflows/ci.yml | 2 +- .github/workflows/pages.yml | 2 ++ AGENTS.md | 8 ++++---- CONTRIBUTING.md | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 434064e..13a1272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,4 @@ jobs: --ignore=tests/test_gateway_e2e.py - name: Build documentation site (strict, out-of-tree) - run: .venv/bin/python -m mkdocs build --strict -d "${RUNNER_TEMP}/site" + run: .venv/bin/python -m mkdocs build --strict -d "${RUNNER_TEMP:?RUNNER_TEMP must be set}/site" diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d9d9597..801c868 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -31,6 +31,7 @@ concurrency: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -53,6 +54,7 @@ jobs: if: github.event_name != 'pull_request' needs: build runs-on: ubuntu-latest + timeout-minutes: 10 permissions: pages: write id-token: write diff --git a/AGENTS.md b/AGENTS.md index b713057..69edbed 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,10 +22,10 @@ Self-contained working guide for automated coding and review agents operating on ## Non-Negotiable Invariants -- **Never run `sudo`.** Control-plane operations use `systemctl --user`, `systemd-run --user` (managing transient `model-*` / `sd-test-*` user units in `servedeck/units.py`), and `journalctl --user`; read-only kernel Xid polling uses `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). Where host-level privilege is needed, emit a copyable command for the operator. -- **Never use `pgrep -f` or `pkill -f`.** Enforced by AST scan in `tests/test_hygiene.py`. -- **Keep transient e2e units strictly under the `sd-test-` namespace.** Never start, stop, or mutate live `model-*` units from automated tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`). +- **Never run `sudo`.** Operator lifecycle for the persistent `servedeck.service` unit uses `systemctl --user`. Control-plane code in `servedeck/units.py` uses `systemctl --user`, `systemd-run --user`, and `journalctl --user` **exclusively** for transient `model-*` / `sd-test-*` user units (explicitly refusing `servedeck` and all other names via `_NAME_RE`). Read-only kernel Xid polling uses `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). Where host-level privilege is needed, emit a copyable command for the operator. +- **Never use `pgrep` or `pkill`.** Enforced by AST scan in `tests/test_hygiene.py`, which bans any `pgrep` or `pkill` invocation in executable (non-docstring) string literals (not only `-f`). +- **Keep transient e2e units under the `sd-test-` namespace** (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`; the sole deliberate exception is the read-only `sd-netns-probe-` helper in `tests/conftest.py`, kept outside `sd-test-*` so e2e teardown globs do not race or stop it). Never start, stop, or mutate any live `model-*` unit or non-test production user unit (`servedeck`, `lfm2-350m`, `qwen-vllm`, `*-reasoning-proxy`) from automated tests. - **No host-specific paths, machine names, or hardcoded GPU sizes** in code or docs (`models.toml`, `servedeck/settings.py`, and `servedeck/limits.py` own machine config). Keep documentation free of user-specific home paths and scratch temp paths. - **Measured vs. estimated numbers:** Label any derived value explicitly as estimated; every measured figure must cite a real log or live probe. - **Review & proof discipline:** Every behavioral fix ships a regression test seen to fail before the fix (`fail-before` / mutant proof). Follow the author-blind two-pass review gate and `### Negative-Rule Ledger` in [CONTRIBUTING.md](CONTRIBUTING.md). -- **Commit identity (maintainer / automated-agent commits):** Automated agent commits use sole repository owner identity with explicit staged paths and zero `Co-Authored-By:` or AI attribution trailers (external contributors retain their own authorship attribution). +- **Commit identity (maintainer / automated-agent commits):** Maintainer and maintainer-operated automated-agent commits use sole repository owner identity with explicit staged paths and zero `Co-Authored-By:` or AI attribution trailers; external contributors (and agents acting on their behalf) retain the contributor's own authorship identity. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 167fa7b..8742942 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,6 +112,6 @@ Every pull request clears three sequential stages before being marked ready for | Allowed Exact Shape (symbol/invariant) | Still-A-Bug Counter-Shape (never dismiss) | | :--- | :--- | -| `systemctl --user`, `systemd-run --user` (managing `servedeck` and transient `model-*` / `sd-test-*` user units in `servedeck/units.py`), `journalctl --user`, and read-only kernel Xid polling via `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). | Any invocation of `sudo`, `su`, or system-wide mutating `systemctl` (without `--user`) (`Blocker:`). | -| `sd-test-` transient unit prefix in isolated systemd e2e tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`). | Starting, stopping, or mutating any live `model-*` unit name from automated tests (`Blocker:`). | -| Excluding the 4 fixed-port/GPU e2e modules (`test_e2e_real.py`, `test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`) from the everyday `ci.yml` runner. | Weakening, skipping (e.g., omitting `.venv` so `tests/test_cli_control.py` silently skips), or excluding any of the 35 non-e2e unit/hygiene/site test modules (`Blocker:`). | +| `systemctl --user` (for manual operator lifecycle of persistent `servedeck.service`), `servedeck/units.py` using `systemctl --user` / `systemd-run --user` / `journalctl --user` **exclusively** for transient `model-*` / `sd-test-*` user units (explicitly refusing `servedeck` and all other names via `_NAME_RE`), and read-only kernel Xid polling via `journalctl -k -b all --no-pager` (`servedeck/gpu.py`, `servedeck/xid_watch.py`). | Any invocation of `sudo`, `su`, or system-wide `systemctl` / `systemd-run` (without `--user`), widening `servedeck/units.py` `_NAME_RE` beyond `model-*` / `sd-test-*` (e.g., permitting `servedeck` or other persistent units), or wildcard unit stop globs such as `systemctl --user stop 'sd-test-*'` (`Blocker:`). | +| `sd-test-` transient unit prefix in isolated systemd e2e tests (`test_app_e2e.py`, `test_control_e2e.py`, `test_e2e_real.py`), plus the read-only `sd-netns-probe-` helper in `tests/conftest.py` (kept outside `sd-test-*` so e2e teardown sweeps do not race or stop it). | Starting, stopping, or mutating any live `model-*` unit or non-test production user unit (`servedeck`, `lfm2-350m`, `qwen-vllm`, `*-reasoning-proxy`) from automated tests (`Blocker:`). | +| Excluding the 4 fixed-port/GPU e2e modules (`test_e2e_real.py`, `test_app_e2e.py`, `test_control_e2e.py`, `test_gateway_e2e.py`) from the everyday `ci.yml` runner, and host-hardware/cache-gated individual test skips surfaced transparently by `-rs` (GPU/HF cache/multi-filesystem checks). | Weakening, causing module-/dependency-level skips (e.g., omitting `.venv` so `tests/test_cli_control.py` silently skips, or omitting `mkdocs` so `TestTheBuiltSite` in `tests/test_site.py` skips), or excluding any of the 35 non-e2e unit/hygiene/site test modules (`Blocker:`). |