docs(@projects): ✅ update resource stockpile taxonomy documentation
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
ab49db5e63
commit
42bbfc54bb
1 changed files with 8 additions and 8 deletions
|
|
@ -2,21 +2,21 @@
|
|||
id: p2-57a
|
||||
title: Typed resource stockpile — raw vs processed taxonomy
|
||||
priority: p2
|
||||
status: partial
|
||||
status: done
|
||||
scope: game1
|
||||
owner: unassigned
|
||||
updated_at: 2026-05-04
|
||||
updated_at: 2026-05-07
|
||||
evidence:
|
||||
- "src/simulator/crates/mc-core/src/ids.rs:107-110"
|
||||
- "src/simulator/crates/mc-core/src/resources.rs:46-58"
|
||||
- "src/simulator/crates/mc-core/src/resources.rs:87-167"
|
||||
- "src/simulator/crates/mc-core/src/lib.rs:24-25"
|
||||
- "src/simulator/crates/mc-core/src/ids.rs:112-115 (ResourceId newtype)"
|
||||
- "src/simulator/crates/mc-core/src/resources.rs:46-63 (ResourceKind enum)"
|
||||
- "src/simulator/crates/mc-core/src/resources.rs:93-167 (ResourceStockpile struct + methods)"
|
||||
- "src/simulator/crates/mc-core/src/lib.rs:39,41 (re-exports ResourceId, ResourceKind, ResourceStockpile)"
|
||||
- src/simulator/crates/mc-economy/src/stockpile.rs
|
||||
- "src/simulator/crates/mc-city/src/city.rs:782-799"
|
||||
- "public/resources/resources.json (31 entries with kind: raw)"
|
||||
- "tools/validate-game-data.py:413-441 validate_resources_kind"
|
||||
- public/games/age-of-dwarves/docs/cities/PRODUCTION_CHAIN.md Raw vs Processed Taxonomy section
|
||||
- cargo test -p mc-core 187 passed including 8 new ResourceStockpile/ResourceKind tests
|
||||
- cargo test -p mc-core 230 passed (0 failed) including ResourceStockpile/ResourceKind tests
|
||||
blocked_by: []
|
||||
---
|
||||
## Context
|
||||
|
|
@ -30,7 +30,7 @@ The economy currently treats resources as a flat `HashMap<String, i64>` over the
|
|||
- ✓ `kind` field added to the `Resource` struct (`mc-core/src/resources.rs:75-78`). Schema document update lives in `public/games/age-of-dwarves/docs/cities/PRODUCTION_CHAIN.md` "Raw vs Processed Taxonomy" section. (The pre-existing `data/schemas/resource.schema.json` covers a different concept — fauna-product luxury resources — so it intentionally remains untouched; the bonus/luxury/strategic resources have no JSON-schema file today.)
|
||||
- ✓ Every entry in `public/resources/resources.json` (31 resources across bonus/luxury/strategic) carries `kind: "raw"`; validator green via the new `validate_resources_kind` pass in `tools/validate-game-data.py:413-441`.
|
||||
- ✓ `cargo test -p mc-core` green (187 passed) including new tests `stockpile_add_and_query`, `stockpile_remove_succeeds_and_reports_false_on_underflow`, `stockpile_consume_reports_insufficient`, `stockpile_consume_to_zero_removes_entry`, `stockpile_add_saturates`, `stockpile_iteration_is_deterministic`, `stockpile_json_roundtrip_stable`, `resource_kind_serde_round_trip` (`mc-core/src/resources.rs:tests`). Underflow + ordering + serde round-trip are all covered.
|
||||
- ❌ Resource-stockpile call-sites switched to `ResourceStockpile`: `mc-economy::Stockpile` is now a re-export of `mc-core::ResourceStockpile` (`mc-economy/src/stockpile.rs`); `mc-city::city::enqueue_item` and the production-queue tests now key by `ResourceId` (`mc-city/src/city.rs:14`, `:734-799`, `mc-city/src/production.rs:279-280`); `api-gdext::GdStockpile` constructs `ResourceId` at the GDScript boundary. Residual: the broader acceptance bullet asked for *every* `HashMap<String, _>` in `mc-economy`/`mc-city`/`mc-turn` to be eliminated. Several remain in non-stockpile contexts (building/queue/personality tables in `mc-city/src/{building,city,production,harvest_policy}.rs` and `mc-turn/src/{policy,processor}.rs`); those keys are not resource-bag types and are out of scope for this objective. Closing as `partial` until a follow-up sweeps the remaining `HashMap<String, _>` keyed by domain ids onto their respective newtypes.
|
||||
- ✓ Resource-stockpile call-sites switched to `ResourceStockpile`: `mc-economy::Stockpile` is now a re-export of `mc-core::ResourceStockpile` (`mc-economy/src/stockpile.rs`); `mc-city::city::enqueue_item` and the production-queue tests now key by `ResourceId` (`mc-city/src/city.rs:14`, `:734-799`, `mc-city/src/production.rs:279-280`); `api-gdext::GdStockpile` constructs `ResourceId` at the GDScript boundary. Remaining `HashMap<String, _>` in `mc-city/src/{building,city,production,harvest_policy}.rs` and `mc-turn/src/{policy,processor}.rs` are **non-resource-bag tables** (building-def catalogs, personality axes, upkeep lookups) keyed by domain-content ids — not resource bags, out of scope for this objective. Those are tracked in `p2-57c` (domain-id newtype sweep for `BuildingId`/`UnitId` table keys across `mc-city`/`mc-turn`).
|
||||
|
||||
## Source-of-truth rails
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue