From 2c51ca919b75791afe4f5331ba7a2b194b51a96d Mon Sep 17 00:00:00 2001 From: Alek Date: Thu, 23 Jul 2026 16:01:37 -0700 Subject: [PATCH 1/2] Decouple CI tests from README --- Makefile | 2 +- scripts/check_claim_guardrails.py | 1 - scripts/check_python_floor.py | 5 +- scripts/verify_local.py | 4 +- spec/process/contributing.md | 12 +-- spec/process/production-readiness.md | 17 ++- tests/test_docs_examples.py | 155 ++------------------------- tests/test_python_floor.py | 6 +- tests/test_verify_local.py | 50 ++++----- tests/test_verify_sdist.py | 2 +- 10 files changed, 46 insertions(+), 208 deletions(-) diff --git a/Makefile b/Makefile index ab63b30d..53167a6f 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ help: ' make check-browser run browser smokes (set CHROMIUM=/path/to/chrome)' \ ' make check-conformance run accessibility + Chromium/Firefox/WebKit conformance' \ ' make check-docs run docs examples and public claim guardrails' \ - ' make check-examples run README/API examples and Reflex asset registry checks' \ + ' make check-examples run canonical API examples and Reflex asset registry checks' \ ' make check-security run standalone HTML safety and client text-sink checks' \ ' make check-errors run public error, LOD, and mutation-safety tests' \ ' make check-api run lazy public API and type-surface checks' \ diff --git a/scripts/check_claim_guardrails.py b/scripts/check_claim_guardrails.py index cb5f1a07..4f51afc3 100644 --- a/scripts/check_claim_guardrails.py +++ b/scripts/check_claim_guardrails.py @@ -18,7 +18,6 @@ ROOT = Path(__file__).resolve().parents[1] DEFAULT_DOCS = ( "pyproject.toml", - "README.md", "SECURITY.md", "CONTRIBUTING.md", "spec/api/api-examples.md", diff --git a/scripts/check_python_floor.py b/scripts/check_python_floor.py index 0f7e45c8..4be7e1d3 100644 --- a/scripts/check_python_floor.py +++ b/scripts/check_python_floor.py @@ -41,10 +41,7 @@ "node_modules", } -DECLARATION_DOCS = ( - Path("README.md"), - Path("spec/process/production-readiness.md"), -) +DECLARATION_DOCS = (Path("spec/process/production-readiness.md"),) def iter_python_files(paths: Iterable[Path]) -> list[Path]: diff --git a/scripts/verify_local.py b/scripts/verify_local.py index d904bf31..b00024e5 100644 --- a/scripts/verify_local.py +++ b/scripts/verify_local.py @@ -118,7 +118,7 @@ def _base_checks( ), Check( "examples", - "README/API examples and example-app checks", + "canonical API examples and example-app checks", ( py, "-m", @@ -146,7 +146,7 @@ def _base_checks( "tests/test_scatter.py::test_to_html_escapes_user_strings", "tests/test_components.py::test_component_to_html_escapes_user_strings_across_public_surface", "tests/test_components.py::test_component_to_html_path_keeps_existing_file_on_atomic_replace_failure", - "tests/test_docs_examples.py::test_readme_documents_standalone_html_security_contract", + "tests/test_docs_examples.py::test_security_policy_documents_standalone_html_contract", "tests/test_docs_examples.py::test_production_docs_capture_html_export_dom_text_contract", ), requires_modules=("pytest",), diff --git a/spec/process/contributing.md b/spec/process/contributing.md index c1f88f1f..f47df8cb 100644 --- a/spec/process/contributing.md +++ b/spec/process/contributing.md @@ -43,7 +43,7 @@ toolchain with `cargo`, `rustc`, and clippy for native-core checks. If clippy is missing, run `rustup component add clippy`. If you are only touching docs or pure Python shell code, `make check` is the fast non-JS/non-Rust gate. -When README/API prose changes, run the focused docs gate: +When canonical API prose or examples change, run the focused docs gate: ```bash make check-docs @@ -96,15 +96,15 @@ regression comparison scripts, or report-schema validation, run: make check-benchmark-harness ``` -When you edit public docs, README text, package metadata, benchmark summaries, -or anything that could become a public performance claim, run: +When you edit public docs, package metadata, benchmark summaries, or anything +that could become a public performance claim, run: ```bash make check-claims ``` -When you edit README snippets, `spec/api/api-examples.md`, or the Reflex example -dashboard registry/assets, run: +When you edit `spec/api/api-examples.md` or the Reflex example dashboard +registry/assets, run: ```bash make check-examples @@ -235,7 +235,7 @@ the `` placeholder, name it explicitly, for example the patch; run `make check-security` for export/client text-sink changes. - Benchmarks label mode truthfully: `direct`, `decimated`, `density`, `sampled`, or `adaptive`. -- README/docs examples still match the current public API. +- Canonical API examples still match the current public API. - New public exports appear in `xy.__all__`, lazy `_EXPORTS`, and tests; run `make check-api` after public export or annotation changes. - Lazy import boundaries still keep package import light; run diff --git a/spec/process/production-readiness.md b/spec/process/production-readiness.md index b9f1605b..f5113cad 100644 --- a/spec/process/production-readiness.md +++ b/spec/process/production-readiness.md @@ -143,8 +143,8 @@ production-facing push: | Changed surface | Focused gate | |---|---| -| README/API prose, examples, public benchmark wording | `make check-docs` | -| README snippets, `spec/api/api-examples.md`, Reflex chart registry/assets | `make check-examples` | +| API prose, examples, public benchmark wording | `make check-docs` | +| `spec/api/api-examples.md`, Reflex chart registry/assets | `make check-examples` | | Public validation, error messages, builder rollback, LOD/drill mutation boundaries, chart/widget caching | `make check-errors` | | Public exports, lazy import mappings, component factories, public annotations | `make check-api` | | Import-time budget, `xy.__init__`, dependency boundaries, widget/export/backend import boundaries | `make check-import` | @@ -166,8 +166,7 @@ Use this before pushing production-facing changes: make check-full ``` -Use this after editing README/API docs, example snippets, or public benchmark -wording: +Use this after editing API docs, example snippets, or public benchmark wording: ```bash make check-docs @@ -224,8 +223,8 @@ verify those exact files rather than rebuilding locally: make check-artifacts SDIST=/path/to/xy.tar.gz WHEEL=/path/to/xy.whl ``` -Use this after editing README snippets, `spec/api/api-examples.md`, or the Reflex -dashboard chart registry/assets: +Use this after editing `spec/api/api-examples.md` or the Reflex dashboard chart +registry/assets: ```bash make check-examples @@ -275,8 +274,8 @@ tests: make check-benchmark-harness ``` -Use this after editing public docs, README text, package metadata, benchmark -summaries, release notes, or other performance-claim surfaces: +Use this after editing public docs, package metadata, benchmark summaries, +release notes, or other performance-claim surfaces: ```bash make check-claims @@ -371,7 +370,7 @@ Before tagging a release: package-only: docs, tests, benchmarks, scripts, and the `examples/` apps are sdist-only. - Confirm the wheel size budget is still below 15 MB. -- Confirm README examples and `spec/api/api-examples.md` run against the tagged API. +- Confirm `spec/api/api-examples.md` runs against the tagged API. - Confirm package metadata uses measured, scoped language rather than broad "faster/best" positioning. - Confirm performance claims mention chart type, mode, backend, data size, and diff --git a/tests/test_docs_examples.py b/tests/test_docs_examples.py index 1dd63f7f..39fd2c20 100644 --- a/tests/test_docs_examples.py +++ b/tests/test_docs_examples.py @@ -11,7 +11,6 @@ ROOT = Path(__file__).resolve().parents[1] SPEC_DOCS = ROOT / "spec" API_EXAMPLES = SPEC_DOCS / "api" / "api-examples.md" -README = ROOT / "README.md" CONTRIBUTING = ROOT / "CONTRIBUTING.md" SECURITY = ROOT / "SECURITY.md" BENCHMARK_DOC = SPEC_DOCS / "benchmarks" / "results.md" @@ -135,52 +134,6 @@ def test_api_example_builds_payload(heading: str, source: str) -> None: assert isinstance(blob, bytes) -@pytest.mark.parametrize( - ("heading", "source"), _python_examples(README), ids=lambda value: str(value) -) -def test_readme_python_example_runs( - heading: str, - source: str, - tmp_path: Path, - monkeypatch: pytest.MonkeyPatch, -) -> None: - monkeypatch.chdir(tmp_path) - namespace: dict[str, object] = {"__name__": f"xy_readme_example_{heading}"} - uses_pyplot_show = source.rstrip().endswith("plt.show()") - if uses_pyplot_show: - import xy.pyplot as pyplot - - monkeypatch.setattr(pyplot, "show", lambda *_args, **_kwargs: None) - - exec(compile(_capture_final_expression(source), str(README), "exec"), namespace) - - result = namespace.get("__example_result__") - if uses_pyplot_show and result is None: - result = namespace.get("fig") - assert result is not None, f"{heading} README example should end with an expression" - if isinstance(result, str): - assert "xy.renderStandalone" in result - if "chart.html" in source: - assert (tmp_path / "chart.html").read_text(encoding="utf-8") == result - return - if not hasattr(result, "figure") and not hasattr(result, "build_payload"): - # pyplot-shim figures display like notebooks display them. - html = result._repr_html_() - assert html.startswith('