Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/governance/workstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ state to its index: [`docs/adr/`](../adr/README.md), [`docs/pdr/`](../pdr/README
| 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 |
| D297 | **The lifecycle diagram's `proposed → active` gate promised a check nothing holds** (#553, a consumer project, 2026-11-26: a verifier held §6's four conditions by hand). Measured: manifest and owner are checked for every lifecycle (M1, M2); "contract v1" is false for a leaf module, since 4 of that project's 8 active modules provide none; a creation ADR has no place in the manifest | Docs only, `02-modules.md` §6: the transition is decided by the module's ADR, with a contract at v1 when the module provides one; the table says owner and manifest are checked from `proposed` on. Not taken: a fitness function for the transition, two of its conditions already checked, one false, one needing a new field for a once-per-module event |
| D298 | **`Out of cycle: D108` was accepted in silence, then `nstack deliver D108` refused** (#555: a closed cycle deferred D108, the decider had it finished in `out-of-cycle` pull requests; the method's path is a re-framing, and nothing said so until the delivery) | `check_cycle` warns, never fails (K3): an `Out of cycle:` reason that names a deliverable id listed by a cycle file points to re-framing (`framing.md` §4), which gains one sentence on a deferred deliverable coming back. Not taken: a refusal, since a reason may quote an id in an incident; a reason naming a deliverable of the running cycle is told to write its `Deliverable:` line instead |
| 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
41 changes: 41 additions & 0 deletions platform/tests/test_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,47 @@ def test_a_framework_update_is_neither_delivery_nor_a_sheet(tmp_path, capsys, mo
}


def deferred_in_a_closed_cycle(root):
framed(root, cycles={"01-first.md": cycle(status="closed", deliverables=[deliverable(id="D108", state="deferred")]),
"02-next.md": cycle(deliverables=[deliverable(id="D120")])})


@pytest.mark.parametrize(("body", "warned"), [
("Out of cycle: D108", True), # #555: planned work, said to come back by re-framing
("Out of cycle: production crash on start", False),
("Out of cycle: D999", False), # an id no cycle file lists
], ids=["a deliverable of a closed cycle", "an incident", "an id of no cycle"])
def test_out_of_cycle_naming_planned_work_points_to_reframing(tmp_path, capsys, monkeypatch, body, warned):
base, head = change(tmp_path, frame=False)
deferred_in_a_closed_cycle(tmp_path)
result = check(tmp_path, base, head, body, monkeypatch, "out-of-cycle", deliverable_line=None)
output = capsys.readouterr().out
assert result == 0, output
assert "Pull request rules: compliant." in output, output
assert ("names D108, a deliverable of 01-first: planned work comes back by re-framing" in output) is warned, output
assert ("WARNING [K3]" in output) is warned, output


def test_out_of_cycle_reads_the_running_cycle_first_and_stays_silent_unframed(tmp_path, capsys, monkeypatch):
base, head = change(tmp_path, frame=False)
framed(tmp_path, cycles={"01-first.md": cycle(deliverables=[deliverable(id="D108")]),
"02-later.md": cycle(status="proposed", deliverables=[deliverable(id="D108")])})
check(tmp_path, base, head, "Out of cycle: D108", monkeypatch, "out-of-cycle", deliverable_line=None)
assert "a deliverable of the running cycle 01-first" in capsys.readouterr().out
framed(tmp_path, cycles={"01-first.md": cycle(status="closed", deliverables=[deliverable(id="D108")])})
check(tmp_path, base, head, "Out of cycle: D108", monkeypatch, "out-of-cycle", deliverable_line=None)
assert "WARNING [K3]" not in capsys.readouterr().out


def test_out_of_cycle_naming_a_deliverable_of_the_running_cycle_says_write_its_line(tmp_path, capsys, monkeypatch):
base, head = change(tmp_path, frame=False)
deferred_in_a_closed_cycle(tmp_path)
assert check(tmp_path, base, head, "Out of cycle: D120", monkeypatch, "out-of-cycle", deliverable_line=None) == 0
output = capsys.readouterr().out
assert "a deliverable of the running cycle 02-next: it is delivery work" in output, output
assert "Deliverable: D120" in output and "re-framing" not in output, output


@pytest.mark.parametrize(("prepare", "body", "labels", "expected", "code"), CYCLE_CASES.values(), ids=CYCLE_CASES.keys())
def test_cycle(tmp_path, capsys, monkeypatch, prepare, body, labels, expected, code):
base, head = change(tmp_path, frame=False)
Expand Down
5 changes: 5 additions & 0 deletions skeleton/.nstack/playbooks/framing.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ from then on the plan check refuses an accepted charter over a form left as it c
swapping a deliverable out, adding one they judge fits what is left of the appetite —
the end date does not move — or closing the cycle early. An added deliverable takes its
criteria like the others, and its section says on whose word and on what it entered.
A deliverable a closed cycle deferred comes back the same way, under its id. `nstack deliver`
counts the merges that name it — a title opening `D<n> —` or ending `(D<n>)`, or a
`Deliverable:` line; one merged before the cycle started is carried over, and only a person's
answer can then be cited for its criteria. `out-of-cycle` is not its path, and its hold ended
with the closed cycle (`nstack unclaim` says so).
- **An urgent fix** outside the cycle — an incident, a production defect — goes in a pull
request with the `out-of-cycle` label and the line `Out of cycle: <reason>`.
- **A deliverable's state** is written in the cycle file at framing (`proposed`, then `ready`:
Expand Down
31 changes: 31 additions & 0 deletions src/napkinstack/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,13 +589,44 @@ def check_sheet(body: str, head: str, reasons: list[str], fail: Fail,
return human_only


def _planned_work(root: Path, reason: str, warn: Callable[[str], None]) -> None:
"""K3, said and never refused (#555): a reason that names a deliverable of a cycle file is planned
work, and its path is a re-framing, not the label."""
running = plan.accepted_cycle(root)
if running is None: # unframed, or between two cycles: there is no cycle to re-frame
return
owners: dict[str, Path] = {} # deliverable id -> the latest cycle file that lists it, the running one first
states: dict[str, object] = {}
for path in [p for p in plan.cycle_files(root) if p != running[0]] + [running[0]]:
try:
items = (plan.read_front_matter(path)[0] or {}).get("deliverables")
except OSError:
continue
for item in items if isinstance(items, list) else []:
if isinstance(item, dict):
owners[str(item.get("id"))], states[str(item.get("id"))] = path, item.get("state")
named = next((i for i in re.findall(r"\bD\d+\b", reason) if i in owners), None)
if named and owners[named] == running[0] and not plan.one_of(states[named], {"ready", "in-progress", "proposed"}):
return # accepted, deferred or dropped in the running cycle: a fix to it may well be out of cycle
if named and owners[named] == running[0]:
warn(f"[K3] 'Out of cycle: {reason}' names {named}, a deliverable of the running cycle {running[0].stem}: "
f"it is delivery work.\n Action: write 'Deliverable: {named}' and remove the label.")
elif named:
warn(f"[K3] 'Out of cycle: {reason}' names {named}, a deliverable of {owners[named].stem}: planned work "
"comes back by re-framing — the decider adds it to the running cycle "
"(.nstack/playbooks/framing.md §4), then nstack deliver records it. Out of cycle is for an "
"incident or a production defect.")


def check_cycle(root: Path, body: str, labels: set[str], today: datetime.date, fail: Fail,
warn: Callable[[str], None] = lambda message: None) -> None:
"""K1 to K4, for delivery work."""
if LABEL in labels:
if not JUSTIFICATION.search(body):
fail("K4", f"label {LABEL} without its justification.\n Action: add "
"\"Out of cycle: <reason>\" to the description — an incident, a production defect.")
else:
_planned_work(root, JUSTIFICATION.search(body)[1], warn)
return
stage = plan.stage(root)
if stage == plan.UNREADABLE:
Expand Down