Skip to content

ADR-189 + ADR-190 (v1.2.0): entity default-trait registry & natural-language list rendering#168

Merged
ChicagoDave merged 7 commits into
mainfrom
feature/adr-189-entity-default-traits
Jun 25, 2026
Merged

ADR-189 + ADR-190 (v1.2.0): entity default-trait registry & natural-language list rendering#168
ChicagoDave merged 7 commits into
mainfrom
feature/adr-189-entity-default-traits

Conversation

@ChicagoDave

Copy link
Copy Markdown
Owner

Summary

Consolidates everything since the last push to main: two accepted platform ADRs (published as 1.2.0) plus the book copy-edit integration that had been committed locally on main but never pushed.

Platform — ADR-189: entity-type default-trait registry

  • WorldModel.createEntity(name, type, { defaultTraits? }) consults a DEFAULT_TRAITS registry (SCENERY → SceneryTrait only); other types deferred.
  • IFEntity.add() changed to silent replace-on-same-type (last add wins), so a configured trait supersedes a default. 4 existing tests that asserted the old first-wins/warn behavior were flipped.
  • AC-1…AC-7 as tests (world-model + a stdlib taking AC-2). A SCENERY entity is non-takeable by construction.

Platform — ADR-190: natural-language list rendering (the ID→language "proof")

  • list formatter rewritten over EntityInfo[]: per-element articles (a/an/some/none), grouping identical common nouns into pluralized counts ("two goats"), commas + Oxford "and" (author-configurable, default on). Added the-list and names.
  • count formatter fixed (closes countFormatter returns hardcoded "items" noun for count > 1 #166) — real pluralized noun, spelled-out counts (1–10).
  • Placeholder-order docs corrected to {list:items} (closes Formatter docs/examples show {items:list} but parser requires {list:items} (placeholder last) #167) across source comments and book ch19; ch19's Lists section is now the real showcase.
  • EntityInfo.plural + IdentityTrait.plural (round-trips save/restore) + entityInfoFrom populates it; looking/going/switching_on migrated to pass EntityInfo[] (ADR-158 fix).
  • All 14 ADR-190 acceptance criteria satisfied; AC-9 end-to-end: "You can see a goat, two rabbits, and a parrot here."

Versions (published to npm)

@sharpee/world-model, @sharpee/lang-en-us, @sharpee/stdlib1.2.0.

Book copy-edit integration (riding along; was local-only on main)

  • Clarity-pass edits integrated (24 across 19 chapters); em-dash integration for ch01–04 with full-paragraph review docs; 31 chapter colon-subtitles; "About This Book" colophon.

Tests

world-model suite green (1292); lang-en-us green (243+); stdlib taking/entity-info/producers green. Every AC has a named passing test.

Follow-ups (not in this PR)

  • The plain-{items} container/surface contents path (looking.ts:129 pre-joins) needs a template→{list:items} change + entity threading to also render articles.
  • Book em-dash chapter integration (ch05–31) continues separately.
  • dungeo walkthrough transcripts will need updating for the new article-rendered room-contents output (handled in the build/publish pass).

Closes #166, closes #167.

🤖 Generated with Claude Code

ChicagoDave and others added 7 commits June 24, 2026 14:11
…ers)

Replace hand-wavy filler phrases and "restates-next" paragraph leads with
concrete prose; remove em-dashes from edited passages. clarity-ch08.md flag
marked REJECTED (David kept original wording).

Co-Authored-By: Claude <noreply@anthropic.com>
… accept ADR-189 (entity default-trait registry)

- Integrate em-dash edits into ch01–04 (part-1 and part-2/04)
- Apply full-paragraph em-dash pass across all 31 chapters (parts 2–8 modified)
- Add 23 emdash-ch*.md full-paragraph review docs to gpt-review/
- Delete 63 spent clarity-ch* and edits-ch* review docs (recoverable from git history)
- Accept ADR-189: entity-type default-traits registry

Co-Authored-By: Claude <noreply@anthropic.com>
…add() replace-on-same-type

Implements Phase 1 of ADR-189 (entity default traits):
- `add()` on IFEntity now silently replaces an existing trait of the same
  type rather than warning and keeping the original (first-wins → replace-on-same-type)
- New `DefaultTraitRegistry` wired into `WorldModel.createEntity()` opts;
  SCENERY entity type auto-applies SceneryTrait via the registry
- Tests: world/default-traits.test.ts covers AC-1,3,4,5,6; if-entity.test.ts
  covers AC-7; identity/container/exit trait tests updated for new replace semantics;
  stdlib taking-golden.test.ts covers AC-2
- `docs/reference/core-concepts.md` updated to document the registry

Also riding along: the ADR-189 planning doc
(`docs/work/adr-189-entity-defaults/`) and a new PROPOSED ADR-190
(natural-language list rendering) draft.

All tests pass — world-model 1290 passed, stdlib taking-golden 25 passed.

Co-Authored-By: Claude <noreply@anthropic.com>
…guage list renderer

Phase 1 (foundations): extract pluralize.ts and number-words.ts as free
functions; language-provider delegates pluralize, adds serialComma toggle and
injects settings into formatter context; EntityInfo.plural field flows from
identityTrait through entityInfoFrom; countFormatter bug fixed (GH #166).

Phase 2 (list renderer): list formatter rewritten with per-element articles,
grouping/pluralization, Oxford-comma toggle, and bare-string safety; new
the-list and names formatters registered; AC-1..AC-8, AC-11, AC-12, AC-13
covered by list-formatter.test.ts.

ADR-190 updated to ACCEPTED with resolved decisions and implementation plan.

Co-Authored-By: Claude <noreply@anthropic.com>
…nfoFrom + AC-9 showcase

Phase 3: migrate {list:items} producers in looking-data, going, and switching_on
to pass entityInfoFrom(e)[] instead of bare names, enabling article + grouping
rendering per ADR-158/ADR-190. Corrects adjacent comments from {items:list} to
{list:items}.

Phase 4: add ac9-showcase.test.ts in lang-en-us exercising the full LanguageProvider
pipeline end-to-end — "You can see a goat, a rabbit, and a parrot here." and the
grouped "two rabbits" variant. All stdlib action tests (looking/going/switching_on,
67 passed) and AC-9 green.

Co-Authored-By: Claude <noreply@anthropic.com>
…en-us/stdlib to 1.2.0

Corrects backwards {items:list}→{list:items} formatter examples in lang-en-us
source comments (formatters/index.ts, types.ts, registry.ts, language-provider.ts)
and rewrites book ch19's Lists section into a real API showcase. Bumps
world-model, lang-en-us, and stdlib to 1.2.0 for the ADR-189/190 milestone.

Co-Authored-By: Claude <noreply@anthropic.com>
@ChicagoDave ChicagoDave merged commit c17f60b into main Jun 25, 2026
1 check failed
@ChicagoDave ChicagoDave deleted the feature/adr-189-entity-default-traits branch June 25, 2026 00:29
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

ChicagoDave added a commit that referenced this pull request Jun 25, 2026
…cenery alignment

Adds a Continuation section covering PR #168/#169 merges, the 1.2.0→1.1.x
version correction, the scenery alignment refactor, the familyzoo test story
work, and issues #166/#167/#170.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant