Skip to content

Commit 5e457b7

Browse files
refactor(help): shim manifest/staleness/freshness; add rag adapter
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>
1 parent ff376ad commit 5e457b7

10 files changed

Lines changed: 300 additions & 1090 deletions

File tree

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
All notable changes to `attune-help` are documented here.
44

5+
## 0.11.0 — 2026-05-08
6+
7+
### Changed (deprecation)
8+
9+
- **`attune_help.manifest`, `attune_help.staleness`, and
10+
`attune_help.freshness` (+ `attune_help.freshness.symbols`) moved to
11+
`attune_author.*`.** The original modules now ship as thin re-export
12+
shims that emit `DeprecationWarning` on import. Update your imports:
13+
14+
# before
15+
from attune_help.manifest import Feature, FeatureManifest
16+
17+
# after
18+
from attune_author.manifest import Feature, FeatureManifest
19+
20+
The shims will be **removed in the next minor release of
21+
attune-help (target: 2026-07-07)**. After that release, importing
22+
from the old paths raises `ImportError`.
23+
24+
- The package no longer re-exports manifest / staleness symbols from
25+
its top-level (`attune_help.Feature`, `attune_help.StalenessReport`,
26+
…). Import them from `attune_author` directly. A plain
27+
`import attune_help` is now warning-free during the deprecation
28+
window.
29+
30+
### Added
31+
32+
- **`attune_help.adapters.rag.AttuneHelpAdapter`** — implements
33+
`attune_rag.corpus.help_adapter.HelpCorpusAdapter` so attune-rag's
34+
`AttuneHelpCorpus` can be built without a dynamic import of
35+
attune-help. Pairs with `attune-rag` 0.1.10's typed adapter
36+
protocol. Closes finding **#1** (ADR-002 violation) of the
37+
2026-05-07 architecture review.
38+
39+
### Dependencies
40+
41+
- New required: `attune-author>=0.7.0`. Transitional — required only
42+
while the deprecated shims live. Removed together with the shims
43+
on 2026-07-07.
44+
545
## 0.10.0 — 2026-04-30
646

747
### Added

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "attune-help"
7-
version = "0.10.2"
7+
version = "0.11.0"
88
description = "Lightweight help runtime with progressive depth and audience adaptation."
99
readme = {file = "README.md", content-type = "text/markdown"}
1010
requires-python = ">=3.10"
@@ -27,6 +27,13 @@ classifiers = [
2727
]
2828
dependencies = [
2929
"python-frontmatter>=1.0.0",
30+
# Transitional: manifest/staleness/freshness moved to attune-author
31+
# in 0.11.0. ``attune_help.manifest``/``staleness``/``freshness``
32+
# are deprecated shims that re-export from attune-author. Required
33+
# so existing imports keep working through the deprecation window.
34+
# Drop this dep when the shims are removed (target 2026-07-07) and
35+
# restore tech.md's zero-required-deps constraint.
36+
"attune-author>=0.7.0",
3037
]
3138

3239
[project.optional-dependencies]

src/attune_help/__init__.py

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,7 @@
1414
PopulatedTemplate,
1515
TemplateContext,
1616
)
17-
from attune_help.manifest import (
18-
Feature,
19-
FeatureManifest,
20-
Manifest,
21-
is_safe_feature_name,
22-
load_manifest,
23-
match_files_to_features,
24-
resolve_topic,
25-
save_manifest,
26-
slugify,
27-
)
2817
from attune_help.preamble import get_preamble # noqa: F401
29-
from attune_help.staleness import (
30-
DocStaleness,
31-
FeatureStaleness,
32-
StalenessReport,
33-
build_doc_footer,
34-
check_staleness,
35-
compute_semantic_hash,
36-
compute_source_hash,
37-
parse_doc_footer,
38-
)
3918
from attune_help.storage import LocalFileStorage, SessionStorage
4019

4120
__all__ = [
@@ -48,27 +27,15 @@
4827
"TemplateContext",
4928
"get_demo_path",
5029
"get_preamble",
51-
# Manifest
52-
"Feature",
53-
"FeatureManifest",
54-
"Manifest",
55-
"is_safe_feature_name",
56-
"load_manifest",
57-
"match_files_to_features",
58-
"resolve_topic",
59-
"save_manifest",
60-
"slugify",
61-
# Staleness
62-
"DocStaleness",
63-
"FeatureStaleness",
64-
"StalenessReport",
65-
"build_doc_footer",
66-
"check_staleness",
67-
"compute_semantic_hash",
68-
"compute_source_hash",
69-
"parse_doc_footer",
7030
]
7131

32+
# Manifest, staleness, and freshness moved to attune-author. Importing
33+
# them through ``attune_help.*`` still works via the deprecated shims
34+
# in this package (they emit ``DeprecationWarning`` on first import).
35+
# The shims are not eagerly imported here so that a plain
36+
# ``import attune_help`` stays warning-free during the deprecation
37+
# window.
38+
7239
try:
7340
from importlib.metadata import version
7441

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Adapters that expose attune-help's bundled corpus to other packages.
2+
3+
The :mod:`attune_help.adapters.rag` module implements
4+
:class:`attune_rag.corpus.help_adapter.HelpCorpusAdapter` so attune-rag
5+
can build an :class:`attune_rag.corpus.attune_help.AttuneHelpCorpus`
6+
without ever importing attune-help directly.
7+
"""

src/attune_help/adapters/rag.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Adapter exposing attune-help's bundled corpus to attune-rag.
2+
3+
attune-rag declares a small structural ``HelpCorpusAdapter`` protocol
4+
(``templates_root: Path``, ``version: str``). This module ships an
5+
implementation so attune-rag's corpus factory can build the
6+
``AttuneHelpCorpus`` without dynamically importing attune-help. The
7+
direction of the dependency edge inverts: attune-rag knows nothing of
8+
attune-help; attune-help imports rag's protocol and conforms to it.
9+
10+
Usage::
11+
12+
from attune_help.adapters.rag import AttuneHelpAdapter
13+
from attune_rag.corpus.attune_help import AttuneHelpCorpus
14+
15+
corpus = AttuneHelpCorpus(adapter=AttuneHelpAdapter())
16+
"""
17+
18+
from __future__ import annotations
19+
20+
from dataclasses import dataclass, field
21+
from pathlib import Path
22+
23+
from attune_help import __version__ as _help_version
24+
25+
_BUNDLED_TEMPLATES = Path(__file__).resolve().parent.parent / "templates"
26+
27+
28+
@dataclass(frozen=True)
29+
class AttuneHelpAdapter:
30+
"""attune-help's default :class:`HelpCorpusAdapter` implementation.
31+
32+
By default points at the bundled templates directory and reports
33+
the installed package version. Both fields are overridable so
34+
tests and downstream callers can supply their own corpus root or
35+
version string without subclassing.
36+
"""
37+
38+
templates_root: Path = field(default=_BUNDLED_TEMPLATES)
39+
version: str = field(default=_help_version)
Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
"""Symbol extraction for semantic-freshness staleness detection (Phase 1).
2-
3-
Known limitation — re-export shims:
4-
Pure re-export modules (``from pkg import *`` with no definitions) produce
5-
zero symbols. If a feature's ``files:`` list includes only shim files,
6-
``compute_semantic_hash`` will return SHA-256("") for that feature.
7-
Mitigation: list the upstream implementation file alongside the shim in
8-
``features.yaml``, or use Option B (per-symbol frontmatter) in a future
9-
release. Tracked for Phase 2 evaluation.
1+
"""DEPRECATED: moved to :mod:`attune_author.freshness`.
2+
3+
Re-exported here for one minor release of attune-help so existing
4+
imports keep working while consumers migrate. The shim emits
5+
:class:`DeprecationWarning` on import.
6+
7+
Update your imports::
8+
9+
from attune_author.freshness import SymbolExtractor, SymbolRecord
10+
11+
This shim will be removed in the next minor release of attune-help
12+
(target: 2026-07-07 — see CHANGELOG).
1013
"""
1114

12-
from attune_help.freshness.symbols import SymbolExtractor, SymbolRecord
15+
from __future__ import annotations
16+
17+
import warnings
18+
19+
from attune_author.freshness import SymbolExtractor, SymbolRecord
1320

1421
__all__ = ["SymbolExtractor", "SymbolRecord"]
22+
23+
warnings.warn(
24+
"attune_help.freshness is deprecated; import from attune_author.freshness. "
25+
"This shim will be removed in the next minor release of attune-help.",
26+
DeprecationWarning,
27+
stacklevel=2,
28+
)

0 commit comments

Comments
 (0)