From fbd1338abc1e5571078ec04adab6835d75d15311 Mon Sep 17 00:00:00 2001 From: "napkinstack-agent[bot]" <330339777+napkinstack-agent[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 13:06:44 +0100 Subject: [PATCH 1/2] =?UTF-8?q?D315=20=E2=80=94=20an=20attest=20or=20a=20p?= =?UTF-8?q?r-check=20that=20reads=20no=20pull=20request=20says=20it=20judg?= =?UTF-8?q?es=20the=20description's=20sheet=20(#595)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Downstream, one commit was recorded 4 of 5 by the attest that read the verifier's comment and 5 of 5 by one with no token, which found no pull request and judged the description's sheet in silence. Where the forge is GitHub, a sheet is in play and no pull request was read, pr-check warns (T2) and attest says it in its own output, with how to read the signed sheet here. Not a failure: checks on a workstation stand without a token. Agent-Session: napkinstack-os-1e Co-Authored-By: Claude Opus 5.5 --- docs/governance/workstreams.md | 1 + platform/tests/test_pull_request.py | 5 ++++- platform/tests/test_sheet_history.py | 18 ++++++++++++++++++ src/napkinstack/attest.py | 7 ++++++- src/napkinstack/pull_request.py | 9 +++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/governance/workstreams.md b/docs/governance/workstreams.md index 582f313..9f791c2 100644 --- a/docs/governance/workstreams.md +++ b/docs/governance/workstreams.md @@ -331,6 +331,7 @@ state to its index: [`docs/adr/`](../adr/README.md), [`docs/pdr/`](../pdr/README | D312 | **A cycle left proposed was approved as if accepted** (#587). Downstream, 2026-11-29: the next cycle, `proposed` with no `accepted_on` while one ran, was approved by the decider as its acceptance; neither fitness nor pr-check said the approval accepted nothing, and a second push and a second approval followed. The framing playbook said it; nothing said it where the approval is given | **Done**: pr-check warns (C11) on a pull request that leaves a cycle `proposed` with no `accepted_on`, in a framed project — on the check itself, beside the approval, not only in its log — with the gesture: `accepted_on` while a cycle runs, else `status: accepted` and its start. A warning, not a failure: a decider may approve a proposal still being framed. Not caught: a cycle proposed during framing, before the charter is accepted — the framing accepts both | | D313 | **The update's refusal off main did not say it makes its own branch, nor the way from a worktree** (#589). Downstream, 2026-11-29, 0.35.4: the coordinator made a branch and a worktree for the update first, as for any change; the refusal said `git switch main`, which a worktree beside main's cannot do | **Done**: `nstack update`, `nstack update --forge` and `nstack config` refuse with one Action: `git switch `, or in a worktree beside the one that holds it `git switch --detach ` (#261), and the command makes its own branch: make none before | | D314 | **A pull request titled with a deliverable's part, "D126 3c —", was not read as delivering it** (#588). Downstream, 2026-11-29, 0.35.4: `nstack deliver D126 --held '1=#1372'` refused it; the team titles a deliverable's parts "D121 4a —", "D123 (a) —", "D126 3c —", one pull request in two. D300 read a letter glued to the id only | **Done**: after the id and its letter, a part is read too — a number with an optional letter, "-1", or, opening the title, "(a)" — before the dash or the colon, and in the closing parentheses; `deliver`, `plan` and the start branches' landing read these part forms alike. Words there stay a mention, and a part takes no scope after it: "D12 is next —", "D7 (wip) —", "D12 3 files:" name nothing. Not read: "(a)" inside the closing parentheses, which hold no nested ones | +| D315 | **An attest that read no pull request judged the description's sheet, and said nothing** (#595). Downstream, 2026-11-30, PR #1389: one commit recorded 4 of 5 by the attest that read the verifier's comment (T1, right by design, D305) and 5 of 5 by one with no token, which judged the description's sheet | **Done**: where the forge is GitHub, a sheet is in play and no pull request was read, pr-check warns (T2) and attest says it in its own output: the description's sheet is judged, the forge's run judges the signed one, a token reads it here. Not a failure: checks on a workstation stand without a token (ADR-0010 §6) | | D316 | **A module's formatter ran only in CI or at attest** (#593). Downstream, 2026-11-30, PR #1390: a red `cargo fmt --check`, inside the module's `check`, was seen after the push and the verifier's round; the shipped pre-commit config ran generic hooks only | **Done**: an optional verb `format` (the formatter's check, writing nothing, building nothing); the skeleton's pre-commit hook `nstack-format` runs it on the modules whose files are staged, and `Module checks` after `bootstrap`, before `check`. Where nstack, an engine without the verb or the module's tool (exit 127) is missing, the hook says so and lets the commit go: CI judges. Audited before (moonrepo, lefthook, lint-staged, trunk, Bazel, Pants). Not taken: `check` at push (a build, minutes), documentation alone (a copy per project). A project moves its formatter's check out of `check` into `format` | | 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) | diff --git a/platform/tests/test_pull_request.py b/platform/tests/test_pull_request.py index 8010817..766ef5f 100644 --- a/platform/tests/test_pull_request.py +++ b/platform/tests/test_pull_request.py @@ -674,7 +674,7 @@ def test_a_person_named_verifier_left_a_trace_on_the_pull_request(tmp_path, caps output = capsys.readouterr().out assert expected in output, output assert result == code, output - assert "session" not in verifier or "WARNING [T2]" not in output, output + assert "session" not in verifier or "hand is on this pull request" not in output, output # no hand asked of a session def test_off_github_the_hand_is_not_read(tmp_path, capsys, monkeypatch): @@ -1083,6 +1083,9 @@ def test_where_the_pull_request_is_not_read_the_description_is_judged_as_ever(tm out = capsys.readouterr().out assert "signed in the description" not in out and "Signed sheet" not in out, out assert ("is not read: no token" in out) is bool(answer), out + # D315: with no pull request number, the comments are not read and nothing said it — an attest + # without a token recorded 5 of 5 on the description's sheet where the forge's run refused it. + assert ("WARNING [T2] the pull request's comments are not read here" in out) is (answer is None), out monkeypatch.setattr(pull_request.project, "forge", lambda root: "gitlab") monkeypatch.setattr(pull_request, "signed_sheet", lambda path: pytest.fail("read off GitHub")) assert check(tmp_path, base, head, sheet(PASSED, verifier="@dana"), monkeypatch) == 0, capsys.readouterr().out diff --git a/platform/tests/test_sheet_history.py b/platform/tests/test_sheet_history.py index 205ed8e..29b99b7 100644 --- a/platform/tests/test_sheet_history.py +++ b/platform/tests/test_sheet_history.py @@ -326,6 +326,24 @@ def test_a_removal_the_description_says_clears_a_signed_sheet_s_gone_row(verifie +def test_attest_with_no_pull_request_found_says_the_signed_sheet_is_not_read(verified_then_fixed, monkeypatch, capsys): + """D315 (#595): downstream, an attest with no token found no pull request, judged the description's + sheet and recorded 5 of 5, where the run that read the verifier's comment refused it. Said in its output.""" + from napkinstack import pull_request + + root, base, _, second = verified_then_fixed + monkeypatch.setattr(pull_request, "this_pull", lambda path, head: {"branch": "d1"}) + for name in ("PR_HEAD_SHA", "PR_BODY", "PR_NUMBER"): + monkeypatch.delenv(name, raising=False) + monkeypatch.setattr(attest, "CHECKS", ()) + attest.run(root, base, _body(root, "unfilled", ("S2", GIVEN, "", "", "", "")), "") + assert "Signed sheet: not read — no pull request found for this branch" in capsys.readouterr().out + plain = root.parent / "plain.md" # a description with no sheet: nothing to say + plain.write_text("A change.\n", encoding="utf-8") + attest.run(root, base, plain, "") + assert "Signed sheet: not read" not in capsys.readouterr().out + + def test_attest_judges_and_records_the_sheet_signed_in_a_comment(verified_then_fixed, monkeypatch, capsys): """B1 of the audit: where checks are attested, the verifier signs in a comment as everywhere — attest reads it on the forge, its pr-check judges it, and the record holds its rows for T4.""" diff --git a/src/napkinstack/attest.py b/src/napkinstack/attest.py index 0721165..11af38d 100644 --- a/src/napkinstack/attest.py +++ b/src/napkinstack/attest.py @@ -916,7 +916,7 @@ def run(root: Path, base: str, body_file: Path | None, labels: str | None, accep # The sheet the verifier signed in a comment or a review, read once on the forge (D305): pr-check, # run below, judges it as the forge's own run would, and the record holds its rows for T4. from napkinstack import project as _project - from napkinstack.pull_request import signed_sheet + from napkinstack.pull_request import SECTION, signed_sheet pull = this_pull(root, commit) signed = signed_sheet(root, pull["number"]) if pull.get("number") and _project.forge(root) == "github" else None @@ -943,6 +943,11 @@ def run(root: Path, base: str, body_file: Path | None, labels: str | None, accep env["NSTACK_SIGNED"] = str(Path(tmp, "signed.json").resolve()) if isinstance(signed, dict) and signed["body"]: print(f"Signed sheet: the latest comment or review of @{signed['author']}, {signed['at']}", flush=True) + elif signed is None and _project.forge(root) == "github" and SECTION.search(body_text): + # D315 (#595): pr-check's warning stays in its step's log; the record's reader sees this line. + print("Signed sheet: not read — no pull request found for this branch (a token finds it): the " + "description's sheet is judged here; the forge's run judges the one signed in a comment.", + flush=True) digest = inputs(root, base, json.dumps([engine, unplaced(origin, root), origin is None, who])) env["NSTACK_INPUTS"] = digest or "" # the head's, for pr-check's T4 while this record is made (D223) for check in CHECKS: diff --git a/src/napkinstack/pull_request.py b/src/napkinstack/pull_request.py index 4dce073..ea4923d 100644 --- a/src/napkinstack/pull_request.py +++ b/src/napkinstack/pull_request.py @@ -1368,6 +1368,15 @@ def tree_of(commit: str) -> str: f"request is not read: {hands}.") if isinstance(signed, str) and (reasons or described): warnings.append(f"[T2] whether the verifier signed the sheet in a comment or a review is not read: {signed}.") + if forge == "github" and signed is None and carried and (reasons or described): + # D315 (#595): no pull request number — a workstation, an attest that found none with no token —, so + # the comments are not read and the description's sheet is judged; the forge's run reads them and + # may judge otherwise. Said, never failed: checks on a workstation stand without a token (ADR-0010 §6). + warnings.append("[T2] the pull request's comments are not read here (no pull request number — on a " + "workstation, a token finds it): the description's sheet is judged, not one the verifier " + "signed in a comment, which the forge's run judges in its place.\n Action: GH_TOKEN " + "for nstack attest, or PR_NUMBER and a token for nstack pr-check, to judge the signed " + "sheet here (.nstack/playbooks/verification.md).") if isinstance(signed, dict) and signed.get("refused"): warnings.append("[T2] a sheet in a comment or a review is not counted as signed: " + "; ".join(signed["refused"]) + ".\n Action: the verifier named signs it from their own account — an agent from its App — " From fd3d8d8762dbfdaebd88cc3887bec0bc38d65aac Mon Sep 17 00:00:00 2001 From: "napkinstack-agent[bot]" <330339777+napkinstack-agent[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 13:15:54 +0100 Subject: [PATCH 2/2] =?UTF-8?q?D315=20=E2=80=94=20attest=20and=20pr-check?= =?UTF-8?q?=20say=20it=20on=20one=20predicate;=20the=20texts=20are=20exact?= =?UTF-8?q?=20(#595)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The verifier found attest's line printed for the template's empty sheet on a change that needs none, where pr-check said nothing. sheet_in_play is now the one predicate: a sheet the description fills, or one a touched module requires. The texts no longer promise that a token alone finds the pull request; verification.md says attest reads the comment with a token, and says so without one. Tests cover silence with no sheet in play, a sheet filled though none is asked, the template's empty sheet, a pull request read, and a forge other than GitHub. Agent-Session: napkinstack-os-1e Co-Authored-By: Claude Opus 5.5 --- platform/tests/test_pull_request.py | 18 ++++++++++++++++++ platform/tests/test_sheet_history.py | 22 ++++++++++++++++++---- skeleton/.nstack/playbooks/verification.md | 3 ++- src/napkinstack/attest.py | 7 ++++--- src/napkinstack/pull_request.py | 15 ++++++++++++--- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/platform/tests/test_pull_request.py b/platform/tests/test_pull_request.py index 766ef5f..6f18698 100644 --- a/platform/tests/test_pull_request.py +++ b/platform/tests/test_pull_request.py @@ -677,6 +677,19 @@ def test_a_person_named_verifier_left_a_trace_on_the_pull_request(tmp_path, caps assert "session" not in verifier or "hand is on this pull request" not in output, output # no hand asked of a session +def test_no_sheet_in_play_nothing_is_said_of_comments_not_read(tmp_path, capsys, monkeypatch): + """D315: a change no module asks a sheet of, and a description with none: no word of comments.""" + base, head = change(tmp_path) + monkeypatch.setattr(pull_request, "signed_sheet", lambda path: None) + check(tmp_path, base, head, "A change.", monkeypatch) + assert "comments are not read" not in capsys.readouterr().out + assert not pull_request.sheet_in_play(tmp_path, base, "A change.") + # A sheet the description fills, though no module asks one: it is judged, so said. + check(tmp_path, base, head, sheet(PASSED, verifier="@dana"), monkeypatch) + assert "comments are not read" in capsys.readouterr().out + assert pull_request.sheet_in_play(tmp_path, base, sheet(PASSED, verifier="@dana")) + + def test_off_github_the_hand_is_not_read(tmp_path, capsys, monkeypatch): base, head = change(tmp_path, USER_FACING) monkeypatch.setattr(pull_request.project, "forge", lambda root: "gitlab") @@ -1086,6 +1099,11 @@ def test_where_the_pull_request_is_not_read_the_description_is_judged_as_ever(tm # D315: with no pull request number, the comments are not read and nothing said it — an attest # without a token recorded 5 of 5 on the description's sheet where the forge's run refused it. assert ("WARNING [T2] the pull request's comments are not read here" in out) is (answer is None), out + # D315: required, the description's sheet left as the template's — the signed one may be in a comment —: said. + monkeypatch.setattr(pull_request, "signed_sheet", lambda path: None) + check(tmp_path, base, head, sheet(PASSED, verifier="<@handle, or session and the agent session's identifier>"), + monkeypatch) + assert "the pull request's comments are not read here" in capsys.readouterr().out monkeypatch.setattr(pull_request.project, "forge", lambda root: "gitlab") monkeypatch.setattr(pull_request, "signed_sheet", lambda path: pytest.fail("read off GitHub")) assert check(tmp_path, base, head, sheet(PASSED, verifier="@dana"), monkeypatch) == 0, capsys.readouterr().out diff --git a/platform/tests/test_sheet_history.py b/platform/tests/test_sheet_history.py index 29b99b7..a880c36 100644 --- a/platform/tests/test_sheet_history.py +++ b/platform/tests/test_sheet_history.py @@ -337,10 +337,24 @@ def test_attest_with_no_pull_request_found_says_the_signed_sheet_is_not_read(ver monkeypatch.delenv(name, raising=False) monkeypatch.setattr(attest, "CHECKS", ()) attest.run(root, base, _body(root, "unfilled", ("S2", GIVEN, "", "", "", "")), "") - assert "Signed sheet: not read — no pull request found for this branch" in capsys.readouterr().out - plain = root.parent / "plain.md" # a description with no sheet: nothing to say - plain.write_text("A change.\n", encoding="utf-8") - attest.run(root, base, plain, "") + assert "Signed sheet: not read — no pull request found for this commit" in capsys.readouterr().out + # The template's sheet left empty, on a change that requires one: said too, as pr-check warns it. + empty = root.parent / "empty.md" + empty.write_text("## Test sheet\n\nVerifier: <@handle, or session and the agent session's identifier>\n", + encoding="utf-8") + attest.run(root, base, empty, "") + assert "Signed sheet: not read" in capsys.readouterr().out + # The pull request read, its comments holding no sheet: nothing to say. + monkeypatch.setattr(pull_request, "this_pull", lambda path, head: {"number": 7, "branch": "d1"}) + monkeypatch.setattr(pull_request, "signed_sheet", lambda path, number=None: { + "body": None, "author": "", "at": "", "more": False, "refused": [], "earlier": []}) + attest.run(root, base, empty, "") + assert "Signed sheet: not read" not in capsys.readouterr().out + # Off GitHub, no pull request is ever read: nothing to say. + monkeypatch.setattr(pull_request, "this_pull", lambda path, head: {"branch": "d1"}) + from napkinstack import project + monkeypatch.setattr(project, "forge", lambda root: "gitlab") + attest.run(root, base, empty, "") assert "Signed sheet: not read" not in capsys.readouterr().out diff --git a/skeleton/.nstack/playbooks/verification.md b/skeleton/.nstack/playbooks/verification.md index ef49155..d361aa7 100644 --- a/skeleton/.nstack/playbooks/verification.md +++ b/skeleton/.nstack/playbooks/verification.md @@ -42,7 +42,8 @@ such a sheet is the one judged: a fix, or a scenario added, is signed again in a by editing the old one. A comment starts no check: **add the `verified` label** to start it — to sign again later, remove it and add it again (missing from a project made before it: `nstack settings --apply` creates it, G11). Where checks are attested, the author runs -`nstack attest` again once you have signed: it reads your comment, as CI does. A sheet signed in +`nstack attest` again once you have signed: with a token (`GH_TOKEN`) it reads your comment, as CI +does; without one it judges the description's sheet, and says so. A sheet signed in the description is still read while no comment holds one, with a warning. ### Your own ground diff --git a/src/napkinstack/attest.py b/src/napkinstack/attest.py index 11af38d..e9cc58e 100644 --- a/src/napkinstack/attest.py +++ b/src/napkinstack/attest.py @@ -916,7 +916,7 @@ def run(root: Path, base: str, body_file: Path | None, labels: str | None, accep # The sheet the verifier signed in a comment or a review, read once on the forge (D305): pr-check, # run below, judges it as the forge's own run would, and the record holds its rows for T4. from napkinstack import project as _project - from napkinstack.pull_request import SECTION, signed_sheet + from napkinstack.pull_request import sheet_in_play, signed_sheet pull = this_pull(root, commit) signed = signed_sheet(root, pull["number"]) if pull.get("number") and _project.forge(root) == "github" else None @@ -943,9 +943,10 @@ def run(root: Path, base: str, body_file: Path | None, labels: str | None, accep env["NSTACK_SIGNED"] = str(Path(tmp, "signed.json").resolve()) if isinstance(signed, dict) and signed["body"]: print(f"Signed sheet: the latest comment or review of @{signed['author']}, {signed['at']}", flush=True) - elif signed is None and _project.forge(root) == "github" and SECTION.search(body_text): + elif signed is None and _project.forge(root) == "github" and sheet_in_play(root, base, body_text): # D315 (#595): pr-check's warning stays in its step's log; the record's reader sees this line. - print("Signed sheet: not read — no pull request found for this branch (a token finds it): the " + print("Signed sheet: not read — no pull request found for this commit (no token, or none open " + "whose head it is): the " "description's sheet is judged here; the forge's run judges the one signed in a comment.", flush=True) digest = inputs(root, base, json.dumps([engine, unplaced(origin, root), origin is None, who])) diff --git a/src/napkinstack/pull_request.py b/src/napkinstack/pull_request.py index ea4923d..a95bc91 100644 --- a/src/napkinstack/pull_request.py +++ b/src/napkinstack/pull_request.py @@ -920,6 +920,15 @@ def charter_without_pdr(root: Path, base: str, files: list[str]) -> list[str]: "correction that decides nothing needs none (.nstack/playbooks/framing.md, Decisions)."] +def sheet_in_play(root: Path, base: str, body: str) -> bool: + """D315: a test sheet matters to this change — the description fills one, or a module it touches + requires one. What pr-check reads as `described or reasons`, for attest to say what pr-check warns.""" + if read_sheet(body)[0]: + return True + fork = _git(root, "merge-base", base, "HEAD").stdout.strip() or base + return any(sheet_reason(folder, found) for folder, found in touched_modules(root, fork, changed_files(root, base)).items()) + + def cycle_left_proposed(root: Path, files: list[str]) -> list[str]: """C11 (D312, #587): a cycle is accepted by what its file says — `status: accepted`, or `accepted_on` while another runs —, never by the approval of the pull request that carries it. A pull request that @@ -1368,12 +1377,12 @@ def tree_of(commit: str) -> str: f"request is not read: {hands}.") if isinstance(signed, str) and (reasons or described): warnings.append(f"[T2] whether the verifier signed the sheet in a comment or a review is not read: {signed}.") - if forge == "github" and signed is None and carried and (reasons or described): + if forge == "github" and signed is None and (reasons or described): # as sheet_in_play # D315 (#595): no pull request number — a workstation, an attest that found none with no token —, so # the comments are not read and the description's sheet is judged; the forge's run reads them and # may judge otherwise. Said, never failed: checks on a workstation stand without a token (ADR-0010 §6). - warnings.append("[T2] the pull request's comments are not read here (no pull request number — on a " - "workstation, a token finds it): the description's sheet is judged, not one the verifier " + warnings.append("[T2] the pull request's comments are not read here (no pull request number given): " + "the description's sheet is judged, not one the verifier " "signed in a comment, which the forge's run judges in its place.\n Action: GH_TOKEN " "for nstack attest, or PR_NUMBER and a token for nstack pr-check, to judge the signed " "sheet here (.nstack/playbooks/verification.md).")