{
  "schema_version": "1.3.0",
  "slug": "how-must-an-instance-pin-collation-to-prevent-cross-host-sort-divergence",
  "title": "How must an instance pin collation to prevent cross-host sort divergence?",
  "date_of_record": "2026 November 2",
  "scope": "Applies to string comparisons and sorts that use locale-dependent collation (ICU default, strcoll, database default) across hosts that may differ in locale, ICU version, or collation table. Does not apply to binary comparison or sorts pinned to a named, versioned collation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-must-an-instance-pin-collation-to-prevent-cross-host-sort-divergence.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-must-an-instance-pin-collation-to-prevent-cross-host-sort-divergence.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-must-an-instance-pin-collation-to-prevent-cross-host-sort-divergence.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 832,
    "python_slice_tokens": 110,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Two string sorts produce the same order only if they use the same collation identifier *and* the same version of the collation table. Locale name alone is insufficient; ICU and glibc produce different orders for the same locale name across versions, and library upgrades change which table is active. **Invariant.** Order is reproducible across hosts if and on...",
    "what_was_observed": "**Signature.** Pagination or range scans returning different rows on different replicas. Search results ordered differently across regions. Rows appearing in one host's results and not another's for the same range query. **Trace.** A `BETWEEN 'a' AND 'm'` query relies on collation order. Under one ICU version \"æ\" sorts after \"a\"; under another it sorts after \"z\". A row whose name begins with \"æ\" is included on one re...",
    "condition_of_validity": "The instance must ensure at least one holds before it relies on a sort being reproducible: 1. **Must use binary collation.** Comparison is byte-wise, so order is a function of encoding only. 2. **Must pin version.** A named, versioned collation is used and its version is fixed across hosts and upgrades. 3. **Must sort at one layer.** Sort happens in a single...",
    "decision_boundary": "- Binary collation on both hosts: identical order. - Versioned pinned collation: identical as long as upgrades are coordinated. - Locale name only, no version: divergence is possible on any library upgrade. - Client-side single-collation sort: identical by construction, at the cost of data movement.",
    "operational_effect": "The defect grows slowly as libraries upgrade on independent schedules, then surfaces all at once when two hosts are compared. Remediation is binary collation for keys used in filters, or version-pinned collation with coordinated upgrades. The trap is to declare a locale like \"en_US\" and assume it is stable. It is a name that maps to a changing implementation..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "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"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "88d5aa48166c2613568bcaf713831c69446def6363b753e5f2c775d3b6dd17c2",
    "verified_classes": [
      "LocaleSortError",
      "CollationGate"
    ],
    "verified_functions": [
      "dispatch_collation",
      "verify"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "LocaleSortError"
    ],
    "sample_fail_closed_invariants": [
      "locale-name collation without pinned version: order varies across library upgrades"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
