ADR-00037 — DRAFT/PUBLISHED/ARCHIVED Lifecycle for Admin-Maintained Master Data

By Engineering Team•October 9, 2026•5 min read
  • Status: Approved / Implemented
  • Date: 2026-10-09
  • Authors: Engineering Team

Context

BRD-021 (Warehouse Master) and BRD-022 (Package Master) both commit to the same shape of business need: an administrator must be able to start creating a record, leave it incomplete or incorrect while still working on it, and only have it count as “available for real use” once they’ve explicitly said so — and once a record has ever been available for use, or has since been taken out of use, it must never be permanently deleted. inventory-service’s warehouse and package_master tables each implement this with the identical three-state lifecycle (DRAFT → PUBLISHED → ARCHIVED) and identical transition rules. This ADR records that decision once, for both features, rather than as two separate near-duplicate ADRs.


Decision Drivers (FRs & NFRs)

  • SR-022 / SR-023’s lifecycle FRs: a record must be creatable and editable before it’s usable, publishable only once ready, and archivable without being deleted.
  • BRD-021 BR-02/BR-03, BRD-022 BR-02/BR-03: an incomplete record must never silently affect live fulfillment or product setup, and a record already relied upon must never be lost.

Options Evaluated

Option 1 — Explicit three-state lifecycle: DRAFT → PUBLISHED → ARCHIVED (CHOSEN)

A status column takes one of three values. DELETE is only permitted while a record is DRAFT; PUBLISHED is reachable from DRAFT or ARCHIVED; ARCHIVED is reachable only from PUBLISHED.

  • Pros:
    • A record can be prepared without being usable. Nothing downstream (stock-ledger warehouse resolution, product-catalog package-mapping) needs to special-case “is this record actually finished” — it simply never sees a DRAFT record, because every consuming query filters to PUBLISHED.
    • Hard-delete is only ever possible before a record could have been referenced by anything else. Because DRAFT is the only deletable state, and nothing outside the admin console itself can reference a DRAFT record, deleting one can never orphan a foreign reference — the lifecycle makes the unsafe case structurally unreachable rather than relying on a delete-time check across every possible referencing table.
    • Un-publishing and re-publishing both have a real, distinct meaning. ARCHIVED isn’t “deleted” and isn’t “still live” — it’s “exists, has history, is intentionally not currently available,” which is exactly the state a retired warehouse or a discontinued packaging type needs, and PUBLISHED being reachable from ARCHIVED means a retired record can be brought back without re-creating it and losing its identity.
  • Cons & Accepted Trade-offs:
    • Three states is more ceremony than a single boolean for what might look, at a glance, like a simple “is this active” question. Accepted because the actual business need isn’t one boolean — it’s two independent questions (“is this ready yet” and “is this still in use”), and collapsing them into one flag would make “ready but temporarily not in use” and “not ready yet” indistinguishable.

Option 2 — A single active: boolean flag, hard-delete always permitted (NOT CHOSEN)

  • Cons (Why Rejected):
    • Can’t distinguish “still being set up” from “deliberately taken out of use.” Both would have to be active: false, so a consuming query would have no way to tell an in-progress draft apart from a genuinely retired record without a second flag anyway — at which point this option has quietly become Option 1 with worse names.
    • Allowing delete at any time reopens exactly the orphaned-reference risk Option 1 closes. A record already referenced by a stock balance or a product’s package mapping could be deleted, leaving that reference pointing at nothing — this would need a delete-time existence check across every referencing table, repeated at every call site, instead of being structurally prevented by the lifecycle itself.

Option 3 — A separate, bespoke lifecycle per feature (NOT CHOSEN)

Let Warehouse Master and Package Master each define their own states and transition rules, independently.

  • Cons (Why Rejected):
    • The two features have the identical underlying need — prepare, then publish, then optionally retire, never hard-delete past draft — and nothing about either domain’s specifics (a warehouse’s address vs. a package’s dimensions) changes what the lifecycle itself needs to guarantee. A second, independently-designed lifecycle would be pure duplication with no corresponding benefit, and would risk the two drifting into subtly different transition rules over time for no business reason.

Final Decision

Both Warehouse Master and Package Master use the identical DRAFT → PUBLISHED → ARCHIVED lifecycle (Option 1): delete is permitted only from DRAFT; publish is reachable from DRAFT or ARCHIVED; archive is reachable only from PUBLISHED. This is recorded as one shared decision rather than two, since both features have the same underlying business need and no domain-specific reason to diverge. A future admin-maintained master-data feature with the same “prepare, then publish, then optionally retire, never hard-delete past draft” need should reuse this same lifecycle shape rather than inventing a new one.