From ce45d30cc7f62325fbfcf0d96cb4090d702deb50 Mon Sep 17 00:00:00 2001 From: Alex Maldonado Date: Tue, 6 Oct 2026 10:30:36 -0400 Subject: [PATCH] feat: cleanup with respect to core --- AGENTS.md | 4 ++-- README.md | 2 +- docs/app.md | 8 ++++---- pixi.toml | 8 ++++---- quarto/README.md | 4 ++-- scripts/quarto-css.mjs | 6 +++--- scripts/quarto-export.mjs | 4 ++-- tests/hardware.test.mjs | 6 +++--- tests/mojo.test.mjs | 4 ++-- tests/quarto-render.test.mjs | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d3045de..2d30dd4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,8 +25,8 @@ The site's suite takes under a minute. While iterating, build and run one file: ## Hard rules 1. **A change to what programs mean belongs in core.** A translator, the checker, the interpreter, the prover, the fuzzer, the machine model, the catalog's problems, the Mojo corpus: change them in pplus-core under its rules (its own commit, its own gate), then move the `core` pointer here in a commit that says what it brings. Never edit `core/` from a site change without that. The site imports core only as `#core/.js` (the import map in `index.html`, `imports` in `package.json`), from its built `core/dist/`. -2. **Do not edit generated files by hand.** `quarto/_extensions/pplus/pplus-views.css` comes from `styles.css`, `pplus-hw.css` and `course/*.css` beside it from `styles/course/`, and `syntax/mojo.xml` from core's `core/syntax/mojo.xml` (`pixi run quarto-css`; a test fails while they are out of date, so run it after changing a rule the views use). Core's generated files are listed in its AGENTS.md. -3. **Never claim Mojo compiles, runs, or prints something without the real compiler's answer.** Mojo is pinned to 1.1.0 by core. What the app shows about Mojo comes from core's checker and interpreter and from godbolt's answers (stored in `core/mojo/golden/`, or asked live by Compile & run); the site never invents a verdict, and every Mojo construct written into the app must pass `checkMojo`. +2. **Do not edit generated files by hand.** `quarto/_extensions/pplus/pplus-views.css` comes from `styles.css`, `pplus-hw.css` and `course/*.css` beside it from `styles/course/`, and `syntax/mojo.xml` from core's `core/library/syntax/mojo.xml` (`pixi run quarto-css`; a test fails while they are out of date, so run it after changing a rule the views use). Core's generated files are listed in its AGENTS.md. +3. **Never claim Mojo compiles, runs, or prints something without the real compiler's answer.** Mojo is pinned to 1.1.0 by core. What the app shows about Mojo comes from core's checker and interpreter and from godbolt's answers (stored in `core/library/mojo/golden/`, or asked live by Compile & run); the site never invents a verdict, and every Mojo construct written into the app must pass `checkMojo`. 4. **Never show "proved" for something that is not a proof.** The badges and verdicts are in [core/docs/trust.md](core/docs/trust.md); the site shows what core decided and does not soften or upgrade it. 5. **No new dependencies.** TypeScript is the only npm package. There is no bundler, no framework, and no runtime dependency. CodeMirror is vendored as one built module (`src/vendor/`), rebuilt only by `scripts/vendor/codemirror.sh`. 6. **You have no network** in most sandboxes. Godbolt (Compile & run) needs one, and so do core's network tasks. Never fake their results; leave those steps to the owner and list them. diff --git a/README.md b/README.md index 46f38df..9192afb 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Every command is a pixi task (`pixi task list` shows them with their description | `test` | Build, then run every test of the site | | `check-pages ` | Run every program embedded in the Quarto pages under a folder ([quarto/README.md](quarto/README.md)) | | **Quarto** | | -| `quarto-export ` | Copy a `core/mojo/local/` program, its x86-64 and setup beside a Quarto page, and print the shortcode | +| `quarto-export ` | Copy a `core/library/mojo/local/` program, its x86-64 and setup beside a Quarto page, and print the shortcode | | `quarto-css` | Regenerate the extension's generated files (a test fails while they are out of date) | | `quarto-engine ` | Copy a built Programming+ and core into a site's `_extensions/pplus/engine`, for the rendered views ([quarto/README.md](quarto/README.md)) | | `quarto-example` | Render the example site in `quarto/example`, every shortcode on real pages (needs Quarto) | diff --git a/docs/app.md b/docs/app.md index 7eb4839..e459289 100644 --- a/docs/app.md +++ b/docs/app.md @@ -70,7 +70,7 @@ A rule is `{ id, title, why, docUrl, example, apis, detect }`. The starting rule - **Bridge:** the Best practices dock tab lists each finding with the Mojo line, the pseudo line it came from (the hub's line map), the reason, before and after, the manual link, and, where true, how to write the pseudo so the translator writes the better form. Clicking one lights both lines. The Mojo is read-only, so rewrites are shown, not applied. **Show idiomatic version** (in the Mojo tab, off until chosen) shows a copy with the safe rewrites applied, only if it passes the checker no worse than the literal one and the interpreter prints exactly what the literal one prints; it keeps the generated label ("Generated from pseudo, with N best-practice rewrites"). - **Developer:** findings are `note` diagnostics with origin "best practices" (never an error or a warning, so they never look like the compiler) in Problems and the gutter, each with a one-click fix where the rewrite is safe. A rule that cannot promise a safe rewrite (`comptime`) explains and leaves the editing to the student. -- **Tests** (`core/tests/practices.test.mjs`): every rule's example passes the checker, runs, and prints the same before and after, and the rule's fix turns one into the other; every method a rewrite names is in the harvested index; a false-positive gate runs the rules over Modular's own tested programs in `core/mojo/corpus/manual/` against a reviewed allowlist; each exercise's findings are pinned by a snapshot; applying every fix to each exercise's generated Mojo and each `core/mojo/local/` program keeps it checking and printing the same. +- **Tests** (`core/tests/practices.test.mjs`): every rule's example passes the checker, runs, and prints the same before and after, and the rule's fix turns one into the other; every method a rewrite names is in the harvested index; a false-positive gate runs the rules over Modular's own tested programs in `core/library/mojo/corpus/manual/` against a reviewed allowlist; each exercise's findings are pinned by a snapshot; applying every fix to each exercise's generated Mojo and each `core/library/mojo/local/` program keeps it checking and printing the same. ### Saved versions @@ -123,7 +123,7 @@ The **Share** button in the app produces the app link, a ready-to-paste `