← Back to Pull requests

fix(types): make README examples type-check #287

Closed
unknown closed this pull request without merging on Oct 14, 2026 10:41 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 11:21 UTC
Author

Four README examples didn't compile against the package's types. This fixes all four:

1. Redis options. MCPPluginOptions['redis'] was { host, port, password?, db?, tls? }, but the object goes straight to new Redis(opts.redis) and the docs say any ioredis option works. It's now typed as ioredis' RedisOptions. The example used retryDelayOnFailover, which is a Cluster-only option that ioredis ignores on a plain client, so it now uses retryStrategy. The options reference lists RedisOptions.
2. URL elicitation. mcpElicitUrl() returns string | null, so the example now checks for null before calling mcpNotifyElicitationComplete().
3. Custom request id elicitation. skills was an array of free-form strings, which isn't a valid elicitation schema. It's now a multi-select enum.
4. Rate limiting. @platformatic/mcp/security doesn't exist because there's no exports map. RateLimiter is now exported from the main entry point and both examples import it from there. I didn't add an exports map because it would block every deep import into dist/ that works today.

Verification


  • tsd: test-d/index.test-d.ts now covers the wider redis type (extra ioredis options, sentinels, a RedisOptions variable, a host-only or port-only config, and rejection of wrong value types) and the RateLimiter export.

  • I extracted the changed snippets, plus the TLS Redis example, and ran tsc --noEmit --strict on them against the built dist/. They pass. The original versions fail with the four errors from the issue.

  • lint, typecheck and the full suite (598 tests) pass.
  • Breaking change


    None for callers: the redis type only gets wider. host and port are now optional because ioredis defaults them to localhost:6379, so the two tsd assertions that required them were flipped. Code that reads opts.redis.host as string from MCPPluginOptions now sees string | undefined.

    Fixes #265

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01UF4S3w7iA83V9DVsasLJzM

    Diff: 258 lines (+193 / -65) across 3 files Reviewer: rozzilla Review duration: 1400m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 258 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #287"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.5% · Safe to merge
    15.5%