Skip to main content

Patterns

Sandbox → production rollout with feature flag

Transitional dual-write and progressive switchover

Switchover from sandbox to production while limiting risk of double-billing or accounting divergence. Pattern: (1) during internal testing, app only calls `sk_test_*`; (2) pre-rollout, enable a `scell.dual_write=true` feature flag sending each invoice to BOTH environments and comparing responses (same number, same amounts, same status). Any divergence is logged, not blocking; (3) after 1-2 weeks of dual-write without divergence, switch flag to `scell.target=prod` and disable sandbox writes on accounting flows. In code, wrap in a `ScellClient` taking runtime config (LaunchDarkly, Unleash, PG feature_flags table). Never switch to production without a tested kill-switch (inverse flag). This is also the pattern mandated by French tax authorities for the LF 2026 transition: emitters in dual-write with PPF before final switch to PDP.

Key facts

  • Phase 1: sandbox only (sk_test_*)
  • Phase 2: dual-write 1-2 weeks with automatic comparison
  • Phase 3: switch to prod (sk_live_*) with tested kill-switch
  • Runtime feature flag: LaunchDarkly, Unleash or PG table
  • Pattern aligned with LF 2026 PPF → PDP transition

Code example

class ScellClient {
  constructor(private flags: FeatureFlags) {}

  async createInvoice(payload: InvoiceCreate): Promise<Invoice> {
    const target = this.flags.get('scell.target', 'sandbox');
    if (this.flags.get('scell.dual_write', false)) {
      const [prod, sandbox] = await Promise.allSettled([
        this.call('live', payload),
        this.call('test', payload),
      ]);
      this.compareAndLog(prod, sandbox);
      return target === 'prod' ? unwrap(prod) : unwrap(sandbox);
    }
    return this.call(target === 'prod' ? 'live' : 'test', payload);
  }
}

See also

Your cookie preferences

We use cookies to improve your experience. Essential cookies are always active. Cookie policy.