diff --git a/docs/governance/workstreams.md b/docs/governance/workstreams.md index d3c3ef7..6bbf86f 100644 --- a/docs/governance/workstreams.md +++ b/docs/governance/workstreams.md @@ -310,6 +310,7 @@ state to its index: [`docs/adr/`](../adr/README.md), [`docs/pdr/`](../pdr/README | 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) | +| D294 | **The template's text left in a description is named** (#543): a pull request kept sections at the template's own text ("What it changes", the Summary's ``) and pr-check said nothing; the row copied as an example came from the handbook's table, while the template's own row was already a placeholder T2 refuses | Done: pr-check warns `[template]`, once, naming each paragraph of the description outside the test sheet that is wholly one `<...>` placeholder (HTML tags, comments and attributes are not one); the warning is not a failure and only runs when the description is carried. The handbook's example table now says it is an example from a sign-in module and that a sheet's scenarios come from its own deliverable's acceptance criteria. Tests: a kept placeholder and title heading are named, a filled description is silent, HTML lines stay silent, a placeholder inside the sheet is T2's and not named | | 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_pull_request.py b/platform/tests/test_pull_request.py index 8411526..1439199 100644 --- a/platform/tests/test_pull_request.py +++ b/platform/tests/test_pull_request.py @@ -330,6 +330,33 @@ def test_pr_check_on_an_unknown_base(tmp_path, capsys, monkeypatch): assert "FAIL [pr-check] base 'nope' not found" in capsys.readouterr().out +def test_the_template_s_text_left_in_a_description_is_named(tmp_path, capsys, monkeypatch): + base, head = change(tmp_path) + body = ("# \n\n**DONE**\n\n" + "\n**VERIFIED**\n\n") + assert check(tmp_path, base, head, body, monkeypatch) == 0 + warning = next(line for line in capsys.readouterr().out.splitlines() if line.startswith("WARNING [template]")) + assert "''" in warning and "'") == 1, warning + + +def test_a_filled_description_and_html_stay_silent(tmp_path, capsys, monkeypatch): + base, head = change(tmp_path) + body = ("# Sign-in keeps the email\n\n**DONE**\nthe form keeps what was typed\n\n
\n\n\n\n" + "\n\n
\n\n
\n\n\n\n```\n\n\n\n```\n\n" + "~~~mermaid\n\n\n\n~~~\n") + assert check(tmp_path, base, head, body, monkeypatch) == 0 + assert "[template]" not in capsys.readouterr().out + + +def test_a_placeholder_in_the_test_sheet_is_t2_s_not_the_template_warning(tmp_path, capsys, monkeypatch): + base, head = change(tmp_path, USER_FACING) + body = sheet(TEMPLATE, verifier="<@handle, or session and the agent session's identifier>") + body = body.replace("\n\n## Summary", "\n\n\n\n## Summary") + check(tmp_path, base, head, body, monkeypatch) + assert "[template]" not in capsys.readouterr().out + + def test_without_a_description_nothing_is_checked(tmp_path, capsys, monkeypatch): base, _ = change(tmp_path, USER_FACING) monkeypatch.delenv("PR_BODY", raising=False) diff --git a/skeleton/.nstack/handbook/05-workflow.md b/skeleton/.nstack/handbook/05-workflow.md index e4db9d6..9cadc5c 100644 --- a/skeleton/.nstack/handbook/05-workflow.md +++ b/skeleton/.nstack/handbook/05-workflow.md @@ -327,7 +327,10 @@ carries a **test sheet** in its description. Editing only a module's description — its manifest, `AGENTS.md`, `README.md`, `docs/` — changes no behaviour and needs no sheet, a framework update included; a manifest that moves the module's criticality or its user-visible surface does change the module. Both are read before and after -the change, and the stricter applies: +the change, and the stricter applies. + +The rows below are an example, from a sign-in module. A sheet's own scenarios come from the +acceptance criteria of its deliverable. | # | Given · when · then | Kind | Result | Evidence | Commit | Confirmed | |---|---|---|---|---|---|---| diff --git a/src/napkinstack/pull_request.py b/src/napkinstack/pull_request.py index e8cadbe..a8a5cf9 100644 --- a/src/napkinstack/pull_request.py +++ b/src/napkinstack/pull_request.py @@ -243,6 +243,26 @@ def read_sheet(body: str) -> tuple[str, list[str], list[dict[str, str]]]: return verifier, header, rows +def template_text(body: str) -> list[str]: + """The placeholders the description still carries outside its test sheet (T2 owns the sheet's): + each paragraph that is wholly one `<...>`, a heading marker or a bold label line set aside. + HTML is not one: a tag or a comment has no space, starts with ! or /, or holds = or ". A fenced + block is code, never the template's text; each placeholder is named once.""" + if match := SECTION.search(body): + rest = body[match.end():] + following = NEXT_SECTION.search(rest) + body = body[:match.start()] + (rest[following.start():] if following else "") + body = re.sub(r"^[ \t]*(`{3,}|~{3,}).*?^[ \t]*\1[ \t]*$", "", body, flags=re.MULTILINE | re.DOTALL) + found: list[str] = [] + for paragraph in re.split(r"\n[ \t]*\n", body): + text = re.sub(r"^\*\*[^*\n]*\*\*[ \t]*\n", "", re.sub(r"^#+[ \t]+", "", paragraph.strip())) + inner = text[1:-1] + if PLACEHOLDER.fullmatch(text) and re.search(r"\s", inner) and inner[0] not in "!/" and not re.search(r'["=]', inner): + if (one := " ".join(text.split())) not in found: + found.append(one) + return found + + def authors(root: Path, base: str, head: str, opener: str) -> tuple[set[str], set[str], list[str]]: """(GitHub logins, agent sessions, agent commits naming no session) of the commits the pull request brings — its head, less the base, less merges: CI checks out a merge commit, and @@ -1112,6 +1132,9 @@ def tree_of(commit: str) -> str: if isinstance(hands, str): warnings.append(f"[T2] whether {', '.join(m[0] for m in HANDLES.finditer(verifier))}'s hand is on this pull " f"request is not read: {hands}.") + if carried and (left := template_text(body)): + quoted = ", ".join(f"'{t if len(t) <= 60 else t[:57] + '...'}'" for t in left) + warnings.append(f"[template] the template's text is still in the description: {quoted} — replace it or delete it.") human_only = check_sheet(body, head, reasons, fail, authorship, rerun_at_head(modules), lambda commit: bool(tree_of(commit)) and tree_of(commit) == tree_of(head), hands if isinstance(hands, set) else None, same_inputs(root, head, base, warnings.append)) if carried else []