Dedupe SDK option contracts and type folder helpers

Merged
UN
4mo ago
+178-113

Summary

  • Reuse the type-registry default-folder primitive from store path resolution so custom item folders are single-sourced.
  • Deduplicate shared SDK tool option contract slices while preserving the generated contract snapshot.
  • Replace unnecessary any callback payload typings in Sentry helper tests.
  • Record pm evidence on pm-92if, including file/test links, temp smoke, changelog/package doctor, GitHub security sweep, Sentry/telemetry, and the public-scope deferral note for pm-rj3w ignored production telemetry files.

Verification

  • pnpm build
  • node scripts/run-tests.mjs test -- tests/unit/core/store/store-paths.spec.ts tests/unit/core/sentry/sentry-helpers.spec.ts tests/unit/commands/contracts-command.spec.ts tests/unit/sdk/sdk-index.spec.ts (4 files / 197 tests)
  • node scripts/run-tests.mjs coverage (256 files / 5138 tests / 100% statements, branches, functions, lines)
  • pnpm typecheck
  • pnpm lint
  • pnpm quality:static
  • pnpm contracts:check
  • pnpm security:scan
  • pnpm audit --audit-level moderate
  • git diff --check
  • pm test pm-92if --run --progress (14/14 sandbox-compatible linked commands)
  • Manual temp smoke at /tmp/tmp.TlcR1qJCP0/work/.agents/pm: init, research preset, custom research-note type, Task/custom item create+list, health, validate, and research-notes/ storage verification.
  • pnpm changelog:pm:check with pm-changelog 2026.6.27: CHANGELOG.md unchanged, item_count=1363.
  • pm health --check-only --summary --json: ok, warning_count 0.
  • pm validate --check-resolution --check-history-drift --json: history drift ok; existing resolution metadata backlog remains validate_resolution_missing_fields:258.
  • node dist/cli.js package doctor --project --detail deep --json: ok, zero warnings.
  • node scripts/release/sentry-telemetry-gate.mjs --json --telemetry-mode best-effort: Sentry critical=0 high=0; telemetry finish_error_rate_pct=0.76, failures_without_error_code_rows=0.

GitHub / Security Sweep

  • No open PRs before this branch.
  • No open Dependabot, code scanning, or secret scanning alerts.
  • pnpm audit --audit-level moderate: no known vulnerabilities.
  • Open issue #374 remains externally blocked on missing RELEASE_PAT in the release environment.

Notes

node scripts/run-tests.mjs coverage and pnpm contracts:check are intentionally documented as direct repo gates rather than linked pm tests. The linked-test schema sandbox changes runtime context for those repo-wide checks; the direct current-tree commands pass and are recorded on pm-92if.

Summary by Sourcery

Deduplicate shared SDK tool option flag contracts and align store path type folder resolution with the type registry, while tightening Sentry helper test typings and updating pm tracking artifacts.

Enhancements:

  • Introduce shared option contract sets for SDK list, aggregate, dedupe audit, and search tools to centralize common item filter flags.
  • Reuse the type registry default folder helper in store path resolution so custom item type folders are derived from a single source.
  • Refine Sentry helper test callback typings by replacing broad any-based payload types with a dedicated structured payload alias.

Tests:

  • Update pm agent epic, issue, history, and managed-extensions artifacts to record verification and telemetry evidence for pm-92if and pm-rj3w.

Summary by cubic

Single-sourced default folders for custom item types through the type registry and deduped SDK tool option contracts with clear, named groups. Exported arrays now clone shared entries only at export boundaries to prevent cross-array mutation; the contract snapshot is unchanged and Sentry test hooks use @sentry/node Event/Breadcrumb types.

  • Refactors
    • Store paths use toDefaultFolder for custom item directories.
    • Replaced slice-based composition with named base/window/relation groups; TOOL_*_OPTION_CONTRACTS keep flag order.
    • Shared groups are readonly and cloned at export boundaries to avoid leakage and double cloning; added side-effect-free isolation tests.
    • Removed an unused private filter group from the SDK contract helpers.
    • Added docstrings for the cloning helper and test lookup; Sentry helper tests use @sentry/node Event/Breadcrumb types.