Skip to content

feat(test): coverage gate + restore ADR-002 (test-strategy pass 1)#7

Merged
silversurfer562 merged 1 commit into
mainfrom
test/coverage-and-gaps-pass-1
May 11, 2026
Merged

feat(test): coverage gate + restore ADR-002 (test-strategy pass 1)#7
silversurfer562 merged 1 commit into
mainfrom
test/coverage-and-gaps-pass-1

Conversation

@silversurfer562
Copy link
Copy Markdown
Member

Summary

Pass 1 of the test-strategy spec — Layer 1 (attune-help). Closes coverage gaps, adds missing test types, restores ADR-002 (zero required deps beyond python-frontmatter), and lands a CI coverage gate.

  • 44 new tests across 5 new files; total 309 passing
  • Coverage gate enforced at 81% (branch coverage); current measurement 82.31%
  • Circular import unblocked by moving attune-author to the [authoring] extra
  • Zero-dep contract under test via real-venv smoke test

What changed

ADR-002 restoration

  • Moved attune-author from [project.dependencies] to [project.optional-dependencies.authoring] in pyproject.toml.
  • Guarded the 4 deprecated shim modules with try/except ImportError pointing users to pip install attune-help[authoring].
  • Added pytest.importorskip(\"attune_author\") to test_manifest.py, test_staleness.py, test_symbols.py, test_authoring_shims.py.

New test files

File Purpose
tests/test_zero_dep_install.py Real-venv smoke test guarding ADR-002 (5 tests, @pytest.mark.slow).
tests/test_storage_protocol.py Reusable StorageProtocolTester mixin verifying the SessionStorage Protocol against LocalFileStorage + an in-memory reference impl (8 tests).
tests/test_templates.py Direct tests for _find_template_file (incl. CWE-22 guard), _parse_template_file, and the mtime-aware parse cache (12 tests).
tests/test_adapter_rag.py AttuneHelpAdapter defaults, override paths, protocol conformance (6 tests).
tests/test_mcp_handlers.py Direct unit tests for _require_str, engine builder, server factory + singleton (13 tests).

Coverage + CI

  • pyproject.toml gains [tool.pytest.ini_options] (registered slow marker) and [tool.coverage.*] with branch = true and fail_under = 81.
  • tests.yml runs coverage only on the ubuntu-latest x py3.11 cell of the existing matrix; uploads the report as an artifact.
  • New test-no-authoring-extra job verifies the importorskip skip path actually works when the extra isn't installed.
  • New tests/README.md documents how to run tests and points at the attune-author conftest as the LLM-mocking reference (pass 2 will formalize).

Test plan

  • pytest --cov locally — 309 passing, 82.31% branch coverage
  • ruff check src/ tests/ clean
  • Verified all 5 zero-dep smoke tests pass (real venv creation, ~40s)
  • CI matrix passes on ubuntu/macos/windows × py3.10–3.13
  • CI test-no-authoring-extra job passes
  • Coverage artifact uploads correctly

Rollback

Revert in this order if needed:

  1. Drop fail_under line in pyproject.toml (releases the gate without losing tests)
  2. Delete the 5 new test files
  3. Revert shim try/except guards + test importorskip lines
  4. Revert pyproject dep move (restores attune-author as required)

Notes

  • The 3 DeprecationWarning outputs in the test run are intentional — the shim modules emit them by design until the 2026-07-07 sunset.
  • This is one of four Pass 1 PRs (one per attune layer). The others — attune-gui, attune-rag, attune-author — will land independently.

🤖 Generated with Claude Code

Pass 1 of the test-strategy spec for the attune product family.

ADR-002 restoration:
- Move attune-author from required dep to [authoring] extra in
  pyproject.toml; restores zero-required-deps beyond python-frontmatter.
- Guard the 4 deprecated shim modules (manifest, staleness,
  freshness, freshness.symbols) with try/except ImportError that
  points users to ``pip install attune-help[authoring]``.
- Gate the 4 shim test files with ``pytest.importorskip``.

New test files (44 new tests):
- test_zero_dep_install.py — fresh-venv smoke test verifying the
  zero-dep import contract; marked @pytest.mark.slow.
- test_storage_protocol.py — reusable StorageProtocolTester mixin
  exercising the SessionStorage Protocol against LocalFileStorage
  + a reference in-memory backend.
- test_templates.py — direct tests for _find_template_file (incl.
  CWE-22 traversal guard), _parse_template_file, and the mtime-aware
  parse cache.
- test_adapter_rag.py — AttuneHelpAdapter defaults, override paths,
  protocol conformance.
- test_mcp_handlers.py — _require_str validator paths, engine
  builder, server factory + singleton.

Coverage gate:
- pytest-cov configured with branch coverage and fail_under = 81
  (measure-then-lock at baseline-2pp). Current measurement: 82.31%.
- Registered the ``slow`` marker.
- tests.yml: coverage on ubuntu x py3.11 cell only; new
  test-no-authoring-extra job verifies importorskip skip path.
- New tests/README.md documenting how to run + the LLM-mocking
  pattern (attune-author conftest is the reference for pass 2).

Spec: specs/test-strategy/{requirements,design,tasks}.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@silversurfer562 silversurfer562 merged commit 26d3c00 into main May 11, 2026
13 checks passed
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