{
  "description": "S1: an empty or whitespace-only LAYER unitKey override is INVALID. The layer is SKIPPED (bucket -1, no policy match, parameter defaults served, no exposure). The SDK MUST NOT fall back to the project-level hashing.unitKey for that layer, MUST NOT crash, and MUST NOT reject the bundle. Other layers resolve normally. HAND-AUTHORED to the decided 0.7.0 semantics: the reference JS engine (js-sdk/packages/core resolution/engine.ts) currently treats an empty-string override as falsy and falls back to the project key (and buckets the whitespace override on a context field literally named '   '); that is the 1-of-4 outlier and is aligned in Phase 2. NOT regenerated by scripts/generate-fixtures.ts.",
  "bundle": "bundle_empty_unit_key.json",
  "testCases": [
    {
      "name": "empty_and_whitespace_overrides_skipped",
      "comment": "userId=user-abc resolves the normal user layer (bucket 641 -> dark_mode). layer_empty_override (unitKey '') and layer_ws_override (unitKey '   ') are both invalid overrides -> skipped, bucket -1, promo params stay at their defaults. The context deliberately includes a field literally named '   ' with a value to prove the whitespace override is rejected as invalid rather than used as a lookup key.",
      "context": {
        "userId": "user-abc",
        "   ": "sneaky-value"
      },
      "expectedHashing": {
        "layer_user_ui": {
          "unitKeyValue": "user-abc",
          "bucket": 641,
          "comment": "SHA-256 v2 hash of 'user-abc:layer_user_ui' mod 1000"
        },
        "layer_empty_override": {
          "bucket": -1,
          "comment": "unitKey '' is invalid -> skipped. Decided semantics: NOT a fallback to userId (which would bucket 451 -> banner_off). JS is wrong here; aligned in Phase 2."
        },
        "layer_ws_override": {
          "bucket": -1,
          "comment": "unitKey '   ' is invalid -> skipped. Decided semantics: NOT a lookup of the '   ' context field (which JS would bucket as 267 -> banner_off). JS is wrong here; aligned in Phase 2."
        }
      },
      "expectedAssignments": {
        "ui.theme": "dark",
        "promo.emptyBanner": false,
        "promo.wsBanner": false
      },
      "expectedLayers": [
        {
          "layerId": "layer_user_ui",
          "bucket": 641,
          "policyId": "policy_ui_theme",
          "allocationName": "dark_mode",
          "comment": "Resolves normally on the project unit key (userId)."
        },
        {
          "layerId": "layer_empty_override",
          "bucket": -1,
          "comment": "Skipped: empty unitKey override is invalid. No policyId/allocationName -> no exposure for this layer."
        },
        {
          "layerId": "layer_ws_override",
          "bucket": -1,
          "comment": "Skipped: whitespace-only unitKey override is invalid. No policyId/allocationName -> no exposure for this layer."
        }
      ]
    }
  ]
}
