Package 

Class TraitGovernor


  • 
    public final class TraitGovernor
    
                        

    TraitGovernor — client-side guards for trait writes. Parity port of libs/web-sdk/src/governance/trait-governor.ts (web SDK ≥1.11.0).

    Runs the same 5 ingestion guards the cell-plane backend enforces in data_governance.ingestion_guards.GuardResult, so the SDK can warn developers about problematic keys/values BEFORE the network write.

    Verdict codes here MUST match data_governance.ingestion_guards.GuardResult.verdict + the ingestion_dlq.verdict DB CHECK + the FE IngestionDLQVerdict union. Four-surface drift protection. Source-of-truth fixture: libs/mobile-sdk/tests/drift/trait-governor-verdicts.json.

    Warning emission is rate-limited to first 3 per (workspace_id, verdict) per session — so a render loop doesn't spam Logcat.

    • Constructor Detail

      • TraitGovernor

        TraitGovernor()
    • Method Detail

      • process

         final TraitGovernor.Result process(Map<String, Object> traits, String workspaceId)

        Apply all guards to a traits map. Returns the sanitised payload to send + a list of drops/modifications.

        Parameters:
        workspaceId - Scope warnings per-workspace so an agency user switching brands doesn't have their warning budget burned cross-workspace.