Repository navigation
feat(plugin-gateway): add category.children and answer.voters managers - #222
Conversation
Add CategoryChannelChildManager (cache, create with the category as parent, resolve) behind CategoryChannel#children, and PollAnswerVoterManager (fetch) behind PollAnswer#voters, after discord.js. children.cache is read from the channel store, so it stays in step with client.channels. Refs #216
|
Nothing flagged · reviewed Architecture Inside the changed components — 2 viewsComponent view — Category children Internal components managing category child channels, cache enumeration, and channel creation. Component view — Poll answer voters Internal components handling poll answer voter fetching, Discord REST queries, and user caching. Data flow The other flows — 1 sequence
View
Tip Add 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: the full diff of the single commit, checked against the existing ChannelManager/CachedManager cache helpers.
CategoryChannelChildManager: aBaseManagerwhosecacheis derived from the raw channel store on each read, pluscreate,resolve,resolveId,valueOfandguild.ChannelManager#_inCategory: an internal enumeration that follows the sameiterableCache()+guard("entries")+whenAllpattern as_countInGuild, so it stays synchronous with a synchronous cache and throwsCacheNotIterablefor a non-enumerable store.PollAnswerVoterManager: delegatesfetchtoMessageManager#fetchPollAnswerVoters;PollAnswer#fetchVotersnow routes through it.CategoryChildCategoryerror:createrejects a category type before any request, and the options type omitsparentand the category type.- Tests, changeset and spec: runtime tests across synchronous, default and asynchronous caches, a type-level consumption test, a minor changeset, and a design spec consistent with the existing
docs/superpowers/specs/entries.
claude-sonnet-5-5 | 𝕏

🔗 Linked issue
Refs #216
🧭 Context
Second PR of the discord.js manager parity work tracked in #216 (the issue stays open). PR 1 (#221) added the small manager methods; this one adds the two scoped managers that hang off a category and a poll answer. Every new file in
src/managers/hasManagerin its name, as in #219.📚 Description
CategoryChannel#childrenreturns aCategoryChannelChildManagerandPollAnswer#votersreturns aPollAnswerVoterManager, built on access likechannel.threads.children.cachehas no cache of its own: it is read from the raw channel store on each access (through an internalChannelManager#_inCategory), so it always agrees withclient.channels. It is synchronous with a synchronous cache and a promise with an asynchronous one (CacheRead). A store that cannot enumerate throwsCacheNotIterable, likelistCached.children.create()creates the channel throughguild.channels.createwith the category as parent.voters.fetch()delegates toMessageManager#fetchPollAnswerVoters;PollAnswer#fetchVotersnow goes through it.Deviations from the plan on the issue:
create()takes options withoutparentand without the category type, and a category type passed anyway throws the newCategoryChildCategoryerror before any request. The plan only said to injectparent_id.answer.votershas nocache: nothing tracks the voters of an answer, so eachfetchreads the API.childrenis aBaseManager, not aDataManager, since its cache is derived (theGuildMemberRoleManagerprecedent), so there is nofetch/refresh.Design notes are in
docs/superpowers/specs/2026-10-06-category-children-poll-voters-design.md.Key changes
CategoryChannel#childrenCategoryChannelChildManager:cache,guild,create,resolve,resolveId,valueOfPollAnswer#votersPollAnswerVoterManager:fetch({ limit, after })ChannelManager#_inCategory(internal)parent_idCategoryChildCategory(error)createfor a category typeVerification:
pnpm lint,pnpm build,pnpm typecheckandpnpm test(110 files, 1526 tests) all pass locally. The new tests run against a synchronous cache, the default cache and an asynchronous store;tests/types/category-children.tsis the type-level check.Type of Change
Pre-flight Checklist
pnpm changeset(orpnpm changeset add --emptyif no release is needed). See .changeset/README.md.