Skip to content

Commit 8e01fdb

Browse files
committed
Merge branch 'subtrees'
2 parents f0e8cf6 + f5b8d27 commit 8e01fdb

4,185 files changed

Lines changed: 940073 additions & 765 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎repos/constitution/AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Before making changes:
2727

2828
- **`CONSTITUTION.md` (Resident):** the entire maker corpus — the Application section plus Articles I–V — loaded in every session. There is no retrieved half and no on-demand trigger: law that is not in the window is not law. Residency delivers obligation, not enforcement; the machinery of judgment lives outside the maker's reach.
2929
- **`ENFORCEMENT.md` (Non-resident):** the instrument owner's doctrine — gate design, instrument-change discipline, enrollment law. Read by whoever builds or changes a gate, never `@`-imported into a maker's context. Consumer repos route to it from the leaves that own enforcement surfaces (lint plugins, guard scripts, CI workflows, rules directories, advisor rosters): one line — "You are editing an enforcement instrument. Read the vendored `ENFORCEMENT.md` before this lands." A routing line added anywhere else is the defect: the maker must not meet instrument doctrine while doing graded work.
30+
- **`docs/solutions/`:** past problems and their fixes, organized by category with YAML frontmatter (`module`, `tags`, `problem_type`); `CONCEPTS.md` at repo root holds shared domain vocabulary.
3031

3132
### Writing a Rule
3233

‎repos/constitution/CONCEPTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ Shared domain vocabulary for this project — entities, named processes, and sta
88
The complete set of law documents the repository ships, treated as one unit. The corpus is what the gate certifies and what agents are bound by — not any single file's contents. Shrinking the measured portion of the corpus is a defect, not an optimization.
99

1010
### Rule
11-
One fenced YAML block inside the constitution carrying an id of the form `CONST-<family><number>` — the family letter is one of G, E, P, D, B, T, N, W, S (governance, enforcement, purity, domain modelling, boundary, testing, naming & structure, work discipline, subtraction). A rule is the atomic unit of law: it is minted with a fresh number, amended in place, or vacated. Minting takes the next free number in the family — a minting law enforced by review, not by the gate. A vacated number is never reused for new law.
11+
One fenced YAML block inside the constitution carrying an id of the form `CONST-<family><number>` — the family letter is one of G, E, P, D, B, T, N, W, S (governance, enforcement, purity, domain modelling, boundary, testing, naming & structure, work discipline, subtraction). A rule is the atomic unit of law: it is minted with a fresh number, amended in place, or vacated. Amending in place keeps the obligation and the title; a changed obligation or title vacates the number and, if the law survives, mints a new one. Minting takes the next free number in the family — a minting law enforced by review, not by the gate. A vacated number is never reused for new law.
1212

1313

1414
### Vacuous pass
1515
A gate exiting green because it measured less than it claims — a missing input, an input that contributes nothing, a comparison arm that reads only part of the history. The output shape is identical to a healthy run, so the green actively certifies the absence of defects it did not look for. The doctrine this repo's gate is built on: assert the corpus, not only the contents; a gate that cannot fail is a certificate, not enforcement.
1616

1717
### Residency
18-
The delivery contract for the maker's law: whatever must bind the agent's choices is always present in its context window, with no retrieval step. The counter-design — a thin resident pointer plus retrieved full text — forces presence at fetch time but never conformance at use time. Residency delivers obligation, not enforcement: the window tells the maker what is required, and whether the requirement held is decided afterward by instruments the maker cannot edit (ENFORCEMENT.md). What cannot fit residency is reference material and instrument doctrine, not law.
18+
The delivery contract for the maker's law: whatever must bind the agent's choices is always present in its context window, with no retrieval step. The counter-design — a thin resident pointer plus retrieved full text — forces presence at fetch time but never conformance at use time. Residency delivers obligation, not enforcement: the window tells the maker what is required, and whether the requirement held is decided afterward by instruments the maker cannot edit. What cannot fit residency is reference material and instrument doctrine, not law.
1919

2020
### Corpus gate
2121
The single check that certifies the constitution corpus — schema of every rule block, id and family registry, citation integrity across the corpus, and cross-revision comparison on demand. It runs as the repository's test command and again at every commit through the pre-commit hook, which makes any corpus-shape change also a gate change: the gate certifies the very input set a restructure edits.

‎repos/constitution/CONSTITUTION.md‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,26 +267,17 @@ rules:
267267
- treat a mutation or property score as proof a deleted published capability still exists — those are blind to absence
268268
- leave a persisted gold after the old path is gone unless the gold is externally authored, independently gated, and cheap to re-bless
269269
harm: a rebuild silently drops a capability; same-session gold blesses the bug; a clean score after a delete is a silent regression
270-
check: review — pins call only published names; each expected value names an independent source (spec clause, prior published major, second implementation, or a hand-written oracle next to the constructor)
270+
check: review — pins call only published names; each expected value names an independent source (spec clause, second implementation, or a hand-written oracle next to the constructor), never the subject's own output or a second build of it
271271
- id: CONST-T10
272272
title: The Oracle Is Not the System Under Test
273273
gate: review
274274
do: every assertion has an oracle the SUT did not produce — a spec literal, a fixture not generated by importing the module, a law relating two views of the same value, or a second implementation; generated round-trip laws on a type cover what the type accepts and nothing it should reject, so a hand-written refusal survives beside them at any specifiable refusal boundary
275275
dont:
276-
- compute expected by calling the SUT
276+
- compute or record the expected value by running the code under test, or any build or version of it
277277
- assert collaborator call graphs
278278
- treat generated accept-laws as full coverage of a refinement
279279
harm: a green suite that cannot fail when the behavior is wrong; widening a refinement leaves generated laws green
280280
check: review — plus sabotage (after green, break one core law and one published field; at least one test must go red)
281-
- id: CONST-T11
282-
title: Snapshots and Differentials Are Published-Surface Oracles
283-
gate: lint
284-
do: snapshot only canonicalized published output; compare two implementations only of the same published operation (or a prior published major against current)
285-
dont:
286-
- snapshot or compare private helpers, mappers, or unexported modules
287-
- snapshot a value small enough to be a property or a named example
288-
harm: tests that fail on refactors callers cannot see and pass on contract breaks they can
289-
check: lint — snapshot and differential fixtures are produced only through the package's published export map
290281
- id: CONST-T12
291282
title: What a Test Does Comes from What It Calls, Not Its Filename
292283
gate: lint

‎repos/constitution/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](LICENSE)
44
[![System F Software](https://img.shields.io/badge/systemfsoftware.com-constitution-black?style=flat-square)](https://systemfsoftware.com/constitution)
5-
[![Rules: 38](https://img.shields.io/badge/rules-38%20in%20corpus-blue?style=flat-square)](CONSTITUTION.md)
5+
[![Rules: 37](https://img.shields.io/badge/rules-37%20in%20corpus-blue?style=flat-square)](CONSTITUTION.md)
66

77
Shared engineering laws for repositories at [System F Software](https://systemfsoftware.com).
88

@@ -36,13 +36,13 @@ git subtree add --prefix=vendor/constitution refs/remotes/vendor/constitution --
3636
ln -s vendor/constitution/CONSTITUTION.md CONSTITUTION.md
3737
```
3838

39-
Include `@CONSTITUTION.md` in your agent harness (`AGENTS.md` or `CLAUDE.md`) so all 38 rules remain always-on in the context window. Never include `ENFORCEMENT.md` there — it is doctrine for whoever builds the gates, not for the agent the gates grade. Instead, wire it at the surfaces that own instruments: in every `AGENTS.md` leaf governing a lint plugin, guard script, CI workflow, rules directory, or advisor roster, add one routing line — "You are editing an enforcement instrument. Read the vendored `ENFORCEMENT.md` before this lands."
39+
Include `@CONSTITUTION.md` in your agent harness (`AGENTS.md` or `CLAUDE.md`) so all 37 rules remain always-on in the context window. Never include `ENFORCEMENT.md` there — it is doctrine for whoever builds the gates, not for the agent the gates grade. Instead, wire it at the surfaces that own instruments: in every `AGENTS.md` leaf governing a lint plugin, guard script, CI workflow, rules directory, or advisor roster, add one routing line — "You are editing an enforcement instrument. Read the vendored `ENFORCEMENT.md` before this lands."
4040

4141
---
4242

4343
## The Articles
4444

45-
The 38 rules are structured across six sections in [`CONSTITUTION.md`](CONSTITUTION.md):
45+
The 37 rules are structured across six sections in [`CONSTITUTION.md`](CONSTITUTION.md):
4646

4747
| Section | Key Invariants |
4848
| :--- | :--- |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: A test never takes its expected value from the code under test
3+
date: 2026-09-23
4+
category: architecture-patterns
5+
module: constitution corpus
6+
problem_type: architecture_pattern
7+
component: tooling
8+
severity: high
9+
applies_when:
10+
- a test's expected value was recorded from, or computed by, the code under test
11+
- a snapshot, golden file, or build-to-build comparison is proposed as a committed test
12+
root_cause: the code under test on both sides of the assertion
13+
tags: [constitution, characterization, snapshot, differential, testing, oracle]
14+
---
15+
16+
## The defect
17+
18+
A test whose expected value came from the code under test is a tautology: it asserts that the
19+
code equals itself, so it passes whether or not the code is right. It shows up under three names:
20+
21+
- a snapshot or golden file recorded from the code's current output
22+
- an approval test that replays a legacy script's output as the specification
23+
- a differential that compares the code against another build or version of itself
24+
25+
## Where the corpus says it
26+
27+
One line in CONST-T10, `dont`: "compute or record the expected value by running the code under
28+
test, or any build or version of it". Recording an expected value is computing it by running the
29+
code earlier, so all three names above fall under that line.
30+
31+
CONST-T9 covers the two legitimate neighbours: comparing old and new during a migration until they
32+
agree, then deleting the old; and persisted gold that is externally authored and independently
33+
gated. A comparison against a genuinely independent implementation is an oracle under CONST-T10,
34+
not a tautology.
35+
36+
## Enforcement
37+
38+
Review only. On 2026-09-23 no snapshot-API lint existed in this repo, in
39+
`systemfsoftware/are-the-types-wrong`, or in `systemfsoftware/systemfsoftware`. A mechanical check
40+
belongs to whoever owns the lint instruments, not to the author of the rule (CONST-E9).

‎repos/constitution/docs/solutions/architecture-patterns/the-vacuous-pass-gate-input-sets.md‎

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: A gate can go green because it stopped looking
33
date: 2026-08-18
4-
last_updated: 2026-09-01
4+
last_updated: 2026-09-23
55
category: architecture-patterns
66
module: constitution corpus validator
77
problem_type: architecture_pattern
@@ -40,6 +40,7 @@ input set had been widened to a tuple of paths:
4040
because a newly created file legitimately has nothing to compare. That tolerance also
4141
swallowed a path **renamed** in the same commit that re-scoped a rule: the older
4242
revision had no such path, so the rule's retitle went uncompared and the run reported
43+
no reassignment.
4344
- A fourth shape surfaced when the surgery ran in the other direction — merging the two
4445
files back into one while the gate's input tuple narrowed to a single path. There was
4546
no legal intermediate commit. Landing the gate first left the live citation from the
@@ -72,6 +73,7 @@ measured. Three rules follow.
7273
would fire on correct work: a deliberate deletion, a genuinely new input with no
7374
history. Name them on the success line — which inputs were not compared, which
7475
identifiers vacated — so the reader sees the reduced coverage instead of inferring
76+
full coverage from a clean exit.
7577

7678
**Enumerate the orderings before choosing atomicity.** When the change edits both the
7779
corpus and the gate that certifies it, write out every commit ordering and prove each
@@ -126,38 +128,26 @@ the gate was now sound.
126128

127129
## Examples
128130

129-
Before — a single named input. Correct, and silently correct about a third of the corpus
130-
once the corpus grew:
131+
The corpus validator names its input set as a collection (`PATHS`), and an absent input is
132+
fatal rather than a smaller pass:
131133

132-
```python
133-
PATH = "ONE_FILE.md"
134-
text = open(PATH, encoding="utf-8").read()
135-
# ... one file's worth of checking, exit 0
136-
```
137-
138-
After — the input set is a collection, absence is fatal, and emptiness is fatal:
139-
140-
```python
141-
PATHS = ("RESIDENT.md", "RETRIEVED.md")
142-
143-
for p in PATHS:
144-
try:
145-
texts[p] = open(p, encoding="utf-8").read()
146-
except FileNotFoundError:
147-
fail([f"{p}: missing — half a corpus scores exactly like a whole one"])
134+
```ts
135+
const PATHS = ["CONSTITUTION.md"] as const;
148136

149-
# ... after parsing, every declared input must have produced something
150-
for p in PATHS:
151-
if p not in contributors:
152-
errors.append(f"{p}: parses but declares no rule")
137+
for (const p of PATHS) {
138+
try {
139+
texts[p] = await Deno.readTextFile(p);
140+
} catch {
141+
fail([`${p}: missing`]);
142+
}
143+
}
153144
```
154145

155-
And what cannot be failed is stated rather than omitted:
146+
And what cannot be failed is stated on the success line rather than omitted:
156147

157148
```
158-
valid: 40 rules across 6 yaml blocks in 1 files, 9 families;
159-
9 id(s) vacated since 9654836~1: CONST-E1,CONST-E2,CONST-E3,CONST-E4,
160-
CONST-G1,CONST-G2,CONST-T1,CONST-T2,CONST-T5
149+
valid: 37 rules across 6 yaml blocks in 1 files, 9 families; no id reassigned since origin/main
150+
1 id(s) vacated since origin/main: CONST-T11
161151
```
162152

163153
And the fixture-anchoring pair from the reverse surgery — same gate, same narrowing,
@@ -181,15 +171,3 @@ artifact worth keeping:
181171
| a rule deleted with nothing citing it | pass, and name the vacated identifier |
182172
| a path renamed alongside a rule retitle | pass, and name the uncompared path |
183173

184-
## Related
185-
186-
- The gate discussed here is the constitution corpus validator invoked by the repository's
187-
`test` script; its module docstring carries the same argument at the point of use.
188-
- `CONST-E6` (Prefer the Gate) made a gate the final word; it was retired 2026-09-07 in the
189-
audience split — its substance lives in ENFORCEMENT.md, and the maker-side boundary is
190-
CONST-E9. The rule that priced a gate's false-positive budget is gone with its vacated
191-
number. This learning is the counterweight either way — a gate that cannot fail is not
192-
enforcement, it is a certificate.
193-
- The transition-state shape and the fixture-anchoring rule were added by the
194-
single-document restore (branch `restore-single-document`); the gate-fidelity residuals
195-
from that surgery are tracked in this repo's issues #19 and #20.

‎repos/constitution/docs/solutions/architecture-patterns/ttsr-regex-rules-flag-translation-backreferences.md‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)