Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
unchanged — the digest of its inputs, not the commit and base — for seven days and twenty
commits of the default branch at most; an automated sheet row stands on the same digest —
decisions 2, 3 and 7. **Amended 2026-11-18 (D242, #441)**: the project's records
(`docs/project/`, `docs/adr/`, `docs/pdr/`) are left out of that digest — decision 2
(`docs/project/`, `docs/adr/`, `docs/pdr/`) are left out of that digest — decision 2.
**Amended 2026-11-26 (D296, #550)**: so are the Markdown files at the repository's root —
decision 2
- **Date**: 2026-10-20
- **Decision makers**: NapkinStack maintainers (`@NapkinStack/maintainers`)
- **Scope**: project — the engine (`nstack attest`, `pr-check`, `doctor`), the Copier
Expand Down Expand Up @@ -96,7 +98,10 @@ the workflows, and without a forge being required.
a rules document merged on the default branch cost every open pull request its end-to-end runs
again. The rest of the root `docs/` stays an input: downstream, an end-to-end run checks that
the privacy page states the paths the package leaves. A check that does read a record is an
undeclared input, bounded as below;
undeclared input, bounded as below; *amended (D296, #550)*: the Markdown files at the
repository's root — `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `AGENTS.md`… — are
records too: a line of the root README cost an open pull request an hour of end-to-end runs.
A file under a folder stays an input, and so does a symbolic link: its target is what is read;
- the engine and the person, as before.

Their digest, SHA-256 over those ids in a fixed order, is kept in the record. The check is kept
Expand Down
2 changes: 1 addition & 1 deletion docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ See `skeleton/.nstack/handbook/06-decisions.md`.
| [0003](./0003-adopt-english-as-the-repository-language.md) | Adopt English as the repository language | Accepted; shrunk to the rule in force (2026-09-24) | Observed at the v0.2.0 to v0.4.0 releases, where the record holds the observation; a project's `init` to confirm — the pilot was set aside on 2026-10-15 |
| [0004](./0004-give-agents-their-own-github-identity.md) | Give agents their own GitHub identity, behind a human approval | Accepted, clarified (who verified; an approval covers what it read; two powers; an agent approves on `approval: agent`; the identity in one command, D196) | The pilot project, before 2026-12-31 — the pilot was set aside on 2026-10-15 |
| [0005](./0005-run-a-project-s-module-checks-in-one-job.md) | Run a project's module checks in one job | Accepted (2026-10-15) | Twenty pull requests of the third project, before 2026-12-31 |
| [0006](./0006-attest-checks-in-git-notes-bound-to-the-commit.md) | Attest checks in git notes, bound to the commit | Accepted (2026-10-20), the how of PDR-0013; built in D129; amended D223 (a check kept on the digest of its inputs) and D242 (the records left out) | Twenty pull requests of the third project, before 2027-03-31 |
| [0006](./0006-attest-checks-in-git-notes-bound-to-the-commit.md) | Attest checks in git notes, bound to the commit | Accepted (2026-10-20), the how of PDR-0013; built in D129; amended D223 (a check kept on the digest of its inputs) D242 (the records left out) and D296 (the root's Markdown files too) | Twenty pull requests of the third project, before 2027-03-31 |
| [0007](./0007-hold-a-deliverable-on-a-branch-of-its-own.md) | Hold a deliverable on a branch of its own | Accepted (2026-10-21), the how of PDR-0015; built in D137; clarified 2026-11-01 (D193): the record of a delivery | Two contributors on one project, and one bare git remote, before 2027-03-31 |
| [0008](./0008-show-the-plan-as-milestones-and-issues-applied-by-ci.md) | Show the plan as milestones and issues, applied by CI | Accepted (2026-10-21), the how of PDR-0016, after an independent review; clarified D253 (two runs at once) | The third project's next two cycles, before 2027-03-31 |
| [0009](./0009-audit-a-run-s-logs-in-its-evidence-folder.md) | Audit a run's logs in its evidence folder | Accepted (2026-10-21), the how of PDR-0017, after an independent review; clarified 2026-10-24 (#246) | The third project's window and recorder runs, before 2027-03-31 |
Expand Down
1 change: 1 addition & 0 deletions docs/governance/workstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ state to its index: [`docs/adr/`](../adr/README.md), [`docs/pdr/`](../pdr/README
| 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<n> --person @<author>`) 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 `<one sentence per change>`) 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 |
| D295 | **T4 lets an automated row stand at a commit nobody attested** (#548): with `checks: attested`, a pull request verified at X merged the default branch where only another module changed, and T4 refused the automated rows because the relief asked a passing record of X, which projects rarely make (they attest after verifying) — stricter than a row at the head, which needs none | Done: `attest.inputs` takes the commit to read (default `HEAD`); where X has no record at all (a voided one, or one whose `Module checks` failed, is refused as before), `same_inputs` computes the digest from git at X and at the head (same placeholder identity, same base, the scope read from the working tree's manifests — on the forge the test merge, which can only widen it) and the row stands when they are equal, X is in the head's history, and its run, dated by X's commit, is as fresh as a record's; the head's digest is computed once per run, before the head's record is required. When they differ the message is the record path's, with what changed. The git-only digest drops the engine and the runner, which nothing records for an unrecorded commit — as for a row at the head. A record of X is still read first, with its freshness; `checks: forge` unchanged. The handbook's sentence says so. ADR-0006 states no record requirement for the row's commit beyond decision 3's digest, so it is untouched. Tests: no record across a merge of another module stands; a merge that changed `contracts/` or the lockfile is refused naming it; a voided X, a failed X, a stale X, a side-branch X and an X missing a module folder are refused; the head's digest is read once; the keep by record is unchanged |
| D296 | **A root README change costs every open pull request its end-to-end runs** (#550, a consumer project, 2026-11-26: a row verified at a commit with a passing record was refused because the merged default branch changed only another module and the root `README.md`; about an hour of end-to-end runs for a line of prose). ADR-0006 decision 2 kept every tracked path outside the modules as an input, the records of D242 excepted | The Markdown files at the repository's root (no `/` in the path) are records, left out of the inputs digest and of what T4 names as changed; ADR-0006 amended. The root `docs/` stays an input (D242's reason), as do `.nstack/`, `contracts/`, `platform/` and lockfiles. Not taken: a manifest field declaring the root files a module reads, which Turborepo and Nx offer: a second declaration of the module graph, for a case no module has shown |
| 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 |
Expand Down
37 changes: 33 additions & 4 deletions platform/tests/test_attest.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,10 @@ def main_moves(root: Path, path: str) -> None:
"""Another change lands on main, and the branch merges main in."""
git(root, "switch", "-q", "main")
target = root / path
target.write_text(target.read_text(encoding="utf-8") + "more\n", encoding="utf-8")
git(root, "commit", "-q", "-am", f"{path} moves")
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text((target.read_text(encoding="utf-8") if target.exists() else "") + "more\n", encoding="utf-8")
git(root, "add", path)
git(root, "commit", "-q", "-m", f"{path} moves")
git(root, "switch", "-q", "work")
git(root, "merge", "-q", "--no-edit", "main")

Expand All @@ -744,7 +746,8 @@ def counting(tmp_path, monkeypatch):
return root


@pytest.mark.parametrize("path", ["modules/c/code.py", "docs/project/rules.md", "docs/project/résumé.md"])
@pytest.mark.parametrize("path", ["modules/c/code.py", "docs/project/rules.md", "docs/project/résumé.md", "README.md",
"CHANGELOG.md", "NOTES.MD"])
def test_a_merge_in_that_touches_nothing_the_module_reads_keeps_its_check(counting, capsys, path):
"""#441 (D242): the project's records under the root `docs/` are read by no module check; a line
of a rules document merged on main cost every open pull request its end-to-end runs again."""
Expand All @@ -762,7 +765,7 @@ def test_a_merge_in_that_touches_nothing_the_module_reads_keeps_its_check(counti


@pytest.mark.parametrize("path", ["modules/b/code.py", "uv.lock", "modules/a/code.py", "contracts/doc.md",
"platform/doc.md", "docs/privacy.md"])
"platform/doc.md", "docs/privacy.md", ".nstack/handbook/x.md", "README.txt"])
def test_a_merge_in_that_touches_what_the_module_reads_runs_it_again(counting, path):
root = counting
base = modular(root)
Expand Down Expand Up @@ -1633,3 +1636,29 @@ def refused(path, *args, **kwargs):
monkeypatch.setattr(os, "rmdir", refused)
assert attest.run(tmp_path, "HEAD", None, "") == 0, capsys.readouterr().out
assert "Record of" in capsys.readouterr().out


def test_t4_does_not_name_a_root_markdown_file_among_what_changed(counting):
"""#550 (D296): a root README is a record; what T4 names as changed leaves it out."""
root = counting
base = modular(root)
first = git(root, "rev-parse", "HEAD")
main_moves(root, "README.md")
main_moves(root, "uv.lock")
named = pull_request._what_changed(root, base, first, git(root, "rev-parse", "HEAD"))
assert "uv.lock" in named and "README" not in named, named


def test_a_root_markdown_symbolic_link_stays_an_input(tmp_path):
"""#550 (D296): a root `x.md` that links elsewhere is read through its target: retargeting it moves the digest."""
root = tmp_path / "p"
root.mkdir()
base = modular(root)
os.symlink("contracts/doc.md", root / "x.md")
git(root, "add", "x.md")
git(root, "commit", "-q", "-m", "link")
before = attest.inputs(root, base)
(root / "x.md").unlink()
os.symlink("uv.lock", root / "x.md")
git(root, "commit", "-q", "-am", "relink")
assert before and attest.inputs(root, base) != before
3 changes: 2 additions & 1 deletion skeleton/.nstack/handbook/05-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ acceptance criteria of its deliverable.
attested, it stands when nothing its modules read moved since its run: the records of its
commit and of the head hold the same `inputs` digest — the modules run, those they consume
from or assemble, the files outside the modules, `contracts/` and `platform/` included, the
project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) left out, the engine and the
project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) and the Markdown files at the
repository's root (`README.md`, `CHANGELOG.md`…) left out, the engine and the
person — and the run is at most 7 days old, the default branch moved by 20 commits at most. A
module that reads something it does not declare is the risk: declare it in `consumes` — a
record cannot be declared: a check never reads one —, and the default branch's own `Module
Expand Down
3 changes: 2 additions & 1 deletion skeleton/.nstack/handbook/07-governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ by a commit with no change of its own — tracked or not. The record says which
outside it hold is not compared: `nstack attest --again` runs them. They are also kept
across commits — a merge of the default branch that touched nothing they read: their modules,
those they consume from or assemble, `contracts/`, `platform/` and the files outside the modules but the
project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) — while the
project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) and the Markdown files at the
repository's root — while the
digest of what they read is unchanged, for 7 days and 20 default-branch commits at most. A record
known to be unsound — two runs that shared what a run must not share, a tool found lying — is
voided: `nstack attest --void <commit> --reason "<why>"` adds a line naming who, why and every
Expand Down
12 changes: 10 additions & 2 deletions src/napkinstack/attest.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,18 @@ def keep_log(root: Path, commit: str, check: str, steps: list[tuple[str, str]])
RECORDS = ("docs/project/", "docs/adr/", "docs/pdr/")


def is_record(path: str) -> bool:
"""A path no module check is meant to read (ADR-0006 decision 2): the project's records (D242), and
the Markdown files at the repository's root — README, CHANGELOG, CONTRIBUTING… (D296, #550)."""
return path.startswith(RECORDS) or ("/" not in path and path.lower().endswith(".md"))


def inputs(root: Path, base: str, identity: str = "", commit: str = "HEAD") -> str | None:
"""The digest of what `Module checks` reads at `commit`, HEAD by default (ADR-0006 decision 2, D223): the folders of
the modules it runs, of those they consume from or assemble, every tracked path outside the
module folders — `contracts/` and `platform/` included, which every module reads — but the
project's records, `docs/project/`, `docs/adr/` and `docs/pdr/` (D242), and who runs it with which
project's records, `docs/project/`, `docs/adr/` and `docs/pdr/` (D242), and the root's Markdown
files (D296) — a symbolic link stays an input: its target is what is read —, and who runs it with which
engine; git's ids, never hashed by hand. None when it cannot be told: no key."""
# The scope is the working tree's: the head locally and under nstack attest; on the forge the checkout
# is the test merge, which can only widen it — conservative (D295). Read at `commit`, a manifest that
Expand All @@ -438,7 +445,8 @@ def inputs(root: Path, base: str, identity: str = "", commit: str = "HEAD") -> s
if listed.returncode:
return None
lines += [line for line in listed.stdout.split("\0")
if line and not line.split("\t", 1)[-1].startswith((*inside, *RECORDS))]
if line and not line.split("\t", 1)[-1].startswith(inside)
and (line.startswith("120000") or not is_record(line.split("\t", 1)[-1]))]
return hashlib.sha256("\n".join(lines).encode("utf-8", "surrogateescape")).hexdigest()


Expand Down
2 changes: 1 addition & 1 deletion src/napkinstack/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ def _what_changed(root: Path, base: str, commit: str, head: str) -> str:
folder = next((one for one in folders if path.startswith(f"{one}/")), None)
if folder:
counted[folder] = counted.get(folder, 0) + 1
elif not path.startswith((*inside, *attest.RECORDS)):
elif not path.startswith(inside) and not attest.is_record(path):
counted[path] = 0
if not counted:
return nothing
Expand Down