{
  "schema_version": "1.3.0",
  "slug": "across-what-composite-tie-breaker-and-stable-cursor-gates-must-an-instance-merge-distributed-queries-to-prevent-pagination-drift-and-record-duplication",
  "title": "Across what composite-tie-breaker and stable-cursor gates must an instance merge distributed queries to prevent pagination drift and record duplication?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** An AI instance, autonomous coding agent, or backend service implements paginated lists, chronological feeds, audit log cursors, or distributed multi-shard query merge engines. * **Does not apply when:** Querying small st",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/across-what-composite-tie-breaker-and-stable-cursor-gates-must-an-instance-merge-distributed-queries-to-prevent-pagination-drift-and-record-duplication.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/across-what-composite-tie-breaker-and-stable-cursor-gates-must-an-instance-merge-distributed-queries-to-prevent-pagination-drift-and-record-duplication.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/across-what-composite-tie-breaker-and-stable-cursor-gates-must-an-instance-merge-distributed-queries-to-prevent-pagination-drift-and-record-duplication.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2798,
    "python_slice_tokens": 523,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Autonomous systems frequently query, paginate, and merge large datasets across distributed shards, read replicas, or multi-tenant database tables (such as chronological event feeds, audit logs, or task queues). A foundational data-integrity and query-correctness failure occurs when an instance sorts query results by a non-unique column alone (`ORDER BY creat...",
    "what_was_observed": "In chronological feed APIs, distributed log analyzers, and task queue paginators, instances operating without composite tie-breakers and stable cursor gates exhibit four primary failure modes: 1. **Tied-Timestamp Record Duplication Across Pages:** An audit log table has 50 entries sharing the exact millisecond `2026-10-18 10:00:00.123`. Page 1 fetches 20 items ordered by `created_at DESC`. While viewing Page 1, 5 new...",
    "condition_of_validity": "* **Applies when:** An AI instance, autonomous coding agent, or backend service implements paginated lists, chronological feeds, audit log cursors, or distributed multi-shard query merge engines. * **Does not apply when:** Querying small static reference tables (such as configuration tables with fewer than 500 rows) where random-access offset pagination has ...",
    "decision_boundary": "1. **Look at your SQL query `ORDER BY` clause: does it sort by a timestamp or status without a unique ID at the end?** Add your primary key (e.g., `, id DESC`) to the end of the sort clause in the exact same direction to eliminate non-deterministic tie shuffling. 2. **Are you using `OFFSET` and `LIMIT` for deep user pagination?** Switch to keyset cursor pagi...",
    "operational_effect": "1. **Deterministic Composite Tie-Breakers:** Across all generated queries and pagination handlers, the instance enforces compound sort clauses (`ORDER BY col DESC, id DESC`), eliminating non-deterministic tie shuffling. 2. **$O(1)$ Keyset Cursors:** Deep offset pagination is replaced by base64-encoded composite cursors and tuple range comparisons (`WHERE (co..."
  },
  "matched_failure_symptoms": [
    "PAGINATION_DRIFT_OR_INCOMPLETE_SCAN"
  ],
  "composition_edges": {
    "primary_domain": "schema_and_interface_version_drift",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/across-what-encoding-and-canonicalization-boundaries-must-an-instance-normalize-identifiers-and-paths-to-prevent-equivalence-collision-and-bypass.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/along-what-complexity-bounds-must-an-instance-arrest-premature-abstraction-and-speculative-over-engineering-when-synthesizing-solutions.md",
      "https://corpusfetch.com/c/across-what-deadline-propagation-and-cancellation-cascade-gates-must-an-instance-govern-grpc-and-http2-calls-to-prevent-zombie-worker-exhaustion-and-wasted-compute.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md",
      "https://corpusfetch.com/c/across-what-keyset-cursor-and-limit-ceiling-boundaries-must-an-instance-paginate-collection-queries-to-prevent-offset-scan-degradation-and-unbounded-result-oom.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "348b1705bb162331d5c54e801e985e78e8e5a7178e94883333777375c6889105",
    "verified_classes": [
      "KeysetPageResult",
      "KeysetPaginationEngine"
    ],
    "verified_functions": [
      "__init__",
      "_init_schema",
      "encode_cursor",
      "decode_cursor",
      "fetch_page",
      "verify_boundary_invariants"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ValueError"
    ],
    "sample_fail_closed_invariants": [
      "assert ts == '2026-10-20T12:00:00Z' and tie_id == 42",
      "Composite cursor round-trip invariant violated"
    ],
    "stdlib_dependencies": [
      "base64",
      "dataclasses",
      "json",
      "sqlite3",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
