Skip to content

refactor(help): shim manifest/staleness/freshness; add rag adapter#6

Merged
silversurfer562 merged 1 commit intomainfrom
refactor/help-shim-authoring
May 8, 2026
Merged

refactor(help): shim manifest/staleness/freshness; add rag adapter#6
silversurfer562 merged 1 commit intomainfrom
refactor/help-shim-authoring

Conversation

@silversurfer562
Copy link
Copy Markdown
Member

Summary

Phase B2 of the architecture-realignment spec. The authoring modules manifest.py, staleness.py, freshness/ moved to attune-author in PR #14 (B1). This PR collapses the help-side originals into thin re-export shims that emit DeprecationWarning and adds the rag-adapter that pairs with attune-rag PR #10 (Phase A).

  • Replace attune_help/manifest.py, staleness.py, freshness/__init__.py, freshness/symbols.py with shims (from attune_author.X import * + DeprecationWarning).
  • Stop re-exporting manifest/staleness symbols from attune_help.__init__ so a plain import attune_help is warning-free during the deprecation window. Engine-related re-exports preserved.
  • Add attune_help/adapters/rag.py::AttuneHelpAdapter — a frozen dataclass that satisfies attune-rag's HelpCorpusAdapter protocol (templates_root, version).
  • Bump attune-help to 0.11.0 and declare attune-author>=0.7.0 as a transitional dep (see Coordination notes below).
  • 4 new shim tests (tests/test_authoring_shims.py) verify symbol identity through the shim AND the DeprecationWarning fires per module.

Net diff: +300 / −1090 (~790-line shrink in attune_help).

Closes / does not close

Course-correction: B2.3 deferred

design.md describes attune_help/discovery.py as duplicating retrieval scoring that ADR-001 reserves for attune-rag, and proposes routing through attune_rag.KeywordRetriever. After reading the actual code, I think this misidentifies what discovery.py is doing:

  • discovery.search() does typo-tolerant fuzzy slug match via difflib.SequenceMatcher plus a substring bonus — its job is autocomplete / "did you mean X?".
  • attune_rag.KeywordRetriever does token-overlap content scoring weighted across path / summary / content / aliases / related — its job is RAG retrieval.

tests/test_discovery.py::test_search_finds_misspelling asserts that search("secrity-audit") finds security-audit. KeywordRetriever doesn't (and shouldn't) do character-level fuzz; it would tokenize both inputs and find no overlap. Replacing discovery's loop with KeywordRetriever().retrieve(...) would be a behavior break, not a duplication removal.

Recommendation: leave discovery.py as-is in this PR. If finding #3 still feels like the right call, scope a follow-up that either (a) adopts KeywordRetriever as a second mode for content-based search while keeping fuzzy slug autocomplete, or (b) revises the finding now that the code is closer to scope. Happy to course-correct if you'd rather close it now.

Coordination required before merge

  1. attune-author release. This PR declares attune-author>=0.7.0, but the latest published is 0.6.2 — without the relocated manifest/staleness/freshness modules. Need a 0.7.0 (or 0.6.3) release of attune-author that ships the B1 changes BEFORE this PR is published to PyPI. Local dev install (pip install -e ../attune-author) works against main.
  2. attune-author has a stale attune-help>=0.10.0 dep in pyproject.toml that's a leftover from the pre-B1 era (no from attune_help imports in attune-author/src anymore). Worth a separate one-line cleanup PR on attune-author so we don't have a circular package-metadata edge.
  3. tech.md tension. ADR constraint: "attune-help install footprint: zero required deps beyond python-frontmatter." This PR adds attune-author>=0.7.0 as a transitional required dep. Carried forward in CHANGELOG; constraint restored when shims are removed (target 2026-07-07, tracked by RemoteTrigger 01Vuq4AiaKLspV2wNVpCQN1o).

Test plan

  • Full attune-help suite green: 265 passed, 3 expected DeprecationWarnings (existing test_manifest/test_staleness/test_symbols intentionally exercise the shims).
  • New tests/test_authoring_shims.py — 7 tests: 4 parametrized DeprecationWarning checks + 3 symbol-identity checks (Feature is attune_author.manifest.Feature, etc).
  • ruff check src/ tests/ clean.
  • Pending coordination: cut attune-author 0.7.0 (or pin git ref) so installing pip install attune-help==0.11.0 resolves cleanly.

🤖 Generated with Claude Code

Phase B2 of the architecture-realignment spec
(specs/architecture-realignment/{requirements,design,tasks}.md).

The authoring modules manifest.py, staleness.py, freshness/ moved to
attune-author in B1 (#14). This change replaces the help-side files
with thin re-export shims that emit DeprecationWarning, preserves
existing import paths for one minor release, and adds the
HelpCorpusAdapter implementation that pairs with attune-rag's
typed protocol from Phase A (attune-rag #10).

Net change: ~914 lines removed, ~176 added. Three internal modules
(~1063 lines total) collapse to four ~30-line shims that re-export
their replacements.

Closes finding #1 (ADR-002 violation) of the 2026-05-07 architecture
review. Finding #3 (ADR-001 leak in discovery.py) is intentionally
deferred in this PR — see PR body.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@silversurfer562
Copy link
Copy Markdown
Member Author

attune-author 0.7.0 just published — CI dep resolution should now succeed. Re-running checks.

@silversurfer562 silversurfer562 merged commit 415b404 into main May 8, 2026
20 of 36 checks passed
@silversurfer562 silversurfer562 deleted the refactor/help-shim-authoring branch May 8, 2026 03:59
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