Repository navigation
docs(readme): introduce Entity.aggregate, and fix stale schema and flag lines - #170
Conversation
…ag lines Both READMEs gain an "Aggregates" section: a short Subscription showing no update(), emit returning a sealed decision, and save(decision) for either persistence style, with the how-to linked. `Entity` stays the hero example, since an aggregate is built on it. Also fixes lines that predate today's changes: `updateInput` derives from `input` (#72), `output` is picked from by allowlist (#138), and the flag lists gain `identity` (#38) and `unbranded` (#73). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
It is a documentation-only change whose every claim and code example I verified as accurate and consistent against the current source.
Review effort: Balanced
Findings: None
What changed in this PR
This documentation-only PR adds an Aggregates section to both the root README.md and packages/entity/README.md (the npm-facing one), introducing Entity.aggregate with a Subscription example that shows the two-call declaration form, emit returning a sealed decision (events, expectedVersion), and persistence via save(decision). It also corrects stale lines in the schema-member and field-flag tables so they match the current API.
I verified the technical content against the source:
- The aggregate example matches
aggregate.ts(two-call form,events/opens/evolve,emit/start/replay,make(row, { version }),decision.events/decision.expectedVersion), and the unbrandedstatus: z.enum(...)field legitimately passes theOnlyNominalcheck (shape.ts). updateInputis indeed derived frominputminus immutable keys (entity.ts:144-147), so theoutput→inputcorrection is accurate.- The new
identityandunbrandedflags exist and the descriptions are correct —identityimpliesimmutable(field.ts:96). - The linked
how-to/model-an-event-driven-aggregatepage exists, and the two READMEs are mutually consistent.
Changes:
- Added an Aggregates section (identical prose in both READMEs) documenting
Entity.aggregate, decisions, and state-vs-event persistence. - Fixed stale schema-member lines:
outputis "pick a response by allowlist" andupdateInputderives frominput(notoutput). - Extended the field-flag documentation with
identityandunbranded, and added the "model an event-driven aggregate" how-to link.
| File | Description |
|---|---|
README.md |
Adds Aggregates section, corrects output/updateInput table rows, adds identity/unbranded flag rows, and links the new how-to. |
packages/entity/README.md |
Mirrors the same Aggregates section, updateInput-from-input fix, flag-list prose update, and how-to link for the npm-visible README. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
packages/entity, which is what npm shows) gain an Aggregates section: a shortSubscriptionshowing noupdate(),emitreturning a sealed decision (events,expectedVersion), andsave(decision)for state or event persistence. It links the how-to and says when to useEntityinstead.Entity(...)stays the hero example: an aggregate is built on it, and most models are entities.updateInputis derived frominput(No wire projection: nested entities break z.toJSONSchema, and undefined/null is bridged by hand at every boundary #72),outputis something you pick a response from by allowlist (Teach explicit public contracts instead of treating stored state as the default response body #138), and the flag lists gainidentity(Identity comparison alongside structural equals() #38) andunbranded(Branding requirement taxes leaf values, and the brands leak into consumers #73).No code change. No changeset.
🤖 Generated with Claude Code