βš™οΈ System Settings

Admin-only configuration. Changes take effect immediately.

Formula / Procedure Editor PIN Admin Only

The editor PIN is stored server-side in the Vercel environment variable PROCEDURE_EDIT_PIN. There is no hardcoded fallback and no client-side storage. To rotate the PIN, update the env var in Vercel β€” a redeploy is automatic.

When editing a formula or procedure, the editor prompts you for the PIN. The PIN is sent as an X-Procedure-Pin header and verified server-side. After 5 wrong attempts in 15 minutes, the user is rate-limited.

Who can edit: only users with role admin or manager, and with the correct PIN.

πŸ”‘ Reveal current PIN

For your eyes only. Every reveal is logged with your email, timestamp, IP, and browser. Close this panel when you're done.

πŸ“ Legacy Formula Reference

Original formula factors from v1 (pre-clean-model). For reference only β€” active formulas are managed in the Formula Editor.

Salt Base
MaterialFactorBaseUnit
Sodium Carbonate0.3Active MITg
Water for Sod. Carb.1.42Active MITml
Freebase
MaterialFactorBaseUnit
Sodium Carbonate0.03Active MITg
Water for Sod. Carb.0.1714Active MITml
Common (Both Formulas)
MaterialFactorBaseUnit
THF14Powder Weightml
Sat. Sodium Bicarb 16Powder Weightml
Oxone (total)0.72Active MITg
Water for Oxone3.43Active MITml
Sodium Bicarbonate 20.281Active MITg
Sodium Bicarbonate 31.25Active MITg
STP0.39Active MITg
THF 22FixedL
EAC 2/33FixedL
Brine 32FixedL

πŸ”Ž Batch Step Diagnostics Admin Only

Shows the actual DB state for a batch β€” what procedure_steps look like now vs what batch_steps are linked to. Paste a Batch ID to diagnose wrong instructions or ingredient mismatches.

🔧 Procedure Step Repair Admin Only

Fixes corrupted procedure_steps caused by the 0-based vs 1-based step_order mismatch bug. This renumbers step_orders to 1-based sequential and re-links any orphaned batch_steps. Run Diagnose first to confirm which procedure is broken, then use this to fix it.

⚠️ This will UPDATE procedure_steps content in the database.

πŸ—„οΈ Database Migrations Admin Only

Run pending schema migrations. Each migration is idempotent (safe to run multiple times). Run 014 first to add the ingredient_id column to batch_steps β€” this fixes the missing THF/ingredient issue permanently for new batches.

πŸ”§ Batch Step Repair Admin Only

Re-links batch_steps to the correct procedure_step rows. Use this if batch execution shows wrong instructions, ingredients, or missing fields after a procedure was re-saved (step_order shift). Dry-run first to preview changes.