{
  "schema": "islx.unsupported-behavior-ledger/v2",
  "repositoryUrl": "https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template",
  "pinnedCommitSha": "c2d247dab0f13e852e7ed42a0eaf53bda5fbc449",
  "accountingCompleteness": "100%_MUTUALLY_EXCLUSIVE_THREE_BUCKET_RECONCILIATION_ZERO_DISCREPANCY",
  "summary": {
    "totalFiles": 20,
    "physicallyDeletedFilesCount": 16,
    "retainedNonDeletedFilesCount": 4,
    "totalLoc": 3967,
    "physicallyDeletedAndReplacedLoc": 2297,
    "physicallyDeletedAndReplacedPct": 57.9,
    "deletedActiveReplacedLogicLoc": 2172,
    "deletedInternalUiOrFloatSubNoteLoc": 125,
    "retainedSharedConstantsAndTypesLoc": 298,
    "retainedSharedConstantsAndTypesPct": 7.51,
    "unsupportedDisclosedLoc": 1372,
    "unsupportedDisclosedPct": 34.59,
    "reconciliationEquation": "2297 + 298 + 1372 = 3967",
    "discrepancyLoc": 0,
    "unaccountedLoc": 0,
    "retainedFilesBreakdown": [
      {
        "filePath": "src/lib/api-keys/api-keys.ts",
        "totalLoc": 433,
        "retainedSharedConstantsAndTypesLoc": 208,
        "unsupportedDisclosedLoc": 225
      },
      {
        "filePath": "src/lib/api/principal.ts",
        "totalLoc": 196,
        "retainedSharedConstantsAndTypesLoc": 65,
        "unsupportedDisclosedLoc": 131
      },
      {
        "filePath": "src/lib/billing/eu-withdrawal-refunds.ts",
        "totalLoc": 479,
        "retainedSharedConstantsAndTypesLoc": 25,
        "unsupportedDisclosedLoc": 454
      },
      {
        "filePath": "src/lib/billing/eu-withdrawal.ts",
        "totalLoc": 562,
        "retainedSharedConstantsAndTypesLoc": 0,
        "unsupportedDisclosedLoc": 562
      }
    ]
  },
  "files": [
    {
      "filePath": "src/lib/account/ban.ts",
      "sha256": "6b1f1451abe19bd232f2694f08dbcd833f96b280ea9ceb3e12b93b944f543343",
      "totalLoc": 28,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 28,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "credential-liveness",
      "functionsCovered": [
        "isBanned",
        "assertNotBanned"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/api-keys/liveness.ts",
      "sha256": "2ee268bc59ff8a6a538d322821aca990a97bfdab4d99c7b73c8d20a52aa6c2ce",
      "totalLoc": 35,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 35,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "credential-liveness",
      "functionsCovered": [
        "LIVE_API_KEY_SQL",
        "isLiveApiKey",
        "isDeadApiKey"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/api/scopes.ts",
      "sha256": "941c6cfc938cde6329f710cc86ef1f0cb4273d4fe542d62d878c863200f9f0cd",
      "totalLoc": 145,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 145,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "rbac-scope-guard",
      "functionsCovered": [
        "isApiScope",
        "isAccountOnlyScope",
        "scopesForAudience",
        "clampScopesForClient"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/api/admin-scopes.ts",
      "sha256": "ab6bf2a48884e8e25a183f4042ffd2fa1787d2a572dc8a4a947f388ffa717269",
      "totalLoc": 81,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 81,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "rbac-scope-guard",
      "functionsCovered": [
        "isAdminScope",
        "isGrantedScope",
        "toGrantedScopes",
        "clampAdminScopesForConsent"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/team-roles.ts",
      "sha256": "c62853ffe6cc5bb5c1219124652839648a975fa6a5b26e96efdba9a3b979f932",
      "totalLoc": 53,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 53,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "seat-admission-gate",
      "functionsCovered": [
        "SYSTEM_ROLES_ENUM",
        "TEAM_PERMISSIONS",
        "SYSTEM_ROLE_PERMISSIONS",
        "isTeamOwnerRole"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/plans.ts",
      "sha256": "e4e2e51c6188d336b8705255c0cfb802f0711370d125e8b1c1fc7314450ee850",
      "totalLoc": 118,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 118,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "yearly-plan-pricing",
      "functionsCovered": [
        "getPlan",
        "deriveYearlyAmount",
        "getPlanAmount"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/addons.ts",
      "sha256": "d95933e5f7ed0266d6bf250905758455152533adf51822ff157db05daec5de6e",
      "totalLoc": 108,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 108,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "yearly-plan-pricing",
      "functionsCovered": [
        "getAddon",
        "getAddonMaxQuantity",
        "getAddonAmount",
        "fromStoredAddonQuantities"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/limit-overrides.ts",
      "sha256": "7c857e1323dc8704b1c20919be80dd69c0677124ee180cb85cae544642fea8b1",
      "totalLoc": 35,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 35,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "entitlement-seat-limit",
      "functionsCovered": [
        "LIMIT_SOURCES",
        "TEAM_LIMIT_OVERRIDE_BOUNDS"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/subscription-lifecycle.ts",
      "sha256": "d2bef3c5296673e273112c9168805e645ee18a339fb4ebfc4d104d3196368c37",
      "totalLoc": 178,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 178,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "entitlement-seat-limit",
      "functionsCovered": [
        "STRIPE_SUBSCRIPTION_TRANSITION_POLICY",
        "getStripeSubscriptionTransitionPolicy",
        "mustPayOrCancel",
        "cancelParamsForStatus"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/constants/eu-withdrawal.ts",
      "sha256": "4f028875c5e1887ccf231c52422726e16c981e073f92678e31c0f4bf4bf963d0",
      "totalLoc": 65,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 65,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "eu-withdrawal-refund",
      "functionsCovered": [
        "WITHDRAWAL_PERIOD_DAYS",
        "WITHDRAWAL_ZONE_OFFSET_MS",
        "WITHDRAWAL_WINDOW_GRACE_MS",
        "WITHDRAWAL_REFUND_KINDS"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/schemas/limit-overrides.schema.ts",
      "sha256": "4035a7165d2f420d172303dca5bd6587be6d1e0d11f91647ded4f0e9441b142d",
      "totalLoc": 223,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 223,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 65,
      "mappedLawId": "entitlement-seat-limit",
      "functionsCovered": [
        "fromStoredLimitOverrides",
        "limitOverridesWithoutPaidAccess",
        "limitOverridesForCustomer",
        "toStoredLimitOverrides"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": [
        {
          "lines": "167-223 (deleted with file; omitted from Rust backend)",
          "symbols": [
            "setTeamLimitOverridesSchema",
            "limitOverridesFromForm",
            "limitOverridesToForm"
          ],
          "reasonCode": "DELETED_UI_ADMIN_FORM_STRING_COERCION_OMITTED_IN_RUST",
          "detail": "File is physically deleted (`223` LOC). Lines 1–166 (`158` LOC) are replaced in Rust/SQLite; lines 167–223 (`65` LOC) are client HTML form string-coercion helpers unneeded by the headless Rust backend."
        }
      ]
    },
    {
      "filePath": "src/utils/entitlements.ts",
      "sha256": "186f63e6cd9b8003807bc25f033bc6ee1eed94da75b04781ccd1a68cafce64b9",
      "totalLoc": 230,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 230,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "entitlement-seat-limit",
      "functionsCovered": [
        "getTeamEntitlements",
        "selectLimitSource",
        "isAddonIncreaseBlocked",
        "selectLimitOverridesReset",
        "isFreePlan"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/teams/team-seats.ts",
      "sha256": "08b01cea92b49982bab6bfc226d5bc7c22ecf232e86c945d8b441e906ab85c69",
      "totalLoc": 132,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 132,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "seat-limit-notice-structured",
      "functionsCovered": [
        "getTeamSeatUsage",
        "selectSeatLimitCopy",
        "selectPlanSeatRemedy"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/teams/team-writes.ts",
      "sha256": "71add269af400bcf964c88d85ffd845f712fbada9d8afa81bc419cae2a6fe906",
      "totalLoc": 345,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 345,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "seat-admission-gate + sqlite-bridge",
      "functionsCovered": [
        "isInvitationPending",
        "withinSeatCap",
        "withinJoinedTeamCap",
        "ACTIVE_MEMBERSHIP_PREDICATE",
        "PENDING_INVITATION_PREDICATE"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/billing/plan-card-action.ts",
      "sha256": "50c823a1650cf3c9429c49bdcede2c9a22b4e030daf44fb6f629ff2b121c9f6f",
      "totalLoc": 43,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 43,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "plan-card-action",
      "functionsCovered": [
        "selectPlanCardAction"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": []
    },
    {
      "filePath": "src/lib/billing/eu-withdrawal-selectors.ts",
      "sha256": "60a1f6276e56823428c76423699f2a6df472cab5cfb5047cb2d0dcda5b53d23f",
      "totalLoc": 478,
      "physicallyDeletedInStep3": true,
      "classification": "PHYSICALLY_DELETED_AND_REPLACED",
      "physicallyDeletedAndReplacedLoc": 478,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 0,
      "deletedInternalUiOrFloatSubNoteLoc": 60,
      "mappedLawId": "eu-withdrawal-refund",
      "functionsCovered": [
        "selectContractStart",
        "selectWithdrawalWindowEnd",
        "selectWithdrawalEligibility",
        "selectWithdrawalRefund",
        "selectInvoiceCreditable",
        "selectChainEnd"
      ],
      "retainedSharedItems": [],
      "unsupportedItems": [
        {
          "lines": "412-427 (deleted with file; normalized to integer math in Rust)",
          "symbols": [
            "usedShare (multi-line IEEE-754 float weighting)"
          ],
          "reasonCode": "IEEE754_FLOAT_RATIO_NORMALIZED_TO_EXACT_INTEGER",
          "detail": "File is physically deleted (`478` LOC). Symbolic ISLX/Rust law replaces single-period IEEE-754 float division with exact integer half-up proration `floor((amountPaid * usedDays + 15) / 30)`; multi-invoice array sorting/credit-note loops (`60` LOC) remain outside loop-free SMT."
        }
      ]
    },
    {
      "filePath": "src/lib/api-keys/api-keys.ts",
      "sha256": "e81290f0b378accf67f63f2d19905b4cee3b7606ae9407ea0c5eafa11ddfeecc",
      "totalLoc": 433,
      "physicallyDeletedInStep3": false,
      "classification": "RETAINED_SHARED_TYPES_PLUS_UNSUPPORTED_IO",
      "physicallyDeletedAndReplacedLoc": 0,
      "retainedSharedConstantsAndTypesLoc": 208,
      "unsupportedDisclosedLoc": 225,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "credential-liveness + rbac-scope-guard + sqlite-bridge",
      "functionsCovered": [
        "ApiKeySummary",
        "CreateApiKeyParams",
        "ESCALATION_DETAIL",
        "SUMMARY_COLUMNS",
        "toSummary",
        "isPublicApiKey"
      ],
      "retainedSharedItems": [
        {
          "lines": "1-98, 295-404 (208 LOC)",
          "symbols": [
            "ESCALATION_DETAIL",
            "ApiKeySummary",
            "CreateApiKeyParams",
            "SUMMARY_COLUMNS",
            "toSummary",
            "isPublicApiKey"
          ],
          "detail": "Retained shared TypeScript API-key summary interfaces, scope-filtering types (`isPublicApiKey`), and non-escalation constants referenced by non-deleted API/test callers; NOT counted as physically deleted LOC."
        }
      ],
      "unsupportedItems": [
        {
          "lines": "99-294, 405-433 (225 LOC)",
          "symbols": [
            "deleteApiKeyCache (Cloudflare KV)",
            "requireVerifiedEmail (cookie session)",
            "createRandomId (CSPRNG)",
            "Drizzle D1 relational queries"
          ],
          "reasonCode": "CLOUDFLARE_KV_CACHE_AND_CSPRNG_SIDE_EFFECTS",
          "detail": "Cloudflare Workers KV edge cache invalidation, cookie auth context, and WebCrypto CSPRNG secret generation are ambient host effects."
        }
      ]
    },
    {
      "filePath": "src/lib/api/principal.ts",
      "sha256": "3b690468b63e6613cfd65eda4ffcb8995b319556da997b5beb74a6470f63c6a3",
      "totalLoc": 196,
      "physicallyDeletedInStep3": false,
      "classification": "RETAINED_SHARED_TYPES_PLUS_UNSUPPORTED_IO",
      "physicallyDeletedAndReplacedLoc": 0,
      "retainedSharedConstantsAndTypesLoc": 65,
      "unsupportedDisclosedLoc": 131,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "rbac-scope-guard (audience & scope types)",
      "functionsCovered": [
        "ApiAudience",
        "PERSONAL_AUDIENCE",
        "ApiPrincipal",
        "toApiAudience",
        "isApiPrincipal"
      ],
      "retainedSharedItems": [
        {
          "lines": "18-82 (65 LOC)",
          "symbols": [
            "ApiAudience",
            "PERSONAL_AUDIENCE",
            "ApiKeyPrincipal",
            "OAuthGrantPrincipal",
            "ApiPrincipal",
            "toApiAudience",
            "isApiPrincipal"
          ],
          "detail": "Retained shared principal union types and pure audience shape guards; NOT counted as physically deleted LOC."
        }
      ],
      "unsupportedItems": [
        {
          "lines": "1-17, 83-196 (131 LOC)",
          "symbols": [
            "runWithPrincipal",
            "getBearerPrincipal (AsyncLocalStorage)"
          ],
          "reasonCode": "NODE_ASYNC_LOCAL_STORAGE_AMBIENT_CONTEXT",
          "detail": "Node.js `AsyncLocalStorage` implicit request-context propagation."
        }
      ]
    },
    {
      "filePath": "src/lib/billing/eu-withdrawal-refunds.ts",
      "sha256": "3839641e0e7f8c962e5a5afb1ee986ef30c16e1275698067dc2a310b9b866858",
      "totalLoc": 479,
      "physicallyDeletedInStep3": false,
      "classification": "RETAINED_SHARED_TYPES_PLUS_UNSUPPORTED_IO",
      "physicallyDeletedAndReplacedLoc": 0,
      "retainedSharedConstantsAndTypesLoc": 25,
      "unsupportedDisclosedLoc": 454,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": "eu-withdrawal-refund (consent extraCharges gate & FinishResult types)",
      "functionsCovered": [
        "WITHDRAWAL_CANCEL_COMMENT",
        "REFUNDABLE_PAYMENT_TYPES",
        "FinishResult",
        "computeRefund consent gate"
      ],
      "retainedSharedItems": [
        {
          "lines": "25-35, 88-101 (25 LOC)",
          "symbols": [
            "WITHDRAWAL_CANCEL_COMMENT",
            "REFUNDABLE_PAYMENT_TYPES",
            "FinishResult",
            "computeRefund consent gate"
          ],
          "detail": "Retained shared refund status types/constants and Art. 14(4) `consent ? extraCharges : 0` seam contract; NOT counted as physically deleted LOC."
        }
      ],
      "unsupportedItems": [
        {
          "lines": "1-24, 36-87, 102-479 (454 LOC)",
          "symbols": [
            "prepareRefunds",
            "issueWithdrawalRefunds",
            "listSubscriptionInvoices"
          ],
          "reasonCode": "ASYNC_EXTERNAL_STRIPE_CREDIT_NOTE_PAGINATION_RPC",
          "detail": "Async network pagination over Stripe invoices and credit-note creation."
        }
      ]
    },
    {
      "filePath": "src/lib/billing/eu-withdrawal.ts",
      "sha256": "a0b0baf70d32df4a6a235cd2722a6e5abf8d87bacdc9d826ede42a1888d6dae9",
      "totalLoc": 562,
      "physicallyDeletedInStep3": false,
      "classification": "UNSUPPORTED_REPORTED",
      "physicallyDeletedAndReplacedLoc": 0,
      "retainedSharedConstantsAndTypesLoc": 0,
      "unsupportedDisclosedLoc": 562,
      "deletedInternalUiOrFloatSubNoteLoc": 0,
      "mappedLawId": null,
      "functionsCovered": [],
      "retainedSharedItems": [],
      "unsupportedItems": [
        {
          "lines": "1-562 (562 LOC)",
          "symbols": [
            "getWithdrawalOffer",
            "withdrawFromSubscription",
            "resumeEuWithdrawal"
          ],
          "reasonCode": "EXTERNAL_NETWORK_STRIPE_SDK_REACT_CACHE_AND_QUEUE_IO",
          "detail": "Orchestrates live Stripe HTTP API calls, React `cache()`, OpenTelemetry `withSpan`, Cloudflare Queue retries, and transactional email delivery."
        }
      ]
    }
  ]
}
