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
feat: include hypothesis-test HTML report in book (#759)
* Initial plan
* Initial plan for hypothesis-test report in book
Co-authored-by: tschm <2046079+tschm@users.noreply.github.com>
* Add hypothesis-test report to book
Co-authored-by: tschm <2046079+tschm@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tschm <2046079+tschm@users.noreply.github.com>
Co-authored-by: Thomas Schmelzer <thomas.schmelzer@gmail.com>
The **Rhiza** repository is a sophisticated Python project template system ("living templates") that enables continuous synchronization of configuration, CI/CD workflows, and development tooling across projects. The codebase demonstrates production-grade engineering with well-structured Makefiles, comprehensive testing (property-based, stress, benchmark, integration), dual CI/CD support (GitHub Actions + GitLab CI), and a modular book/documentation generation system using Marimo notebooks. The architecture is mature, with clear separation of concerns between template management (`.rhiza/`), project tests (`tests/`), and documentation (`book/`, `docs/`).
852
+
853
+
**Core Value Proposition:** Unlike one-time project generators (cookiecutter, copier), Rhiza provides continuous template synchronization via `.rhiza/template.yml` configuration, allowing projects to selectively pull updates over time while maintaining control.
854
+
855
+
### Strengths
856
+
857
+
#### Architecture & Organization
858
+
-**Clean separation**: `.rhiza/` contains 16 modular `.mk` files (test.mk, book.mk, marimo.mk, docs.mk, etc.), each focused on a single concern
-`--hypothesis-show-statistics` flag for detailed output
874
+
-`--hypothesis-seed=0` for reproducibility
875
+
-`-m "hypothesis or property"` marker filtering
876
+
- HTML report generation to `_tests/hypothesis/report.html`
877
+
-**Example test**: `tests/property/test_makefile_properties.py` demonstrates property-based testing with `@given(st.lists(st.integers() | st.floats()))`
878
+
-**Documentation**: `docs/TESTS.md` (298 lines) provides comprehensive guidance on writing property-based tests, including best practices and troubleshooting
879
+
-**CI integration**: Hypothesis tests run as part of `make test` (line 23-47 in test.mk) during GitHub Actions `rhiza_ci.yml` workflow
880
+
881
+
#### Book & Documentation System
882
+
-**Marimo notebooks**: `book/marimo/notebooks/rhiza.py` showcases interactive reactive notebooks with inline PEP 723 dependencies
883
+
-**Marimushka export**: `.rhiza/make.d/marimo.mk:45-67` exports Marimo notebooks to static HTML using `marimushka>=0.3.3`
884
+
-**Book compilation**: `.rhiza/make.d/book.mk:54-105` aggregates 7 sections (API, Coverage, Test Report, Benchmarks, Stress Tests, Notebooks, Official Documentation) into unified `_book/` via `minibook`
885
+
-**Declarative sections**: `BOOK_SECTIONS` variable (lines 39-46) defines structure as pipe-delimited tuples with source/target paths
886
+
-**MkDocs integration**: `.rhiza/make.d/docs.mk:72-82` builds MkDocs sites with Material theme (`mkdocs-material<10.0`)
887
+
-**API docs**: `pdoc` integration with docformat detection (google/numpy/sphinx) from `ruff.toml` or fallback to google
888
+
-**CI workflow**: `.github/workflows/rhiza_marimo.yml` discovers and validates all notebooks in parallel matrix jobs
889
+
890
+
#### Test Report & HTML Generation
891
+
-**HTML test reports**: `pytest-html>=4.0` dependency generates `_tests/html-report/report.html` (test.mk line 40, 47)
892
+
-**Coverage HTML**: `--cov-report=html:_tests/html-coverage` generates browsable coverage reports (test.mk line 37)
893
+
-**Benchmark reports**: Custom `rhiza-tools>=0.2.3 analyze-benchmarks` generates `_tests/benchmarks/report.html` (test.mk line 83)
894
+
-**Hypothesis reports**: `--html=_tests/hypothesis/report.html` generates property-based test reports (test.mk line 117)
895
+
-**Stress reports**: `--html=_tests/stress/report.html` for stress test results (test.mk line 148)
896
+
-**Book aggregation**: All reports copied to `_book/tests/` structure for unified documentation site
897
+
898
+
#### Dependency Management
899
+
-**UV-first**: `uv>=0.10.4` used throughout; `UV_BIN` and `UVX_BIN` variables for consistency
900
+
-**Version matrix**: `make version-matrix` uses `rhiza-tools>=0.2.2` to extract Python versions from `pyproject.toml` for CI matrix generation
901
+
-**Constrained versions**: `pyproject.toml` dev dependencies use ranges (e.g., `marimo>=0.18.0,<1.0`) with rationale comments
-**Unused hypothesis-test target**: `make hypothesis-test` target exists but not invoked in CI workflows or documentation as standalone command
920
+
-**No hypothesis configuration**: Missing `[tool.hypothesis]` section in `pyproject.toml` for project-wide settings (seed, max_examples, deadline)
921
+
922
+
#### Book/Documentation Concerns
923
+
-**Single notebook**: Only `book/marimo/notebooks/rhiza.py` exists; limited demonstration of Marimo capabilities for a showcase
924
+
-**Complex book build**: `.rhiza/make.d/book.mk:54-105` has 52 lines of shell logic for section aggregation; could be refactored to Python script
925
+
-**Missing sections handling**: `make book` silently skips missing sections with `[WARN]` messages; no validation that minimum required sections exist
926
+
-**Template complexity**: `minibook` invocation (lines 97-102) requires Python one-liner to convert JSON, fragile if links.json malformed
927
+
-**No book validation**: No tests verify book structure, links.json validity, or that all sections are generated correctly
928
+
929
+
#### Testing & Report Generation
930
+
-**HTML report dependencies**: `_tests/` directory not committed; reports lost between CI runs (expected, but no artifact upload in `rhiza_ci.yml`)
931
+
-**Coverage threshold**: `COVERAGE_FAIL_UNDER ?= 90` but no source folder defined in `.rhiza/make.d/test.mk` (relies on `SOURCE_FOLDER` from parent Makefile)
932
+
-**Benchmark CI missing**: No GitHub Actions workflow for benchmarks despite comprehensive `make benchmark` target and documentation
933
+
-**Test isolation**: `tests/stress/` and `tests/benchmarks/` directories exist at project level but unclear if they test template or project code
934
+
-**Duplicate test structure**: Both `tests/` and `.rhiza/tests/` hierarchies; `.rhiza/tests/` has 70+ files while `tests/` has only 5 files
935
+
936
+
#### Directory Structure Confusion
937
+
-**Overlapping test directories**:
938
+
-`tests/property/` (project-level, 1 file)
939
+
-`tests/benchmarks/` (project-level, 2 files)
940
+
-`tests/stress/` (project-level, 2 files)
941
+
-`.rhiza/tests/api/`, `.rhiza/tests/integration/`, `.rhiza/tests/stress/`, etc. (template-level, 60+ files)
942
+
-**Unclear ownership**: Documentation doesn't clearly explain when tests should go in `tests/` vs `.rhiza/tests/`
943
+
-**Book structure**: `book/marimo/notebooks/` (only 1 notebook) suggests more planned but not present
944
+
945
+
#### Makefile & Configuration
946
+
-**Variable dependencies**: `SOURCE_FOLDER` referenced but not defined in `.rhiza/rhiza.mk` or `.rhiza/make.d/test.mk`; assumed to come from parent Makefile
947
+
-**MARIMO_FOLDER undefined**: `marimo.mk` uses `${MARIMO_FOLDER}` but no default defined (assumed `marimo` from `rhiza_marimo.yml:45`)
948
+
-**BOOK_TITLE/SUBTITLE undefined**: `book.mk:98-99` uses these variables without defaults or documentation
949
+
-**Color code duplication**: Color variables (`BLUE`, `RED`, `GREEN`, etc.) defined in `.rhiza/rhiza.mk` lines 8-14 but potentially redefined elsewhere
950
+
951
+
### Risks / Technical Debt
952
+
953
+
#### Maintainability
954
+
1.**Double test hierarchy complexity**: Maintaining parallel `tests/` and `.rhiza/tests/` increases cognitive load; new contributors unclear where to add tests
955
+
2.**Shell complexity in Makefiles**: Book building, Marimushka export, docs generation all use complex shell scripting; difficult to debug and test
956
+
3.**Implicit variable contracts**: Many Makefiles assume variables set elsewhere (SOURCE_FOLDER, MARIMO_FOLDER, BOOK_TITLE); brittle if parent Makefile changes
957
+
4.**No Makefile tests**: Despite `tests/api/test_makefile_api.py` in `.rhiza/tests/`, no tests for `make book`, `make marimushka`, or `make hypothesis-test`
958
+
959
+
#### CI/CD
960
+
1.**No artifact preservation**: HTML reports generated but not uploaded as GitHub Actions artifacts; debugging CI failures requires local reproduction
961
+
2.**Matrix explosion risk**: `rhiza_ci.yml` tests 4 Python versions; if more Make targets added, CI time will increase linearly
962
+
3.**GitLab/GitHub drift**: Maintaining parallel CI definitions risks divergence; no validation they stay in sync
963
+
4.**Hardcoded versions**: `uv@0.10.4` in workflows; if `.rhiza/.rhiza-version` changes, workflows may use stale version
964
+
965
+
#### Documentation
966
+
1.**Hypothesis testing underutilized**: Extensive infrastructure (`make hypothesis-test`, docs, dependencies) but minimal actual usage (1 example test)
967
+
2.**Book system over-engineered**: 7 section types, custom minibook templates, complex aggregation—all for a repository with minimal source code
968
+
3.**Missing getting-started**: `docs/TESTS.md` is comprehensive but lacks simple "run your first hypothesis test" tutorial
969
+
4.**Stale documentation risk**: `docs/TESTS.md` documents hypothesis features extensively; if implementation changes, docs may not update
970
+
971
+
#### Security & Quality
972
+
1.**Mocked UV in tests**: `.rhiza/tests/conftest.py` likely mocks UV binary; integration tests may miss real UV behavior
973
+
2.**Bandit exclusions**: `make security` runs bandit with `-c pyproject.toml` but no `[tool.bandit]` section visible in provided `pyproject.toml`
974
+
3.**No dependency scanning**: `pip-audit` runs but no automated PR generation for vulnerabilities (unlike Renovate for version updates)
975
+
4.**Template sync conflicts**: `make sync` uses `--force` flag (rhiza.mk:101); could overwrite local changes if not careful
976
+
977
+
### Score
978
+
979
+
**7/10** — Solid, production-ready template system with minor gaps in hypothesis testing utilization and documentation structure
- Book system simplified or justified with substantial documentation content
1002
+
- Automated validation ensures GitHub/GitLab CI stay in sync
1003
+
- Integration tests use real UV rather than mocks (or document mock limitations)
1004
+
-`make book` validates minimum required sections before compilation
1005
+
1006
+
**Current state appropriate for:** A mature template repository that prioritizes modularity, multi-platform support, and comprehensive documentation infrastructure. The hypothesis testing foundation is excellent but underutilized; adding 10-20 property-based tests for core template logic would significantly increase confidence. The dual test hierarchy (tests/ vs .rhiza/tests/) needs architectural documentation to clarify intent.
0 commit comments