docs(6209): twelve more test files say which behaviour they pin
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / integration (push) Successful in 1m12s
CI & Build / Python tests (push) Successful in 1m53s
CI & Build / Build & push image (push) Successful in 12s

shape ledger, MCP projects/search/rulebooks tools, backup, chunking,
plugin context, derived mirror, rule band, shape form gate, plugin
version mint and note usage tests drop issue, milestone and rule numbers,
dates and one-install figures from docstrings, comments and messages.
Three shape-form-gate test names that told the discovery story now name
the property: a registry module's helpers are not service functions, the
divergence gate silences only a family contradiction, and callable helpers
beside a callable canon still prompt. The rulebook tool-count comment that
logged each milestone's additions is replaced by the reason it is a count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 21:24:50 -04:00
co-authored by Claude Opus 5.5
parent 91c96a8b8a
commit d41e72d26c
12 changed files with 223 additions and 265 deletions
+17 -22
View File
@@ -51,7 +51,7 @@ def _exportable_note(**over):
def test_note_rows_carry_the_verification_trio():
"""Operator judgment — somebody checked this fact, and this is when —
which nothing downstream can recompute (milestone 317)."""
which nothing downstream can recompute."""
[row] = backup._note_rows([_exportable_note(
verify_with="curl the AMO docs",
expires_when="AMO starts allowing re-signing",
@@ -75,10 +75,10 @@ def test_a_never_checked_note_exports_a_null_stamp_and_restores_as_one():
def test_the_record_type_and_kind_survive_the_export():
"""#3182's headline. Without these two columns a restore reported success
and handed back a corpus where all 90 snippets and 3 processes were plain
notes and all 435 issues and the spike were `work` — the entire vocabulary
milestone 312 and #3128 were about, gone, with nothing to notice it by."""
"""Without these two columns a restore reports success and hands back a
corpus where every snippet and process is a plain note and every issue
and spike is `work` — the record vocabulary gone, with nothing to notice
it by."""
[snippet] = backup._note_rows([_exportable_note(note_type="snippet")])
[issue] = backup._note_rows([_exportable_note(task_kind="issue", status="done")])
assert snippet["note_type"] == "snippet"
@@ -105,7 +105,7 @@ def test_provenance_and_lifecycle_travel():
def test_a_milestone_carries_its_plan():
"""A milestone IS the plan (0066); `body` is its design and intent and
`description` is only the one-line summary. Dropping it restored every
plan as a title with no reasoning behind it (#3182)."""
plan as a title with no reasoning behind it."""
m = SimpleNamespace(
id=1, user_id=7, project_id=2, title="t", description="d",
body="## Goal\n\nthe actual plan", status="active", order_index=0,
@@ -117,7 +117,7 @@ def test_a_milestone_carries_its_plan():
def test_a_repo_binding_carries_the_branch_its_ledger_follows():
"""#2873. Without `ref` a restored binding silently falls back to the
"""Without `ref` a restored binding silently falls back to the
default branch and the shape ledger starts accounting for a different
tree — a wrong answer that looks like a working one."""
b = SimpleNamespace(user_id=7, project_id=2, repo_key="Scribe", ref="dev")
@@ -265,7 +265,7 @@ def _stand_in(model):
@pytest.mark.parametrize("table", sorted(_column_guard_targets()))
def test_every_column_is_exported_or_declared_excluded(table):
"""THE COLUMN GUARD (#3182) — _NOT_INCLUDED's shape, one level down.
"""THE COLUMN GUARD — _NOT_INCLUDED's shape, one level down.
The table guard below catches a whole table going missing. It cannot catch
a COLUMN going missing from a table it already considers covered, which is
@@ -379,7 +379,7 @@ def _everything_maps(row: dict) -> "backup._Maps":
@pytest.mark.parametrize("table", sorted(_import_guard_targets()))
def test_every_exported_column_is_imported_or_declared_excluded(table):
"""THE COLUMN GUARD, THE OTHER WAY (#4197).
"""THE COLUMN GUARD, THE OTHER WAY.
The export guard above makes a dropped column unexpressible on the way
OUT. Nothing watched the way back IN, and that is the worse half: an
@@ -435,9 +435,6 @@ def test_an_unmappable_project_degrades_a_usage_event_and_skips_a_shape_event():
the project is optional by design, null already means "not reported", and
dropping the row would lose a real pull and deflate the very pull-through
the table exists to report.
Until #4197 this was asserted by reading the source of `_restore_v2` with
`inspect.getsource`, because there was no unit to call. Now there is.
"""
maps = backup._Maps()
maps.notes[5] = 55
@@ -467,8 +464,7 @@ def test_a_shapes_divergence_pointer_is_remapped_not_carried():
"""`diverges_from` is a FK to notes.id, like `snippet_id`. Carrying the
source id would point at whatever snippet took that number in the
destination — wrong rather than missing, and nothing downstream could
tell. It was dropped entirely until #4197; restoring it raw would have
been the worse fix."""
tell. Restoring it raw would be worse than dropping it."""
maps = backup._Maps()
maps.projects[1] = 11
maps.notes[4] = 44
@@ -507,14 +503,14 @@ def test_the_column_guard_covers_every_table_with_a_row_helper():
def test_not_included_lists_the_known_gaps():
# The deferred tables must be surfaced explicitly, not silently dropped.
# forge_connections is excluded as CREDENTIALS (api_keys reasoning): a
# backup that carries forge tokens is a token-exfiltration file (#2778).
# backup that carries forge tokens is a token-exfiltration file.
for table in ("groups", "project_shares", "note_shares", "api_keys",
"note_embeddings", "retrieval_logs", "forge_connections"):
assert table in backup._NOT_INCLUDED
def test_every_table_is_either_backed_up_or_explicitly_excluded():
"""THE GUARD (#2293), and the only shape of test that catches an ABSENCE.
"""THE GUARD, and the only shape of test that catches an ABSENCE.
A new table gets a model and a migration — both fail loudly if wrong — and
then silently never gets a backup section. No error, no warning, and a
@@ -599,11 +595,11 @@ async def test_export_full_backup_contains_every_declared_section():
"system_usage_events",
# v23: proposals and judgments about a rule's moments.
"rule_moment_judgments",
# v25: family canon (milestone 463).
# v25: family canon.
"platforms", "project_platforms", "family_ideas",
"family_idea_platforms", "family_idea_references",
"family_adoptions", "family_decisions",
# v26: the Profile page (#5879).
# v26: the Profile page.
"user_profiles"):
assert key in out, f"missing export section: {key}"
assert out[key] == []
@@ -625,7 +621,7 @@ def test_supersession_rows_serialise_the_pair():
def test_rule_rows_carry_the_verification_fields():
"""A rule's check must survive a backup.
`verify_with`/`expires_when`/`verified_at` (milestone 312) say whether a
`verify_with`/`expires_when`/`verified_at` say whether a
rule is a fact that can go false and when it was last confirmed. A backup
that drops them restores a rulebook that has forgotten which of its rules
can rot — the exact blindness the fields were added to end.
@@ -647,9 +643,8 @@ def test_rule_rows_carry_the_verification_fields():
assert out["verify_with"] == "cat some/file"
assert out["expires_when"] == "the file grows a shell"
assert out["verified_at"] == checked.isoformat()
# Provenance was exported from 0088 onward but silently dropped on the way
# back IN until milestone 312. Export side asserted here; the restore side
# remaps it through note_id_map.
# Provenance is exported here; the restore side remaps it through
# note_id_map.
assert out["arose_from_id"] == 99