Skip to content

PR #10 polish: standardize MCP warning shape + close small coverage gaps #21

Description

@detour1999

Follow-up to PR #10. Bundle of small polish items — individually not worth an issue each, together worth one focused sweep.

1. Standardize MCP warning message shape

Warning strings across the MCP surface drift in style:

```
"project lookup failed for project %d: %v" // prose
"activity range unavailable: %v" // terse noun+colon
"tool stats unavailable: %v" // same
"tokens_by_day unavailable: %v" // same
"project %d not found — session references a missing project" // verbose with em-dash
```

Proposal: adopt one shape everywhere — `" unavailable: "`. Concretely:

  • `lookupProjectPath`: `"project %d unavailable: not found"` and `"project %d unavailable: %v"`
  • Everything else already conforms.

2. Simplify `lookupProjectPath` return type

Currently returns `(string, []string)`. The two error paths each return a slice of length 1, and no caller aggregates. Simpler as `(path string, warning string)` — callers check `if warning != ""`.

3. Fill test gaps

Three PR #10 behaviors either aren't tested or are only tested transitively:

  • `list_sessions` and `list_projects` clamp `limit > 100` to 100. `TestListProjects_ReportsHasMoreAndClampsLimit` is named for it but the body only tests `limit=1` and `limit=0`. Add a `limit=200` case.
  • `get_stats` emits warnings when its own enrichment queries fail. Currently only exercised transitively via `TestGetAnalytics_PropagatesSummaryWarnings`. Add a direct `TestGetStats_DegradedFieldsWarn` that drops `tool_uses` and asserts `result.warnings` mentions tool stats + `top_tools` is absent from the result.
  • `get_stats` omits `first_activity` / `last_activity` / `days_span` when `GetFirstAndLastActivity` fails. No test today.

None of these are broken — they behave as documented in skill docs. Just missing verification.

Not scope

  • The bifurcated warnings location and the pagination model split are tracked as separate follow-ups (see other issues filed alongside this one).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions