GeezerVison is showing github.com — pm-stack: needs-user item contract — whyUser, options, survey, delegation (#1290) by dezren39 · Pull Request #1365 · developing-today/code
Conversation
dezren39
commented
Oct 27, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Part 1 of the #1290–#1293 needs-user action layer slice (contract → UI → consumer → seam hardening), on top of the triage write path (#1346/#1350).
What lands here
TierItem gains the optional design+impl(orchestrator/aggregator): needsDrew item contract - whyDrew class, structured options[], survey questions[], delegation state #1290 extension fields: whyUser (decision | missing-info | approval | access | policy), summary, ifIgnored, options[] (≤6, slug ids, dup ids drop later), questions[] (≤5, mandatory covers, ≥2 options for single/multi), delegation (mode user|first-pass|auto, status, proposal/unable payloads present exactly when their status says so).
- Per-item sanitization in the live source (
src/tier-items.ts): the section gate never learns the fields; malformed extensions drop — delegation as a unit — never the item or the section. An auto delegation on an access/policy item drops at the seam.
- Fallbacks: whyUser derived (decision kind → decision; question-bearing → missing-info), ifIgnored computed from
since, and the delegation default stamped from the standing toggle — Drew's 2026-10-27 decision (ON for decision/missing-info/approval; access/policy never) is the initial preference record; preference actions (set-delegation-default) supersede it; a published delegation always wins; a per-item delegate action overrides the default.
- Actions store:
preference kind, proposal-identity payload fields (proposalRunId/proposalUpdatedAt, impl(aggregator/orchestrator): proposal review state handling - proposal identity, supersede/expiry races, cross-surface counts #1293), multi-choice answers as string arrays, delegate mode drew accepted as legacy alias and normalized to user (role-based naming; no new Drew-named identifiers — legacy needsDrew array name untouched).
- POST /api/actions boundary checks against the currently published item: option/survey membership, required-question coverage, proposal identity (stale triple → 'superseded/withdrawn'), access/policy auto ban — legible 400s, enforced when the aggregator holds a section.
- README: the needs-user item contract documented next to the actions store.
Tests: 255 pass (27 new in test/needs-user.test.ts), tsc --noEmit clean, biome 2.3.2 + prettier applied (incl. .md).
Refs #1290 #1293. The /attention UI (#1291) and the orchestration-pass consumer step (#1292) follow in this slice.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Per-item extension fields on orchestration tier items — whyUser,
summary, ifIgnored, options[], questions[], delegation — validated
fail-soft in the live source (src/tier-items.ts): the section gate
never learns them, a malformed extension drops (delegation as a
unit), never the item or the section. Fallbacks stamp whyUser,
an ifIgnored line from since, and the standing-toggle delegation
default (Drew's 2026-10-27 decision: auto ON for decision /
missing-info / approval; access/policy never auto; a published
delegation always wins). Role-based naming throughout — no new
Drew-named identifiers; the legacy needsDrew array name stays.
Actions store: preference kind (set-delegation-default), proposal
identity payload fields for approve/reject-proposal (#1293),
multi-choice answers as arrays, delegate mode 'drew' accepted as a
legacy alias and normalized to 'user'. POST /api/actions now checks
triage actions against the currently published item: option/survey
membership, required-question coverage, proposal identity, and the
access/policy auto ban — legible 400s.
Tests: 27 new in test/needs-user.test.ts (sanitizer drops, fallback
defaulting incl. class gate, preference records, gate round-trip,
live-source seam, boundary checks, proposal supersede/expiry,
count-once). 255 pass total; tsc clean; biome 2.3.2 + prettier.
coderabbitai
Bot
commented
Oct 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You'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 29 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3bf383cb-c7b1-47d4-8f13-ac889311f747
Commits
-
Reviewing files that changed from the base of the PR and between 13ee9d6 and 22bb42a.
Files selected for processing: 8
-
pm-stack/aggregator/README.md
pm-stack/aggregator/src/actions.ts
pm-stack/aggregator/src/model.ts
pm-stack/aggregator/src/server.ts
pm-stack/aggregator/src/sources/live.ts
pm-stack/aggregator/src/tier-items.ts
pm-stack/aggregator/test/actions.test.ts
pm-stack/aggregator/test/needs-user.test.ts
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-27T08:11:20.616580Z |
22bb42a |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2758419d78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
else if (raw.mode === "first-pass" || raw.mode === "auto") mode = raw.mode;
|
|
|
if (!mode) return undefined;
|
|
|
// Access/policy items never sit in auto, whatever the publisher sent.
|
|
|
if (mode === "auto" && !isAutoEligibleClass(whyUser)) return undefined;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derive the fallback class before rejecting auto delegation
When a publisher supplies a valid auto delegation but omits the optional whyUser, this check drops the entire delegation because the class has not been derived yet. The live source subsequently calls withUserFallbacks, which derives decision or missing-info and replaces the published state with auto/idle. This loses valid working, proposal, or inability state, including its payload and run identity. Derive the effective class before validating auto eligibility so an omitted classification does not erase an otherwise valid published delegation.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+321
to
+323
|
|
if ((q.type === "single" || q.type === "yesno") && q.options) {
|
|
|
if (typeof a.value !== "string" || !q.options.some((o) => o.id === a.value))
|
|
|
return `answer for "${q.id}" must be one of its options`;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate yes/no answers independently of optional options
For live yesno questions, sanitizeQuestions never copies options because it only does so for single and multi. Consequently, the q.options guard always skips validation here: an answer such as value: ["unrelated"] passes both action validation and this boundary check, and counts as satisfying a required yes/no question. Validate the allowed yes/no values and scalar type explicitly instead of relying on options that the sanitizer removes.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+285
to
+290
|
|
const problem = checkActionAgainstItem(
|
|
|
parsed.value,
|
|
|
findTierItem(section, parsed.value.objectRef),
|
|
|
Date.now(),
|
|
|
);
|
|
|
if (problem) return json({ error: problem }, 400);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve duplicate action tokens before checking current item state
If an option answer or proposal approval is stored successfully but its response is lost, retrying the same clientToken after the consumer removes the item or changes the proposal now returns 400 here. The request never reaches ActionsStore.add, which previously returned the existing action with deduped: true regardless of its current state. This breaks the endpoint's idempotent retry behavior and can report a successfully applied action as failed. Return an existing token's record before performing checks intended for new actions.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+155
to
+156
|
|
const runId = optionalBounded(raw.runId, 80);
|
|
|
if (runId) d.runId = runId;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Require a run identity when accepting a ready proposal
When a publisher omits runId, or supplies one that fails optionalBounded, the sanitizer still preserves a proposal-ready delegation and its proposal. However, proposalIdentity returns null for that item, and neither approval nor rejection can pass checkActionAgainstItem: omitting proposalRunId fails the required-identity check, while supplying any string fails comparison against the missing delegation run ID. Require a valid run ID for proposal-ready states so the published contract does not retain a proposal that the user cannot approve or reject.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging current main (Cost Explorer #1364) changed the routes
table geometry; this is the same format-only follow-up as #1350.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 27, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|