Skip to content

feat(#82,#83): Protocol versioning, enrichment guardrails, and documentation fixes#190

Merged
Cataldir merged 3 commits intomainfrom
docs/82-83-protocol-versioning-guardrails-docs
Mar 5, 2026
Merged

feat(#82,#83): Protocol versioning, enrichment guardrails, and documentation fixes#190
Cataldir merged 3 commits intomainfrom
docs/82-83-protocol-versioning-guardrails-docs

Conversation

@Cataldir
Copy link
Contributor

@Cataldir Cataldir commented Mar 5, 2026

Summary

Closes #82, closes #83. Resolves all documentation staleness findings from the v1.1.0 audit.


Changes

Issue #82 - Protocol Interface Evolution

  • New: lib/src/holiday_peak_lib/connectors/common/versioning.py
    • ProtocolVersion with comparison operators and is_compatible_with()
    • FieldSpec / ProtocolDiff dataclasses with is_breaking() and summary()
    • BaseConnectorProtocol ABC with _ProtocolMeta metaclass (rejects invalid VERSION types at class definition time)
    • PIMConnectorProtocol_v1 (8 fields) and PIMConnectorProtocol_v2 (+5 fields, 2 new abstract methods)
    • negotiate_version(), register_protocol(), diff_protocols()
    • VersionedAdapter - strips fields unknown to the client version, logs deprecation warnings
  • Updated connectors/common/__init__.py to export all 10 versioning symbols
  • 40 new tests in lib/tests/test_connectors/test_versioning.py

Issue #83 - Data Enrichment Guardrails

  • Extended enrichment_guardrail.py with:
    • SourceRef - typed reference to an internal data source with as_tag()
    • SourceValidator - async; validates PIM/DAM source existence; subclassable via _validate_external()
    • ContentAttributor - injects _sources, _source_system, _source_id, _confidence, _attributed_at into enriched output
    • GuardrailMiddleware - async facade combining validation, attribution, and audit logging
  • Updated guardrails/__init__.py to export all 6 symbols (was 2)
  • 39 new tests in lib/tests/test_guardrails.py

Documentation Staleness Fixes


Test Results

699 passed, 28 warnings — no regressions.

Issue #82 — Protocol Interface Evolution:
- Add lib/src/holiday_peak_lib/connectors/common/versioning.py
  - ProtocolVersion with comparison operators and is_compatible_with()
  - FieldSpec / ProtocolDiff dataclasses with is_breaking() and summary()
  - BaseConnectorProtocol ABC with _ProtocolMeta metaclass validation
  - PIMConnectorProtocol_v1 (8 fields) and v2 (+5 fields, 2 new abstract methods)
  - negotiate_version(), register_protocol(), diff_protocols()
  - VersionedAdapter with field-mask for older clients + deprecation warnings
- Export all 10 symbols from connectors/common/__init__.py
- Add 40 tests in lib/tests/test_connectors/test_versioning.py

Issue #83 — Data Enrichment Guardrails:
- Extend enrichment_guardrail.py with SourceRef, SourceValidator,
  ContentAttributor, and GuardrailMiddleware async facade
- Update guardrails/__init__.py to export 6 symbols (was 2)
- Add 39 new tests in lib/tests/test_guardrails.py

Documentation staleness fixes:
- Test count 508 -> 699 across IMPLEMENTATION_ROADMAP.md,
  project-status.md, and business-summary.md
- Issues #79-#83 marked Closed in project-status.md
- Remove stale PR #135 draft row from active PRs table
- Update Architecture_Patterns agent row (5 closed, 1 open)
- Fix 3 wrong import paths in adr-023 (resilience -> utils.*)
- Fix RetailAdapter -> BaseAdapter in adr-003
- Remove duplicate Governance and Compliance section in architecture/README.md;
  add Reference Architecture Patterns entry

Total: 699 tests passing (was 635)
Comment on lines +177 to +182
def __new__(
mcs,
name: str,
bases: tuple[type, ...],
namespace: dict[str, Any],
) -> "_ProtocolMeta":
- Remove extra blank line after imports in test_versioning.py (isort)
- Black-format all 4 changed files
- Rename unused _validate_external sku param to _sku (pylint W0613)
- Add pylint: disable=invalid-name for intentional _v1/_v2 class suffixes
- Achieves 10.00/10 pylint score on changed lib files
def test_invalid_version_type_raises(self):
with pytest.raises(TypeError, match="ProtocolVersion"):

class BadProtocol(BaseConnectorProtocol): # type: ignore[misc]
@Cataldir Cataldir merged commit cfc93dc into main Mar 5, 2026
10 checks passed
@Cataldir Cataldir deleted the docs/82-83-protocol-versioning-guardrails-docs branch March 5, 2026 15:14
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.

Architecture: Internal Data Enrichment Guardrails Architecture: Protocol Interface Evolution

1 participant