← Back to Pull requests

Add opt-in paging to the ListTicketSchemas task #1238

Closed
unknown closed this pull request without merging on Nov 24, 2026 01:33 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 02:48 UTC
Author

Connectors with many ticket schemas were truncated at 100 when the ListTicketSchemas task ran in service mode, and callers had no way to ask for the rest.

What changed

  • ListTicketSchemasTask gains paginate, page_token and page_size. These are new field numbers, so the change is additive.

  • TicketsServiceListTicketSchemasResponse gains bool paged, which only the SDK sets. Connectors need no changes.

  • When paginate is false, the old code path runs unchanged: unroll up to 100, then truncate. paged stays unset.
  • Paged mode (paginate = true)

  • Each task returns one batch, bounded by page_size and about 2 MiB serialized, plus an opaque next_page_token.

  • page_size is 0 (default 100) or 1 to 1000; page_token is at most 4096 bytes. Both are enforced by validate rules on the task, and the handler keeps its own clamp.
  • Contract (documented on the proto)

  • Every paged response sets paged = true: first, middle, last and empty batches.

  • A caller that requested paginate and gets paged == false is talking to an SDK that ignored the field, so the result may be truncated.

  • A non-empty next_page_token means keep going, even when list is empty.

  • Paging is complete only when the token is empty.

  • If the connector's schemas change between calls, entries can be skipped or repeated. Callers should dedupe by schema ID.
  • Cursor

  • Format: base64url(version byte, uvarint offset, connector token), with no escaping.

  • It can resume inside a connector page.

  • It stays valid when page_size changes between calls, because the handler never sends a page size to the connector.

  • It is capped at 4096 bytes, matching the next_page_token validation rule.
  • Testing
    New unit tests in pkg/tasks/c1api/list_ticket_schemas_test.go:

  • the legacy path with 0, 50, 100 and 250 schemas, byte-for-byte and with paged unset;

  • paged mode across connector and page sizes, including size changes mid-stream;

  • paged set on first, middle, last and empty batches;

  • validate rules on page_size and page_token, and the handler clamp for an unvalidated page_size;

  • oversized pages and the byte bound;

  • empty pages, and a mid-paging error followed by a retry;

  • the token cap with <>&-heavy connector tokens, and a golden token format;

  • invalid tokens and the non-retryable errors.
  • go test ./..., go test -race ./pkg/tasks/..., make chaos-check and buf lint/breaking pass locally.

    🤖 Generated with Claude Code

    Diff: 314 lines (+235 / -79) across 3 files Reviewer: ggreer Review duration: 5685m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 314 lines diff across 3 files
    0.40
    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%
    56%
    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.344
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1238"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 17.4% · Safe to merge
    17.4%