web/docs/design/CODEX-EQUIPMENT-METADATA.md

30 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Codex equipment metadata
17 November 2026: storage preparation only.
The additive `codex_equipment_metadata` table stores equipment metadata by unique
Codex instance ID. It is independent of the consumable ledger so future persistent
equipment does not inherit one-time consumption semantics. The CP startup creates
the table idempotently; no existing kit, key, inventory or deed is migrated.
| Database field | Contract |
| --- | --- |
| `instance_id` | Unique Codex instance UUID; primary key |
| `equipment_mark` | Integer 1–14; default 1 (MK I) |
| `rarity` | Existing common/uncommon/rare/very_rare/legendary identifiers; default common |
| `enhancement_policy_version` | Nullable policy reference, up to 64 characters; null means none assigned |
Legacy equipment without a metadata row reads as MK I and retains its authoritative
native rarity through `nativeRarity`; it is not automatically reclassified Common.
Record creation is internal and insert-only. A domain adapter must verify the
instance and authority, supply its existing rarity and use the issuance transaction.
There is no public writer and no item is granted by creating a metadata row.
No multipliers, enchantment scaling, Legendary-policy changes, kit-generator
changes, Bukkit/PDC writes or game effects are enabled. The future equipment engine
must resolve a recorded policy version, enforce caps and prevent double counting.
The existing kits and organisation keys continue using their current handlers.
Tests persist all 70 Mark/rarity combinations, retain legacy Legendary rarity,
reject invalid values, enforce database bounds/native rarity constraints, and
verify restart, duplicate registration and transactional rollback behaviour.