Skip to content

perf(clients): bound routine queries by default#37

Merged
mfacenet merged 1 commit into
mainfrom
perf/rate-limit-defaults
Jul 12, 2026
Merged

perf(clients): bound routine queries by default#37
mfacenet merged 1 commit into
mainfrom
perf/rate-limit-defaults

Conversation

@mfacenet

Copy link
Copy Markdown
Contributor

Summary

  • cap routine queries at 100 commits by default while preserving an explicit 0 for exhaustive scans
  • expose a per-call max_commits override to MCP clients and keep MCP diff retrieval explicitly opt-in
  • reduce GitHub and GitLab pagination once the truncation-probe budget is satisfied, including repo and org/group scans
  • document the new defaults and add regression coverage for config, MCP, and provider behavior

Why

Routine queries should avoid unnecessary provider requests, rate-limit pressure, and token-heavy MCP output without weakening the exact Truncated result contract.

Testing

  • go -C tools tool task ci
  • go -C tools tool task test-cover-check
  • graphify update . (894 nodes, 1,667 edges; generated output remains ignored by repository policy)

Signed-off-by: Shawn Stratton <shawn.stratton@mface.net>
Copilot AI review requested due to automatic review settings July 12, 2026 02:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates sting’s default behavior to cap routine queries at 100 commits (while preserving 0 as “unlimited”), and reduces upstream pagination/work once the cap is satisfied. It also refines MCP semantics so diff retrieval is explicitly opt-in per call and adds a per-call max_commits override for MCP clients.

Changes:

  • Set default max_commits to 100 across config, CLI flags, docs, and examples; keep 0 as the explicit exhaustive-scan escape hatch.
  • Make MCP include_diffs default to false when omitted (independent of server config), and add MCP max_commits as a per-call override.
  • Reduce GitHub/GitLab pagination and stop repo/org/group enumeration once the remaining commit budget is exhausted; add regression tests for these behaviors.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Documents the new default cap and clarifies MCP diffs are opt-in.
internal/mcpserver/server.go Adds max_commits to MCP input; makes omitted include_diffs default to false for MCP calls.
internal/mcpserver/getcommits_test.go Adds tests for MCP max-commit override and diffs-default-off behavior.
internal/cli/root.go Changes CLI default --max-commits from unlimited to config.DefaultMaxCommits.
internal/cli/cli_test.go Asserts loaded config defaults include the new default max commits.
config/config.go Introduces DefaultMaxCommits = 100; updates default config and validation.
config/config_test.go Adds validation coverage for negative max_commits.
config/resolve.go Adds per-request MaxCommits override handling and validation.
config/resolve_test.go Adds coverage for default max commits and request override semantics (including explicit 0).
config.example.yaml Updates example config to show the new default max_commits: 100.
ghclient/ghclient.go Bounds page sizes and stops org/repo pagination early once the commit budget is satisfied.
ghclient/collect_test.go Adds regression test ensuring org repo pagination stops once MaxCommits is reached.
gitlabclient/gitlabclient.go Bounds page sizes and stops group/project pagination early once the commit budget is satisfied.
gitlabclient/gitlabclient_test.go Adds regression test ensuring group project pagination stops once MaxCommits is reached.

@mfacenet
mfacenet merged commit 4affd0b into main Jul 12, 2026
12 checks passed
@mfacenet
mfacenet deleted the perf/rate-limit-defaults branch July 12, 2026 02:48
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.

2 participants