You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0929c25
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,6 @@ Then run:
49
49
50
50
```bash
51
51
make verify
52
-
scripts/check_example_migration_parity.py
53
52
scripts/format_examples.py --check
54
53
make verify-python-version VERSION=3.13
55
54
git diff --check
@@ -68,9 +67,9 @@ These scripts enforce the catalog-level rules from `docs/example-quality-rubric.
68
67
69
68
| Script | What it gates |
70
69
| --- | --- |
71
-
|`scripts/check_registry_integrity.py`| Every owner slug in `docs/quality-registries.toml` exists in `manifest.toml`; tokens are present; each `paired_pages` pair is discoverable through `see_also`. |
72
-
|`scripts/check_confusable_pairs.py`| Each confusable pair's owning page contains every token that signals the contrast; a token shadowed inside a longer sibling token (plain `def` inside `async def`) does not count. |
73
-
|`scripts/check_broad_surface_tours.py`| Each broad-title page either covers every required form or sets `scope_first_pass = true` with `see_also` links to focused neighbors. |
70
+
|`scripts/check_registry_integrity.py`| Every owner slug in `docs/quality-registries.toml` exists in `manifest.toml`; tokens are present; each `paired_pages` pair is discoverable through `see_also` and has registry-named cell tokens demonstrated inside a teaching cell. |
71
+
|`scripts/check_confusable_pairs.py`| Each confusable pair's owning page contains every token inside teaching cells; a token shadowed inside a longer sibling token (plain `def` inside `async def`) does not count. |
72
+
|`scripts/check_broad_surface_tours.py`| Each broad-title page either covers every required form or sets `scope_first_pass = true` with registry-named `focused_neighbors` linked through `see_also`. |
74
73
|`scripts/check_footgun_coverage.py`| Each canonical Python footgun has a page that contains both broken-form and fixed-form tokens. |
75
74
|`scripts/check_notes_supported.py`| Every `:::note` bullet (across all note blocks) shares at least one keyword with the page body outside the notes, so notes cannot assert behavior the page never demonstrates. |
76
75
|`scripts/check_program_covers_cells.py`| Every executable cell shares substantive code with the `:::program` block, so the editor reproduces what the cells teach; `standalone_cells = true` opts out visibly. |
@@ -82,16 +81,16 @@ These scripts enforce the catalog-level rules from `docs/example-quality-rubric.
82
81
|`scripts/check_journey_outcomes.py`| Every journey section declares learner outcomes. |
83
82
|`scripts/audit_example_graph.py --check`| The `see_also` graph has no broken targets, self-links, over-linked pages, or orphaned examples. |
84
83
85
-
The single source of truth for the registries is `docs/quality-registries.toml`. Add a new pair, broad tour, or footgun there, then update the owning page so the tokens appear in cells or prose.
84
+
The single source of truth for the registries is `docs/quality-registries.toml`. Add confusable pairs, broad tours, footguns, journey metadata, figure attachments, captions, and curated scores there, then update the owning page so the tokens appear in cells or prose.
86
85
87
86
## Adding a new example end to end
88
87
89
88
1. Write `src/example_sources/<slug>.md` (frontmatter, intro prose, one `:::program`, cells, notes) and add the slug to `manifest.toml`'s `order`.
90
89
2. Add `see_also` links in both directions — `scripts/audit_example_graph.py --check` fails orphaned pages.
91
-
3. Score the page against `docs/example-quality-rubric.md` and add the entry to `EXAMPLE_QUALITY_SCORES` in `src/marginalia.py`.
92
-
4. Attach a figure in `src/marginalia.py` (or add a `no_figure_rationales` entry with a review date) and score it; review it on `public/prototyping/marginalia-gestalt.html`, which shows the production caption under every figure.
93
-
5. Run `make build`, `make verify-examples`, `make quality-checks`, then `uv run python scripts/refresh_golden_fixture.py` and review the structural summary it prints.
94
-
6. Run the full `make verify` with a local Worker running, then commit — including the regenerated `src/example_sources_data.py`and fixture.
90
+
3. Score the page against `docs/example-quality-rubric.md` and add the `[[example_quality_scores]]`entry to `docs/quality-registries.toml`.
91
+
4. Attach a figure by adding `[[figure_attachments]]` and `[[example_figure_scores]]` entries to `docs/quality-registries.toml` (or add a `no_figure_rationales` entry with a review date); keep only new paint functions in `src/marginalia.py`. Review the result on `public/prototyping/marginalia-gestalt.html`, which shows the production caption under every figure.
92
+
5. Run `make build`, `make verify-examples`, `make quality-checks`, and `scripts/format_examples.py --check`.
93
+
6. Run the full `make verify` with a local Worker running, then commit — including the regenerated `src/example_sources_data.py`, `src/editorial_registry_data.py`, `src/asset_manifest.py`, and fingerprinted assets.
Copy file name to clipboardExpand all lines: docs/example-source-format-spec.md
+12-15Lines changed: 12 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -547,26 +547,23 @@ The command should fail if:
547
547
548
548
`verify-python-version` is only meaningful when `uv` can run the requested Python version. Until Cloudflare exposes the same runtime locally, the migration also requires a Worker smoke test for representative examples and at least one POST execution through Dynamic Workers.
549
549
550
-
## Golden fixture policy
550
+
## Golden fixture cleanup policy
551
551
552
-
`tests/fixtures/golden_examples.py` began as migration safety infrastructure and is now a reviewed **structural snapshot** of the parsed catalog: every example's metadata, program, expected output, and full cell sequence (prose, code, output, kind).
552
+
`tests/fixtures/golden_examples.py` began as migration safety infrastructure: a frozen comparison point while the app switched from Python dictionaries to Markdown source files. That rollback window has passed, so the fixture and its refresh/parity scripts are removed rather than refreshed forever.
553
553
554
-
What the gate proves: an accidental loader/parser/renderer change cannot silently rewrite the teaching structure readers get — it surfaces in `scripts/check_example_migration_parity.py` as snapshot drift across many examples, while a deliberate content edit drifts only the files actually touched. The gate is not a freshness check on content; refreshes are part of editing.
554
+
Current rules:
555
555
556
-
Rules:
557
-
558
-
- Never hand-edit the fixture. Regenerate it with `scripts/refresh_golden_fixture.py`, which prints a structural summary (examples changed/added/removed and which fields moved) for review.
559
-
- Commit a refresh together with the content change it reflects, and read the summary before committing — it is the reviewable record of what the edit did to teaching structure.
560
-
- A change to `src/example_loader.py` or the parser must never require a fixture refresh; if it does, the loader change altered parsed structure and that is the regression.
561
-
-`scripts/check_example_migration_parity.py` remains a required verification command.
556
+
- Do not add a new checked-in catalog snapshot for ordinary content edits.
557
+
- Review intentional teaching changes through the Markdown diff, generated-source diff, `verify_examples.py`, content gates, browser layout check, and rubric audit.
558
+
- Parser changes must be justified by focused loader/verifier tests, not by refreshing a broad snapshot until it agrees with the new behavior.
559
+
- If a future source-format migration needs parity again, add a temporary fixture and delete it in the same migration plan once a stable deployment and rollback window have passed.
562
560
563
561
## CI policy
564
562
565
563
GitHub Actions must run the same checks expected locally:
566
564
567
565
```bash
568
566
make verify
569
-
scripts/check_example_migration_parity.py
570
567
scripts/format_examples.py --check
571
568
make verify-python-version VERSION=3.13
572
569
git diff --check
@@ -576,7 +573,7 @@ CI must start `pywrangler dev --port 9696` before `make verify` so `browser-layo
576
573
577
574
## Contributor documentation policy
578
575
579
-
The README must describe Markdown example editing, `:::program`, `:::cell`, generated embedded source data, `make build`, `make verify-examples`, and the parity check. Contributors should not need to edit `src/examples.py` or `src/example_sources_data.py` by hand.
576
+
The README must describe Markdown example editing, `:::program`, `:::cell`, generated embedded source data, `make build`, `make verify-examples`, and the TOML editorial registries. Contributors should not need to edit `src/examples.py` or `src/example_sources_data.py` by hand.
580
577
581
578
## Worker bundling policy
582
579
@@ -599,15 +596,15 @@ The attempted migration failed at Worker startup because Markdown files were not
599
596
600
597
Native Markdown bundling remains unproven and is not on the production path. The accepted solution is embedded source data generated by `scripts/embed_example_sources.py`. A future native bundling change must be isolated as a spike and prove local dev, production deploy, imports, cache fingerprinting, and failure behavior before replacing embedded data.
601
598
602
-
## Golden parity script
599
+
## Historical golden parity script
603
600
604
-
Add a dedicated migration script before switching the app:
601
+
During the app switch, add a dedicated migration script before switching the app:
605
602
606
603
```text
607
604
scripts/check_example_migration_parity.py
608
605
```
609
606
610
-
Required behavior:
607
+
Required migration-time behavior:
611
608
612
609
- Load the catalog through `src/example_loader.py` and the checked-in structural snapshot.
613
610
- Compare example count and order.
@@ -619,7 +616,7 @@ Required behavior:
619
616
- Fail on every semantic or teaching-structure difference. No allowlist is permitted for the app switch.
620
617
- Print a short table of differences for review.
621
618
622
-
This script is temporary migration scaffolding. It can be removed only after the old catalog is deleted, one production deployment succeeds, and the rollback window has passed.
619
+
This script was temporary migration scaffolding. The old catalog was deleted, production deployment succeeded, and the rollback window passed; the script and fixture have now been removed.
0 commit comments