TenantShell

Country Packs Utility

Seed, debug, fix, apply VAT patches, and verify safeguards

1. Seed Verified Packs

Upsert CountryPack and CountryPackVersion records for KE, GH, AE, CA, US, EU with verified tax rates. All versions set to "draft" status.

2. Debug Dump

Print exactly what's stored in CountryPack and CountryPackVersion tables with tenant scoping checks.

3. Fix Tenant Scoping

Set tenantId = null for all country packs (KE, GH, AE, CA, US, EU, UK, NG) to make them global.

4. Apply VAT Patches

Apply NG 1.0.2 (cash-basis + VAT withheld boxW) and GH 1.0.1 (last working day deadline rule). Creates draft versions for review.

5. Verify Safeguards

Verify that all safeguards are in place: immutable snapshots (appliedPayload), no auto-apply, functions exist, audit logging ready.

Quick Actions

Workflow:

  1. Click "Run Seed" to upsert KE, GH, AE, CA, US, EU packs with verified rates (status=draft)
  2. Click "Run Debug" to see what's stored and check for scoping issues
  3. If scopingIssues.hasIssues = true, click "Fix Scoping" to set tenantId = null (make global)
  4. Click "Apply VAT Patches" to create NG 1.0.2 (cash-basis + boxW) and GH 1.0.1 (last working day)
  5. Click "Verify Safeguards" to ensure immutable snapshots and upgrade functions are in place
  6. If snapshots missing, click "Run Migration Now" to populate appliedPayload for all tenants
  7. Go to AdminPacks page, use "Drafts" filter to see all draft packs, then "Publish" them

Safeguard Model:

  • Immutable Snapshot: TenantCountryPack.appliedPayload never changes except on manual upgrade
  • Overrides Preserved: TenantCountryOverride survives all upgrades
  • Effective = Base + Overlay: Runtime merges applied + overrides
  • No Auto-Apply: Publishing never auto-applies to tenants
  • Manual Preview → Apply: Users preview diff, then explicitly apply