Skip to content

DD-338 Phase C W5 — consolidate _meta emission onto MCPHelpers + catalog backfill#3

Merged
piersdd merged 2 commits into
mainfrom
feat/dd-338-c-w5-flip-mcp-helpers
May 24, 2026
Merged

DD-338 Phase C W5 — consolidate _meta emission onto MCPHelpers + catalog backfill#3
piersdd merged 2 commits into
mainfrom
feat/dd-338-c-w5-flip-mcp-helpers

Conversation

@piersdd
Copy link
Copy Markdown
Contributor

@piersdd piersdd commented May 24, 2026

Summary

  • DD-338 Phase C Wave 5 Cluster WA: replace the 160-LOC hand-rolled Sources/AppleNotesBlade/MetaEnvelope.swift with the canonical stallari-mcp-helpers-swift SPM dep (MCPHelpers v0.1.0).
  • Platform bump .macOS(.v13) → .macOS(.v14) to satisfy the canonical lib's minimum platform.
  • Catalog declarations in stallari-plugins/plugins/tools/apple-notes-blade-mcp.json flip audit_surface: minimal → structured for the 3 emitting tools — landed in a sibling stallari-plugins PR (separate atomic unit per spec).

Wire-shape changes (canonical vs hand-rolled v1)

  • redactions ALWAYS emitted ([] when empty). Was omit-when-empty.
  • next_cursor ALWAYS emitted (JSON null when nil). Was omit-when-nil.
  • filtered_by alphabetically sorted by the formatter (caller pre-sort no longer load-bearing).
  • formatMetaLine now throws (encoding-failure surface).
  • MetaEnvelope.init parameter order changed to (matchedTotal, returned, latencyMs, filteredBy, redactions, ...) — all 3 tool handlers updated.

Retained blade-local

  • Duration.toMilliseconds() — clock marshalling helper.
  • metaQueryDigest(_:) — search-query SHA-256 short digest.

Moved into Sources/AppleNotesBlade/MetaHelpers.swift.

Test plan

  • swift package resolve clean
  • swift build clean, zero warnings
  • swift test — 73/73 green
  • MetaEnvelope.swift deleted; grep -rn "MetaEnvelope.swift" Sources/ shows only doc-comment references
  • CHANGELOG entry added (v0.3.0)
  • Version bumped 0.2.0 → 0.3.0
  • New canonical-shape gate test exercises locked input/output pair against MCPHelpers contract

🤖 Generated with Claude Code

piersdd and others added 2 commits May 24, 2026 11:43
…M dep

Replace the 160-LOC hand-rolled `Sources/AppleNotesBlade/MetaEnvelope.swift`
with the canonical `stallari-mcp-helpers-swift` SPM dep (MCPHelpers v0.1.0).
The hand-rolled v1 was written 2026-05-23 in PR #2 alongside the first Swift
_meta envelope emission; the canonical lib shipped 2026-05-23 as DD-338 Phase
E.swift and the duplication is now retired before it drifts.

Wire-shape changes (canonical vs hand-rolled v1):
- `redactions` ALWAYS emitted (`[]` when empty). Was omit-when-empty.
- `next_cursor` ALWAYS emitted (JSON `null` when nil). Was omit-when-nil.
- `filtered_by` alphabetically sorted by the formatter. Caller pre-sort no
  longer load-bearing; existing pre-sort calls remain harmless.
- `formatMetaLine` now throws (encoding-failure surface, unreachable for our
  value types).

Per the canonical contract, `MetaEnvelope.init` parameter order is now
(matchedTotal, returned, latencyMs, filteredBy, redactions, ...) — all 3
emitting tool handlers updated. ResultBuilder.makeResultWithMeta wraps the
new try-formatMetaLine in the existing do/catch and routes encode failures
through errorResult(.internalError("encode_failure")) per Wave 3 OQ-7.

Retained as blade-local (not part of the canonical surface):
- `Duration.toMilliseconds()` — `ContinuousClock.Duration` → Int ms for
  populating MetaEnvelope.latencyMs (canonical leaves clock marshalling to
  the caller).
- `metaQueryDigest(_:)` — SHA-256 short digest for search-query audit values.
  Blade-domain helper; not generic enough for the canonical lib.

Moved into Sources/AppleNotesBlade/MetaHelpers.swift.

Platform bump: .macOS(.v13) → .macOS(.v14) to satisfy the canonical lib's
minimum platform. macOS 14 (Sonoma 2023) is widely deployed; consumer is the
Stallari harness only.

Catalog declarations in stallari-plugins/plugins/tools/apple-notes-blade-mcp.json
flip in a sibling PR (separate stallari-plugins repo) — covered by the
`feat/dd-338-w5-apple-catalog-flip` branch.

Test surface:
- All 73 existing tests pass post-flip (zero regressions).
- MetaEnvelopeTests updated for canonical wire shape: 4-key formatter
  assertion → 6-key, omit-when-empty tests → always-present-with-default
  assertions, +1 canonical-shape gate test using locked input/output pair.

Build: clean, zero warnings.
Tests: 73/73 green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…deps

Same fix as the sister apple-mail-blade-mcp commit 6fc526a. The DD-338
W5 SPM dep on stallari-mcp-helpers-swift transitively requires
swift-tools-version 6.0+; macos-14 GH runner ships Swift 5.10 by default.

macos-15 ships Xcode 16 / Swift 6.0+ — keeping it as the single CI target.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@piersdd piersdd merged commit 5f6a72c into main May 24, 2026
1 check 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