diff --git a/docs/governance/workstreams.md b/docs/governance/workstreams.md index 80f2455..d3c3ef7 100644 --- a/docs/governance/workstreams.md +++ b/docs/governance/workstreams.md @@ -309,6 +309,7 @@ state to its index: [`docs/adr/`](../adr/README.md), [`docs/pdr/`](../pdr/README | D290 | **T4 refused a confirmation written `: why`** (#532, downstream, v0.34.8). Each `;` clause of the Confirmed cell was split on its first space and its first word had to be a commit: `36d3d59:` was none, for its colon — the most natural slip from the ` — ` T4's Action asks for. The run attested 4 of 5 and cost a re-attest and a verifier round-trip, and the refusal never quoted the cell it read | Done: a clause's commit is its first word, backticks or not, followed by a space, a dash, a colon or a comma, or nothing; a longer word or a clause that does not start with it still confirms nothing. T4's refusal quotes each unconfirmed scenario's cell, or says it has none. 05-workflow §7 says both. Tests: eight forms that confirm (a doubled backtick among them, as the old strip read it — the fresh verifier's nit), four refusals quoted, a long cell cut at 120; each fix's mutant killed | | D291 | **A squash merge on GitHub leaves no readable Agent-Session trailer on the default branch** (#540, found by the coherence review of v0.34.10): GitHub appends its `Co-authored-by` paragraph — and, for several commits, a `---------` line — after the commit's trailer block, and git reads trailers in the last paragraph only. None of the last 14 commits of this repository's main reads one | Done, by reading before building: every engine reader of the trailer — pr-check's T2 and its verifier check, attest's session, the holds — reads a pull request's own commits or the hold refs, never a squashed commit; no page promises a trailer on the default branch; the session stays in the squashed message, where `git log --grep` finds it (checked on main). 05-workflow §7 says where the trailer is read and how to find a session on the default branch. Not built: a merge that rewrites the message — it would cover an agent's merge only, never a person's in the forge's page, for a reader that does not exist | | D292 | **Who contributes is a sentence nothing enforces, and an outsider has no path** (the maintainer's request, 2026-11-25: collaboration within one organisation and on an open project alike). Measured the same day on a public test project with a small AI agent on an account with no access: the fork's CI waited for a person and ran without secrets, and pr-check refused its gamed sheet; but the contributing guide spoke to members only, K3 sent it to `nstack claim`, and approving one run released that run only (#542, #543) | Proposed: PDR-0025, one answer `contributors: members \| open`, kept with the project's answers, shown in the contributing guide and displayed on the forge (GitHub's pull requests restricted to collaborators, readable as `pull_request_creation_policy`); an absent answer asserts nothing, so an update changes no project; accepted only after two measurements — the setting written through the API, and an agent's App still opening pull requests under `members`; no claim bot, no AI detection, no contributor agreement chosen for the project. Two independent reviews: the findings against the code and the pull request, then the record itself (its default hid a breaking change, now absent-asserts-nothing) | +| D293 | **An outside contributor has a path** (#542, found by a rehearsal from a fork on a public test project at v0.34.11): the guide, K3 and the verifier's playbook said nothing to someone with no access | Done: `CONTRIBUTING.md` gains "From outside the organisation" before "Joining the project" and the pull request template points to it; K3 on a fork's pull request says a member can hold the deliverable for its author (`nstack claim D --person @`) and that unheld is acceptable, read from `PR_FROM_FORK` set by the pull-request workflow (absent = not a fork); the verification playbook has the verifier confirm the change delivers the deliverable it names, carries its oracle, and claims only what was run; INSTALL says to approve a fork's workflows from the pull request page. Tests: K3's Action on a fork versus a member's, the workflow's env, the rendered section The section is GitHub's words on GitHub, says off GitHub that a member runs and records the checks, and is absent with no forge (the fresh verifier's finding) | | v0.6.0 | **What is announced refuses, and the documents say what is true**: D51 to D54, and the documentary lot of the internal audit | **Done (2026-09-20)**: five workstreams merged (#83, #84, #85, #86, #87), **v0.6.0 published**, tag on `8ae544c`, verified on published artefacts — including an update of `tool-library` from v0.5.0, 9 files and no conflict, still compliant. Found doing it: D55. Next: the pilot, and M11 beside it | | Pilot | **`NapkinStack/flet`, the first real project**, run by a session that knew nothing of this repository, with the maintainer as decider and this repository's agent as observer — public on the Free plan, where the whole checklist is available, rather than private on Team where G5 is paid and G6 does not exist | **Set aside by the maintainer, 2026-10-15**, at its cycle boundary; the real product followed since is `summit`. **Ran from 2026-09-20**: discovery decided *go* after three rounds and two independent challenges, charter accepted; cycle 01 closed `stopped/reframed`, **cycle 02 closed** with two deliverables accepted and one deferred (its #27), **cycle 03 framed and approved** (#28, #30), which starts its first `critical` module; the framework taken to v0.6.1 by itself at the boundary (#29), v0.6.2 proposed (#31). It has produced D56 to D63, D68, D70 to D77, replicated D26 and D55, and measured D49 — the first figures on what an independent verifier finds (PDR-0003) | | M11 | **Ceremony follows consequence** (PDR-0011): the framework charges what a failure costs, per module and per project, and states each price before it is paid; with PDR-0004's routing, and PDR-0007, PDR-0008 and PDR-0010 — through to v0.7.0 | **Published as v0.7.0 (2026-10-12).** Planned 2026-09-23 (#98). Merged: **M11f** (#101), **M11a** (#102), **M11b** (#103), **M11d** (#104), **M11e** (#105), **M11c** (#106), **M11h** (#107), **M11g** (#108) closed by its probe — not clean, returned to M13; **M11m** (D68, D74, D75); **M11l** (PDR-0010, D59, D60); **M11n** (D79); **M11o** (PDR-0010 extended: every document has its moment); **M11p** (PDR-0002's three levels given a place: `docs/project/rules/`); **M11j** (PDR-0007: the unframed stage); **M11q** (no folder created empty; PDR-0012 proposed: a project's tree is the project's). **M11k** (PDR-0008's print mode: `nstack settings`; D77, D78). **M11s** (PDR-0012 accepted; the framework's files under `.nstack/`; an update carries what a project adapted); **M11u** (an update rewrites the old addresses a project wrote in its own files, D85). **M11t** (`nstack new-contract`: the contracts module is created by the first contract; PDR-0012 built in full); **M11v** (what the third project found: D81, D82, D83, D86, D87). **M11i**: v0.7.0 published 2026-10-12 (#125, D88). To do: **M11r** PDR-0008's apply mode and D57, after a probe on the real forge; the two earlier projects take v0.7.0 themselves, observed | diff --git a/platform/tests/test_forge.py b/platform/tests/test_forge.py index b8d81e3..3adca61 100644 --- a/platform/tests/test_forge.py +++ b/platform/tests/test_forge.py @@ -745,6 +745,9 @@ def test_on_github_the_pages_keep_github_s_words(created): contributing = (root / "CONTRIBUTING.md").read_text(encoding="utf-8") assert "`.github/CODEOWNERS`" in contributing and "GitHub push
protection" in contributing assert "CI 'Hooks and secrets'" in contributing and "{%" not in contributing + outside = contributing.index("## From outside the organisation") + assert outside < contributing.index("## Joining the project") and "Deliverable: D" in contributing[outside:] + assert "From outside the organisation" in (root / ".github/pull_request_template.md").read_text(encoding="utf-8") assert "**Security** tab" in (root / "SECURITY.md").read_text(encoding="utf-8") install = (root / ".nstack/handbook/INSTALL.md").read_text(encoding="utf-8") assert "GitHub repository" in install and "NSTACK_RUNS_ON" in install and "| `.github/` |" in install @@ -788,8 +791,16 @@ def test_on_github_the_ci_words_stay(created): assert said in text, f"github: {page} lost '{said}'" +def test_off_github_an_outsider_is_told_a_member_runs_the_checks(created): + contributing = (created["gitlab"] / "CONTRIBUTING.md").read_text(encoding="utf-8") + assert "From outside the organisation" in contributing + assert "a member runs the checks on your change" in contributing + assert "fork's workflows waits" not in contributing, "a GitHub behaviour, said on GitHub only" + + def test_with_no_forge_the_pages_say_there_is_none(created): contributing = (created["none"] / "CONTRIBUTING.md").read_text(encoding="utf-8") + assert "From outside the organisation" not in contributing, "no forge: no fork, no pull request" assert "invites you on the forge" not in contributing and "The change, on its branch" in contributing install = (created["none"] / ".nstack/handbook/INSTALL.md").read_text(encoding="utf-8") assert "No forge
hooks and records" in install and "Work in branches" in install diff --git a/platform/tests/test_pull_request.py b/platform/tests/test_pull_request.py index ad29835..8411526 100644 --- a/platform/tests/test_pull_request.py +++ b/platform/tests/test_pull_request.py @@ -723,6 +723,31 @@ def test_k3_tells_a_ready_deliverable_to_move(tmp_path, capsys, monkeypatch): assert "WARNING [K3]" in output and "nstack claim" in output and "01-first.md" in output, output +def test_k3_on_a_fork_says_a_member_can_hold_it_for_the_author(tmp_path, capsys, monkeypatch): + """#542: a hold is a branch pushed to the repository, which an outsider cannot do. A fork's pull + request is told a member holds it for its author, and that unheld is acceptable; a member's keeps + the plain command.""" + base, head = change(tmp_path) + monkeypatch.setenv("PR_AUTHOR", "outsider") + monkeypatch.setenv("PR_FROM_FORK", "true") + assert check(tmp_path, base, head, "A change.", monkeypatch) == 0 + fork = capsys.readouterr().out + assert "nstack claim D1 --person @outsider" in fork and "acceptable" in fork, fork + monkeypatch.setenv("PR_FROM_FORK", "false") + assert check(tmp_path, base, head, "A change.", monkeypatch) == 0 + member = capsys.readouterr().out + assert "WARNING [K3]" in member and "Action: nstack claim D1 —" in member, member + assert "acceptable" not in member and "--person" not in member, member + + +def test_ci_tells_pr_check_whether_the_pull_request_comes_from_a_fork(): + workflow = yaml.safe_load((Path(__file__).parents[2] / "skeleton/.github/workflows/pull-request.yml") + .read_text(encoding="utf-8")) + step = next(step for step in workflow["jobs"]["description"]["steps"] if "pr-check" in step.get("run", "")) + assert step["env"]["PR_FROM_FORK"] == ("${{ github.event.pull_request.head.repo.full_name " + "!= github.repository }}"), step["env"] + + def test_ci_gives_pr_check_the_pull_request_s_number_and_a_read_token(): """Without them the verifier's hand is never read, and nothing says so on a forged sheet (#363).""" workflow = yaml.safe_load((Path(__file__).parents[2] / "skeleton/.github/workflows/pull-request.yml") diff --git a/skeleton/.github/pull_request_template.md b/skeleton/.github/pull_request_template.md index 505d661..bfcdfaa 100644 --- a/skeleton/.github/pull_request_template.md +++ b/skeleton/.github/pull_request_template.md @@ -1,3 +1,5 @@ +> From outside the organisation? Read *From outside the organisation* in `CONTRIBUTING.md` first. + # Closes # diff --git a/skeleton/.github/workflows/pull-request.yml b/skeleton/.github/workflows/pull-request.yml index 7fafee6..bfa407d 100644 --- a/skeleton/.github/workflows/pull-request.yml +++ b/skeleton/.github/workflows/pull-request.yml @@ -45,6 +45,7 @@ jobs: PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} + PR_FROM_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} GH_TOKEN: ${{ github.token }} BASE_REF: ${{ github.event.pull_request.base.ref }} diff --git a/skeleton/.nstack/handbook/INSTALL.md.jinja b/skeleton/.nstack/handbook/INSTALL.md.jinja index 230c557..06e7ef5 100644 --- a/skeleton/.nstack/handbook/INSTALL.md.jinja +++ b/skeleton/.nstack/handbook/INSTALL.md.jinja @@ -195,7 +195,7 @@ Settings → Actions → General: - [ ] Allowed actions: GitHub's own, plus `astral-sh/setup-uv` - [ ] SHA-pinned actions required -- [ ] Workflow approval for every outside contributor, public repository +- [ ] Workflow approval for every outside contributor, public repository — approve a fork's workflows from the pull request's page, which releases all its runs; a run's own page releases that run only - [ ] Workflow token read-only; Actions neither creates nor approves pull requests Settings → General → Default branch: diff --git a/skeleton/.nstack/playbooks/verification.md b/skeleton/.nstack/playbooks/verification.md index 5a287a8..313bdd4 100644 --- a/skeleton/.nstack/playbooks/verification.md +++ b/skeleton/.nstack/playbooks/verification.md @@ -86,7 +86,8 @@ You verify on someone's machine, beside work that goes on. Leave it as you found 5. **Only then read the diff**, to explain a failure — never to decide a result — and ask one question of its tests: **is the entry point a real user calls exercised the way they call it?** A suite that always passes what the user never passes is green on a path nobody takes. -6. **Report** the failures first — observed, expected, evidence — then any optional +6. **Confirm what the sheet cannot say**: the change delivers the deliverable it names (its acceptance criteria, not another change's), a code change carries its oracle, and the summary claims only what was run. +7. **Report** the failures first — observed, expected, evidence — then any optional remark, marked as such. ### Mutants diff --git a/skeleton/CONTRIBUTING.md.jinja b/skeleton/CONTRIBUTING.md.jinja index f5e8358..96194ca 100644 --- a/skeleton/CONTRIBUTING.md.jinja +++ b/skeleton/CONTRIBUTING.md.jinja @@ -1,6 +1,18 @@ # Contributing -## Joining the project +{% if forge != "none" %}## From outside the organisation + +You have no access to the repository: work from a fork, and you need not join first. + +1. Read the current cycle (`docs/project/cycles/`) and take a **ready** deliverable. +2. Open the pull request from your fork, with `Deliverable: D`; the change delivers that deliverable and nothing else. +3. Write the test sheet's scenarios from its acceptance criteria. Leave Result and Evidence to a verifier who is not you: a member verifies. +{% if forge == "github" %}4. The first run of your fork's workflows waits for a maintainer's approval: do not push again to retry. +{% else %}4. No CI is shipped on this forge: a member runs the checks on your change and records them (`nstack attest`). +{% endif %}5. `Closes #` names an issue the change closes. +6. A hold (`nstack claim D --person @you`) is a member's, made on your request; unheld is fine. + +{% endif %}## Joining the project Once per person, before a first deliverable. Each step says where it is said in full. diff --git a/src/napkinstack/pull_request.py b/src/napkinstack/pull_request.py index 7ad40ae..e8cadbe 100644 --- a/src/napkinstack/pull_request.py +++ b/src/napkinstack/pull_request.py @@ -48,6 +48,9 @@ a token and one open pull request at the head, its own labels are read, and a label given that it does not carry is refused (#368). +PR_FROM_FORK is "true" when the pull request comes from a fork (K3's Action then says a member can hold +the deliverable for its author); absent or anything else, it does not. + The verifier (T2) is a person, `@handle`, or an agent session, `session `. The change's authors are the pull request's author, the GitHub accounts behind its commits' authors, committers and co-authors — read from GitHub's noreply addresses; another address names no @@ -625,9 +628,16 @@ def check_cycle(root: Path, body: str, labels: set[str], today: datetime.date, f # record, never changed by a delivery — under `docs/`, a human would have to approve it. from napkinstack import hold - warn(f"[K3] deliverable {match[1]} is still 'ready' and nobody holds it on {hold.remote(root) or 'this repository'} " - f"while this pull request delivers it.\n Action: nstack claim {match[1]} — the hold says it is in " - f"progress; {path.name} changes never in a delivery's pull request.") + where = f"{hold.remote(root) or 'this repository'} while this pull request delivers it.\n Action: " + if os.environ.get("PR_FROM_FORK", "").strip().lower() == "true": + # A hold is a branch pushed to the repository: an outsider cannot make it. + action = (f"a member can hold it for the author — nstack claim {match[1]} --person " + f"@{os.environ.get('PR_AUTHOR', '').strip() or ''} — and leaving it unheld is acceptable; " + f"{path.name} changes never in a delivery's pull request.") + else: + action = (f"nstack claim {match[1]} — the hold says it is in progress; " + f"{path.name} changes never in a delivery's pull request.") + warn(f"[K3] deliverable {match[1]} is still 'ready' and nobody holds it on {where}{action}") def _on_record(root: Path, path: Path, data: dict, ident: str) -> bool: