Skip to content

🧪 TEST: re-read mounted docs when their files/include targets change#10

Merged
ubmarco merged 1 commit into
mainfrom
worktree-mount-include-directive-reread-tests
Jun 14, 2026
Merged

🧪 TEST: re-read mounted docs when their files/include targets change#10
ubmarco merged 1 commit into
mainfrom
worktree-mount-include-directive-reread-tests

Conversation

@ubmarco

@ubmarco ubmarco commented Jun 14, 2026

Copy link
Copy Markdown
Member

What & why

Regression tests locking in Sphinx's incremental-rebuild behaviour for
mounted content: a change to a mounted document's files leads to a
re-read on the next build.
No production code is touched — detection
already rides on the absolute external paths the mounter records in
Project._docname_to_path and env.dependencies, which Sphinx stats on
each build. These tests prove and pin that down where it had no coverage.

Coverage added

Two distinct change-detection paths:

  1. File-list-mounted doc, own source edited → re-read
    (test_incremental_rereads_changed_file_in_file_list_mount) — parity
    with the existing directory-mount coverage, which only exercised
    directory mode.
  2. Mounted doc's referenced file changes while the doc itself is
    untouched
    → re-read via the dependency-mtime path, across every
    file-referencing directive
    the repo supports
    (test_changed_include_target_rereads_mounted_doc, parametrised):
    literalinclude, include, csv-table :file:, raw :file:,
    image, figure, graphviz, uml, mermaid.

Each directive case first asserts its target is recorded as an external
dependency of the mounted doc (precondition), so a passing re-read cannot
be a false positive. Teeth were verified during development with a
throwaway no-change control across all nine directives (no change → no
re-read); it is not part of the committed suite.

The diagram directives stay renderer-independent (mermaid raw output;
graphviz/uml assert via the recorded dependency), so no dot/java/mmdc
binary is required — matching the existing path-directive tests.

Checklist

  • Tests: 11 new cases (2 in test_mounting.py, 9 parametrised in
    test_path_directives.py). Full suite: 156 passed.
  • Docs: no behaviour change → no docs/source/ updates needed.
  • Changelog: docs/source/changelog.rst updated (Unreleased).
  • Code quality: uv run prek run --all-files passes; ruff@0.12.2
    format/lint clean on the pinned version.

Lock in Sphinx's incremental-rebuild behaviour for mounted content. No
production code is touched — these are regression tests proving detection
rides on the absolute external paths the mounter records in
Project._docname_to_path and env.dependencies.

Two change-detection paths are covered:

- A file-list-mounted doc whose own source is edited is re-read (parity
  with the existing directory-mount coverage).
- A mounted doc whose *referenced* file changes — while the doc's own
  source is untouched — is re-read via the dependency-mtime check, across
  every file-referencing directive: literalinclude, include,
  csv-table :file:, raw :file:, image, figure, graphviz, uml, mermaid.

Each directive case asserts the target is recorded as an external
dependency (precondition) before asserting the re-read, so the signal
cannot be a false positive.
@ubmarco ubmarco merged commit c297722 into main Jun 14, 2026
11 checks passed
@ubmarco ubmarco deleted the worktree-mount-include-directive-reread-tests branch June 14, 2026 21:02
@ubmarco ubmarco mentioned this pull request Jun 14, 2026
ubmarco added a commit that referenced this pull request Jun 14, 2026
Bump version 0.1.0 → 0.1.1 (pyproject.toml, package __version__, and the
uv.lock self-entry) and stamp the accumulated Unreleased changelog entries
as the 0.1.1 release, dated 2026-06-14:

- per-mount path_check option for mounted-bundle path confinement (#7)
- regression coverage proving absolute diagnostic locations for mounted
  docs (#9)
- regression coverage proving incremental rebuilds re-read mounted docs
  when their files / include targets change (#10)
- CI matrix extended to cover Sphinx 8 on Python 3.12 — full 7/8/9
  coverage on py312 (#11)
ubmarco added a commit that referenced this pull request Jun 14, 2026
## Release 0.1.1

Version bump `0.1.0 → 0.1.1` plus changelog stamp. No library code
changes — this is release-prep only.

### Changes
- `pyproject.toml` + `src/sphinx_mounts/__init__.py`: version `0.1.0 →
0.1.1`
- `uv.lock`: own-package version synced to `0.1.1`
- `docs/source/changelog.rst`: the accumulated `Unreleased` entries are
stamped as the `0.1.1` release (dated 2026-06-14), matching the `0.1.0`
block's format (label + `:Released:`), with no empty `Unreleased`
section left behind — same convention the `0.1.0` tag used.

### Included in 0.1.1
- **Per-mount `path_check`** option (`"error"` default / `"warn"` /
`"off"`) that confines mounted-bundle directives to the bundle root (#7)
- Regression coverage proving **absolute diagnostic locations** for
mounted docs (#9)
- Regression coverage proving **incremental rebuilds re-read** mounted
docs when their files / include targets change (#10)
- **Sphinx 8 CI coverage** — the matrix now exercises Sphinx 8 on Python
3.12 (full 7/8/9 coverage) (#11)

### Intentionally excluded from the changelog
- **#6 (`html_extra_path` example)** — the commit itself notes this is
stock Sphinx composing with mounts, *not* a sphinx-mounts feature; only
`tests/example/` + `tests/` changed, no `src/`.
- **#8** — CI-only (Bazel doc-build wiring).
- **#4** — docs-site sidebar link (cosmetic).

### Verification
- `uv run prek run` — all hooks pass (the CI `Prek` gate)
- `uvx ruff@0.12.2 format --check` — already formatted (CI's pinned
ruff)
- `sphinx-build -nW --keep-going` — docs build succeeds; changelog
renders

### After merge
Publishing is tag-driven (PyPI Trusted Publishing via `release.yaml`).
To cut the release:

```bash
git tag -a 0.1.1 -m "Release 0.1.1"
git push origin 0.1.1
```

The bare-semver tag (`0.1.1`, no `v`) matches the workflow trigger and
publishes to PyPI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant