Repository navigation
docs(contract): propose RSVP mapping - #184
Conversation
Co-authored-by: Copilot <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 23 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe PR advances the documented contracts to proposed revision ChangesRSVP contract revision
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 3
🧹 Nitpick comments (4)
docs/research/2026-08-12-rsvp-mapping-public-assets.md (1)
125-134: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider recording
questionnaireVersionas an integer expression.The JSON block gives
"questionnaireVersion": "event.questionnaireVersions.length - 1". The value is a string that describes an integer computation.RsvpQuestionnaireResponse.questionnaireVersioninspec/partiful.openapi.jsonis{"type": "integer", "minimum": 0}. A reader can misread the note as a string wire value. Mark the placeholder as a derived integer to remove the ambiguity.📝 Proposed clarification
{ "questionnaireResponse": { - "questionnaireVersion": "event.questionnaireVersions.length - 1", + "questionnaireVersion": 0, "answers": { "question ID": "answer" } } }Add a sentence after the block: the client sends the integer
event.questionnaireVersions.length - 1.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/research/2026-08-12-rsvp-mapping-public-assets.md` around lines 125 - 134, Clarify the questionnaireResponse example by marking questionnaireVersion as the derived integer expression event.questionnaireVersions.length - 1 rather than a string value, and add the requested sentence immediately after the JSON block stating that the client sends this integer.tests/remote-api-contract.test.js (2)
429-434: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider an allow-list instead of a negative status assertion.
Line 433-434 now asserts only that the status classification is not
explicit-unknown. A wrong-but-non-unknown value, such astypescript-derived-inference, would pass.The exact per-operation expectation already exists at lines 292-298, so this weaker check is redundant rather than unsafe. An allow-list keeps the intent visible at this call site.
♻️ Proposed tightening
- expect(evidence.operationClaims[operation.operationId].status) - .not.toBe('explicit-unknown'); + expect([ + 'dated-live-observation', + 'official-protocol-specification', + ]).toContain(evidence.operationClaims[operation.operationId].status);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/remote-api-contract.test.js` around lines 429 - 434, Replace the broad negative assertion on evidence.operationClaims[operation.operationId].status with an explicit allow-list of valid status classifications, reusing the expected per-operation values established in the earlier contract assertions. Keep the operation response-key validation unchanged and ensure classifications such as explicit-unknown or typescript-derived-inference cannot pass unless explicitly expected.
470-500: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the RSVP mutation operation IDs into one constant.
The pair
addGuestandmarkEventInterestis repeated at line 292 (protocolStatusOps), lines 411-412, lines 470-471, and lines 496-497. Four literal copies of the same list will drift when a third RSVP mutation is documented.Define one module-level constant and reuse it.
♻️ Proposed refactor
+const rsvpMutationOps = ['addGuest', 'markEventInterest']; +const rsvpMutationOpSet = new Set(rsvpMutationOps);Then replace the inline literals:
- const protocolStatusOps = new Set(['addGuest', 'markEventInterest']); + const protocolStatusOps = rsvpMutationOpSet;- const expectedClassification = ['addGuest', 'markEventInterest'] - .includes(operation.operationId) + const expectedClassification = rsvpMutationOpSet.has(operation.operationId) ? 'current-first-party-public-asset-research' : 'dated-live-observation';🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/remote-api-contract.test.js` around lines 470 - 500, Define one module-level constant for the RSVP mutation operation IDs addGuest and markEventInterest, then reuse it in protocolStatusOps and every observed-response set and classification check currently duplicating that list, including the sections around operations(), observedResponseOps, and expectedClassification. Remove the repeated inline arrays while preserving the existing membership and classification behavior.spec/partiful.api-evidence.json (1)
5343-5367: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueGroup the new RSVP claim keys with their sibling pointers.
The new
#/paths/~1addGuest/post/responses/200and#/paths/~1markEventInterest/post/responses/200claims are appended at the end of theclaimsobject. The other~1addGuestand~1markEventInterestclaims sit at lines 2140-2254 and 2256-2379. The same applies to theRsvpDraftadditions at lines 5368-5431, which are separated from theRsvpDraftblock at lines 3608-3695, and to#/components/schemas/CurrentGuest/properties/status/$refat lines 5604-5606.JSON key order does not change behavior. Grouping each new pointer next to its siblings makes future contract diffs reviewable. Consider one follow-up commit that reorders the keys without changing any value.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@spec/partiful.api-evidence.json` around lines 5343 - 5367, The claims in spec/partiful.api-evidence.json are out of order: move the new addGuest and markEventInterest response claims beside their existing sibling pointers, move the RsvpDraft additions beside the existing RsvpDraft block, and move the CurrentGuest status reference beside its related CurrentGuest claims. Preserve every key and value exactly; only reorder entries in the claims object.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/CLI-PRODUCT-CONTRACT.md`:
- Around line 259-265: Clarify the stale-token condition sentence in the
standard-mutation plan section so expiry is unambiguously a separate condition
from changed input, account, or precondition, while preserving that each
condition returns safety.plan_stale before any mutation request.
In `@spec/partiful.openapi.json`:
- Around line 2032-2050: Update the research note’s addGuest request section to
document the observed RsvpDraft constraints, including each numeric limit and
its enforcing module, or reclassify/remove any unsupported constraint. Apply the
same evidence correction to
RsvpQuestionnaireResponse.questionnaireVersion.minimum and
RsvpNamedPlusOne.name.minLength, using the relevant schema symbols and
evidence-ledger pointers.
In `@tests/remote-api-contract.test.js`:
- Around line 301-306: Update the assertion after constructing the Set in the
remote API contract test to validate pointers.size with an exact equality check
against 1298, rather than applying toHaveLength to the pointers Set.
---
Nitpick comments:
In `@docs/research/2026-08-12-rsvp-mapping-public-assets.md`:
- Around line 125-134: Clarify the questionnaireResponse example by marking
questionnaireVersion as the derived integer expression
event.questionnaireVersions.length - 1 rather than a string value, and add the
requested sentence immediately after the JSON block stating that the client
sends this integer.
In `@spec/partiful.api-evidence.json`:
- Around line 5343-5367: The claims in spec/partiful.api-evidence.json are out
of order: move the new addGuest and markEventInterest response claims beside
their existing sibling pointers, move the RsvpDraft additions beside the
existing RsvpDraft block, and move the CurrentGuest status reference beside its
related CurrentGuest claims. Preserve every key and value exactly; only reorder
entries in the claims object.
In `@tests/remote-api-contract.test.js`:
- Around line 429-434: Replace the broad negative assertion on
evidence.operationClaims[operation.operationId].status with an explicit
allow-list of valid status classifications, reusing the expected per-operation
values established in the earlier contract assertions. Keep the operation
response-key validation unchanged and ensure classifications such as
explicit-unknown or typescript-derived-inference cannot pass unless explicitly
expected.
- Around line 470-500: Define one module-level constant for the RSVP mutation
operation IDs addGuest and markEventInterest, then reuse it in protocolStatusOps
and every observed-response set and classification check currently duplicating
that list, including the sections around operations(), observedResponseOps, and
expectedClassification. Remove the repeated inline arrays while preserving the
existing membership and classification behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d7d85b40-069c-4724-8848-c1f56805de25
📒 Files selected for processing (9)
docs/CLI-PRODUCT-CONTRACT.mddocs/REMOTE-API-CONTRACT.mddocs/adr/0001-greenfield-go-module-seams.mddocs/research/2026-08-10-contract-evidence-sources.mddocs/research/2026-08-10-partiful-api-contract-evidence-ledger.mddocs/research/2026-08-12-rsvp-mapping-public-assets.mdspec/partiful.api-evidence.jsonspec/partiful.openapi.jsontests/remote-api-contract.test.js
| Standard-mutation plan tokens are single-use and expire after five minutes. | ||
| Apply reacquires the private account fingerprint and every bound remote | ||
| precondition before it consumes the token. Changed input, account, or | ||
| precondition, expiry, or reuse returns `safety.plan_stale` before a mutation | ||
| request. A successful precondition check permits exactly one mutation | ||
| request. The CLI does not automatically retry a mutation after a response, | ||
| timeout, connection loss, or ambiguous completion. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Clarify the stale-token condition list.
Line 262 reads "Changed input, account, or precondition, expiry, or reuse returns safety.plan_stale". The sentence joins two coordinated lists with the same separator. A reader cannot tell whether "expiry" belongs to the "changed" group. This is a normative rule, so the ambiguity matters.
📝 Proposed rewording
-Standard-mutation plan tokens are single-use and expire after five minutes.
-Apply reacquires the private account fingerprint and every bound remote
-precondition before it consumes the token. Changed input, account, or
-precondition, expiry, or reuse returns `safety.plan_stale` before a mutation
-request. A successful precondition check permits exactly one mutation
-request. The CLI does not automatically retry a mutation after a response,
-timeout, connection loss, or ambiguous completion.
+Standard-mutation plan tokens are single-use and expire after five minutes.
+Apply reacquires the private account fingerprint and every bound remote
+precondition before it consumes the token. Apply returns `safety.plan_stale`
+before a mutation request if the input changed, the account changed, a bound
+precondition changed, the token expired, or the token was already used. A
+successful precondition check permits exactly one mutation request. The CLI
+does not automatically retry a mutation after a response, timeout,
+connection loss, or ambiguous completion.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Standard-mutation plan tokens are single-use and expire after five minutes. | |
| Apply reacquires the private account fingerprint and every bound remote | |
| precondition before it consumes the token. Changed input, account, or | |
| precondition, expiry, or reuse returns `safety.plan_stale` before a mutation | |
| request. A successful precondition check permits exactly one mutation | |
| request. The CLI does not automatically retry a mutation after a response, | |
| timeout, connection loss, or ambiguous completion. | |
| Standard-mutation plan tokens are single-use and expire after five minutes. | |
| Apply reacquires the private account fingerprint and every bound remote | |
| precondition before it consumes the token. Apply returns `safety.plan_stale` | |
| before a mutation request if the input changed, the account changed, a bound | |
| precondition changed, the token expired, or the token was already used. A | |
| successful precondition check permits exactly one mutation request. The CLI | |
| does not automatically retry a mutation after a response, timeout, | |
| connection loss, or ambiguous completion. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/CLI-PRODUCT-CONTRACT.md` around lines 259 - 265, Clarify the stale-token
condition sentence in the standard-mutation plan section so expiry is
unambiguously a separate condition from changed input, account, or precondition,
while preserving that each condition returns safety.plan_stale before any
mutation request.
| "name": { | ||
| "type": "string" | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "maxLength": 50 | ||
| }, | ||
| "count": { | ||
| "type": "integer" | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "plusOnes": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| "$ref": "#/components/schemas/RsvpNamedPlusOne" | ||
| } | ||
| }, | ||
| "message": { | ||
| "type": [ | ||
| "string", | ||
| "null" | ||
| ] | ||
| "type": "string", | ||
| "maxLength": 400 | ||
| }, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check that the cited research section documents the RSVP numeric constraints.
set -euo pipefail
note='docs/research/2026-08-12-rsvp-mapping-public-assets.md'
echo '--- addGuest request section ---'
sed -n '/^## addGuest request$/,/^## /p' "$note"
echo
echo '--- numeric mentions anywhere in the note ---'
rg -n '\b(50|400|maxLength|minLength|minimum|characters|limit)\b' "$note" || echo 'no numeric limit recorded'
echo
echo '--- constraint pointers in the evidence ledger ---'
rg -n 'RsvpDraft/properties/(name|count|message)/(minLength|maxLength|minimum)' \
spec/partiful.api-evidence.json -A 2Repository: KalebCole/partiful-cli
Length of output: 3501
Document the RSVP length and range limits in the research note.
The addGuest request section contains no numeric limits, but the evidence ledger cites it for the four RsvpDraft constraints. Add each observed limit and its enforcing module. If no asset enforces a limit, reclassify the pointer or remove the constraint. Apply the same correction to RsvpQuestionnaireResponse.questionnaireVersion.minimum and RsvpNamedPlusOne.name.minLength.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@spec/partiful.openapi.json` around lines 2032 - 2050, Update the research
note’s addGuest request section to document the observed RsvpDraft constraints,
including each numeric limit and its enforcing module, or reclassify/remove any
unsupported constraint. Apply the same evidence correction to
RsvpQuestionnaireResponse.questionnaireVersion.minimum and
RsvpNamedPlusOne.name.minLength, using the relevant schema symbols and
evidence-ledger pointers.
| const pointers = new Set([ | ||
| ...materialClaimPointers(spec.servers, '#/servers', 'servers'), | ||
| ...materialClaimPointers(spec.paths, '#/paths', 'paths'), | ||
| ...materialClaimPointers(spec.components, '#/components', 'components'), | ||
| ]); | ||
| expect(pointers).toHaveLength(1254); | ||
| expect(pointers).toHaveLength(1298); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check toHaveLength usage against Set values and confirm the Vitest version.
set -euo pipefail
echo '--- Vitest version declared by the project ---'
fd -t f 'package.json' -d 2 --exec sh -c 'echo "== $1 =="; jq -r ".devDependencies.vitest, .dependencies.vitest" "$1" 2>/dev/null' _ {} \;
echo
echo '--- Set.prototype.length in Node ---'
node -e 'const s = new Set([1,2,3]); console.log("length:", s.length, "size:", s.size);'
echo
echo '--- toHaveLength assertions in the test suite ---'
rg -nP '\btoHaveLength\s*\(' tests -C 4Repository: KalebCole/partiful-cli
Length of output: 7196
🌐 Web query:
Does Vitest expect().toHaveLength() work on a Set or does it require a length property?
💡 Result:
Vitest's expect.toHaveLength does not work on a JavaScript Set [1][2]. The toHaveLength matcher is explicitly designed to check if an object has a.length property that matches a specific numeric value [1][3]. Because JavaScript Set objects use a.size property rather than a.length property, toHaveLength will fail when used on a Set [1][4]. To check the size of a Set in Vitest, you should check the.size property directly using a matcher like toEqual or toBe: expect(mySet).toHaveProperty('size', expectedSize); // OR expect(mySet.size).toBe(expectedSize);
Citations:
- 1: https://vitest.dev/api/expect.html
- 2: https://github.com/vitest-dev/vitest/blob/206e8cff/docs/api/expect.md
- 3: https://jestjs.io/docs/expect
- 4: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- Vitest dependency resolution ---'
fd -t f 'package-lock.json|npm-shrinkwrap.json|pnpm-lock.yaml|yarn.lock' -d 2 -0 \
| xargs -0 -r rg -n -C 2 'vitest|`@vitest/expect`'
echo
echo '--- Relevant test context ---'
sed -n '288,314p' tests/remote-api-contract.test.js
echo
echo '--- Runtime property behavior ---'
node - <<'JS'
const pointers = new Set(Array.from({ length: 1298 }, (_, index) => index));
console.log(JSON.stringify({
length: pointers.length,
size: pointers.size,
lengthEqualsExpected: pointers.length === 1298,
}));
JS
echo
echo '--- Local Vitest installation check ---'
if command -v vitest >/dev/null 2>&1; then
vitest --version
else
echo 'vitest executable not available'
fi
if [ -d node_modules/vitest ]; then
echo 'node_modules/vitest exists'
node -p "require('./node_modules/vitest/package.json').version"
else
echo 'node_modules/vitest not available'
fiRepository: KalebCole/partiful-cli
Length of output: 7336
🌐 Web query:
Vitest v3 toHaveLength matcher implementation received Set undefined length behavior
💡 Result:
In Vitest, including version 3, the toHaveLength matcher is designed to assert that an object possesses a .length property that matches the provided numeric value [1][2]. For a Set object, toHaveLength will not work as expected because a Set does not have a .length property; instead, it uses the .size property to denote the number of elements. Consequently, if you pass a Set to toHaveLength, it will likely fail or behave as if the length is undefined, as it specifically checks for the existence and value of .length on the received object [1][2]. If you need to verify the number of elements in a Set, you should use the toHaveProperty matcher to check the .size property, or check the .size property directly: // Example of verifying Set size in Vitest const mySet = new Set([1][3][4]); expect(mySet.size).toBe(3); // Alternatively expect(mySet).toHaveProperty('size', 3); There were no breaking changes in Vitest 3.0 that modified the fundamental behavior of toHaveLength regarding Set objects or how it handles undefined length properties [5][6][7]. The matcher consistently requires the presence of a .length property [1][2].
Citations:
- 1: https://www.getbook.com/en/book/vitest-3/api/expect
- 2: https://vitest.dev/api/expect.html
- 3: feat(browser): add
lengthproperty to locators,toHaveLengthnow accepts locators vitest-dev/vitest#8512 - 4: Vitest Browser - PlaywrightLocator missing
lengthproperty, makingtoHaveLengthimpossible vitest-dev/vitest#8274 - 5: https://vitest.dev/blog/vitest-3
- 6: https://github.com/vitest-dev/vitest/releases/tag/v3.0.0
- 7: https://redirect.github.com/vitest-dev/vitest/releases/tag/v3.0.0
Assert pointers.size instead of pointers.
pointers is a Set, and Vitest 3.2.7 toHaveLength reads length. The assertion fails because length is undefined; it does not validate the count. Use expect(pointers.size).toBe(1298).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/remote-api-contract.test.js` around lines 301 - 306, Update the
assertion after constructing the Set in the remote API contract test to validate
pointers.size with an exact equality check against 1298, rather than applying
toHaveLength to the pointers Set.
Co-authored-by: Copilot <[email protected]> Copilot-Session: 7b842425-e150-41a6-9cd2-6b0842fe8c01
Co-authored-by: Copilot <[email protected]> Copilot-Session: 7b842425-e150-41a6-9cd2-6b0842fe8c01
Summary
Phase 1 contract work for #166. This PR does not implement or call RSVP mutations.
goingtoaddGueststatusGOING,not-goingtoDECLINED, andinterested/removal tomarkEventInterestbooleansRsvpReadfrom writableRsvpIntent2026-08-12.2while shipped Go constants remain at.1Contract limits
getCurrentGuestnull, alternate, and failure variants remain unknown.source; no source value is invented.addGuestrequires an object result but uses no business field.markEventInterestrequiressuccess === trueand an echoed matchinginterestedvalue.Validation
TZ=America/Los_Angeles npx vitest run tests/remote-api-contract.test.js tests/product-contract.test.js— 32 passedTZ=America/Los_Angeles npm test -- --exclude 'tests/*.integration.test.js'— 296 passed, 6 skipped\n-npm run typecheck\n-go test -race ./...\n-go vet ./...\n- Go build/module verification/tidy checks\n-scripts/pii-guard.sh\n-git diff --cached --check\n\nPart of Implement RSVP and standard mutation plans in Go #166.Summary by CodeRabbit
2026-08-12.2.