Manual · Engineering

Engineering record — internal detail. The manual is authoritative for product behaviour.

Engineering2026-08-015 min read

Inventory security & tenancy review

Tenant isolation, cache consistency, the role matrix and staged policy enforcement for the inventory module.

ForEngineer

Scope

A security and performance pass over inventory covering four concerns: tenant isolation, cache consistency, the role matrix and a staged enforcement script for row-level security on Neon. It documents how the authenticated context wrapper threads organisation context through the data layer, and how the staged SQL enables enforcement in a controlled order.

Key ideas

  • Organisation-scoped getters as the primary isolation mechanism after the RLS removal.
  • Cache keys must include the organisation id or a cross-org read becomes possible.
  • Pattern-based cache deletion on mutation rather than scattered single-key invalidation.
  • Staged enforcement so the policy script can be applied without a window of broken reads.

Source records

Design
docs/superpowers/specs/2026-08-01-inventory-security-review-design.md
Plan
docs/superpowers/plans/2026-08-01-inventory-security-review-plan.md