4.3 KiB
Code review — NEO-52 item definition registry + DI
Date: 2026-05-23
Scope: Branch NEO-52-item-definition-registry-di · commits 1e9f1e9–792b38d vs origin/main
Base: origin/main
Verdict
Approve with nits
Summary
NEO-52 adds IItemDefinitionRegistry and ItemDefinitionRegistry as a thin adapter over the NEO-51 ItemDefinitionCatalog, registers both in AddItemDefinitionCatalog, and ships six AAA unit tests plus a host DI smoke test mirroring SkillDefinitionRegistry (NEO-35). Kickoff decisions (TryGetDefinition, GetDefinitionsInIdOrder, no extra eager resolve in Program.cs, no re-validation) are implemented as specified. Risk is low: no HTTP, persistence, or gameplay callers yet; enumeration allocates per call at prototype scale (same as skills). Tests pass locally.
Documentation checked
| Document | Result |
|---|---|
docs/plans/NEO-52-implementation-plan.md |
Matches — interface surface, adapter, DI, README, alignment table, test matrix; acceptance checklist complete. |
docs/decomposition/modules/E3_M3_ItemizationAndInventorySchema.md |
Matches — frozen roster, NEO-51 server load, and NEO-52 registry bullet under Related implementation slices. |
docs/decomposition/modules/documentation_and_implementation_alignment.md |
Matches — E3.M3 row notes NEO-52 landed with plan link. |
docs/decomposition/modules/module_dependency_register.md |
Matches — E3.M3 In Progress; footnote names NEO-50/NEO-51/NEO-52. |
docs/decomposition/modules/client_server_authority.md |
N/A — read-only definition registry; no client trust boundary change. |
server/README.md |
Matches — item catalog section points game code at IItemDefinitionRegistry. |
Register/tracking: E3.M3 row update in alignment doc is appropriate; no module Status promotion required until HTTP/inventory slices land.
Blocking issues
None.
Suggestions
-
E3.M3 module page — NEO-52 registry — Under Related implementation slices, add a short bullet parallel to Server load (NEO-51) documentingDone. — bullet added toIItemDefinitionRegistryinGame/Items/and that NEO-53+ / inventory callers should inject the interface (link NEO-52 plan). Readers who open the module doc before the alignment register will otherwise only see catalog load.E3_M3_ItemizationAndInventorySchema.md. -
Dependency register footnote (optional) — Extend the E3.M3 note inDone.module_dependency_register.mdto mention NEO-52 alongside NEO-50/NEO-51 so the register matches the alignment table.
Nits
-
Nit:
Host_ShouldResolveRegistryFromDi_WhenStartupSucceedsplacesTryGetDefinitionin Act (metadata assertions in Assert). Same pattern asSkillDefinitionRegistryTests; strictly, onlyGetRequiredService<IItemDefinitionRegistry>()belongs in Act — optional tidy for both registries later, not blocking. -
Nit:
GetDefinitionsInIdOrderrebuilds a sorted list on every call (keys sort + list materialization). Acceptable for six prototype rows and consistent withSkillDefinitionRegistry; revisit only if callers poll in hot paths. -
Nit:
ItemDefinitionRegistry.TryGetDefinitionduplicatesItemDefinitionCatalog.ByIdlookup rather than delegating toTryGetItem— intentional per plan (game surface vs catalog helper);TryGetItemdoes not guardnullids while the registry does (good for public API).
Verification
cd server
dotnet test NeonSprawl.Server.Tests/NeonSprawl.Server.Tests.csproj --filter "FullyQualifiedName~ItemDefinitionRegistryTests"
dotnet test NeonSprawl.Server.Tests/NeonSprawl.Server.Tests.csproj
Manual QA: not required for this story (no user-visible API); NEO-53 will exercise enumeration via HTTP.