Skip to content

docs(contract): propose RSVP mapping - #184

Merged
KalebCole merged 3 commits into
mainfrom
spec/166-rsvp-mapping
Aug 12, 2026
Merged

KalebCole merged 3 commits into
mainfrom
spec/166-rsvp-mapping

Conversation

@KalebCole

@KalebCole KalebCole commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Phase 1 contract work for #166. This PR does not implement or call RSVP mutations.

  • records the current public Partiful build, exact asset URLs, and module IDs
  • maps going to addGuest status GOING, not-going to DECLINED, and interested/removal to markEventInterest booleans
  • documents exact callable parameters and the client completion checks
  • separates RsvpRead from writable RsvpIntent
  • proposes contract revision 2026-08-12.2 while shipped Go constants remain at .1
  • preserves plan-only defaults, five-minute single-use/account/input-bound plans, and no automatic retries

Contract limits

  • getCurrentGuest null, alternate, and failure variants remain unknown.
  • Direct event-page interest omits source; no source value is invented.
  • addGuest requires an object result but uses no business field.
  • markEventInterest requires success === true and an echoed matching interested value.
  • No delivery, persisted business state, or unobserved failure mapping is claimed.
  • Create-versus-update and several required precondition reads remain implementation blockers.

Validation

  • TZ=America/Los_Angeles npx vitest run tests/remote-api-contract.test.js tests/product-contract.test.js — 32 passed
  • TZ=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

  • Documentation
    • Updated product and remote API contract documentation to revision 2026-08-12.2.
    • Documented RSVP read and write formats, supported statuses, validation rules, questionnaire handling, and completion responses.
    • Added research covering callable request/response behavior and RSVP mappings.
    • Clarified mutation safety requirements, including single-use tokens and precondition checks.
  • API Specification
    • Added structured RSVP response schemas and stricter request validation.
    • Updated guest status definitions and request requirements.
  • Tests
    • Expanded contract coverage for RSVP requests, responses, status mappings, and evidence revisions.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@KalebCole, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2e0acdd-3ff8-41b4-8b59-bdaa09c2e1f2

📥 Commits

Reviewing files that changed from the base of the PR and between 811986a and dee5475.

📒 Files selected for processing (7)
  • docs/CLI-PRODUCT-CONTRACT.md
  • docs/REMOTE-API-CONTRACT.md
  • docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md
  • docs/research/2026-08-12-rsvp-mapping-public-assets.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • tests/remote-api-contract.test.js
📝 Walkthrough

Walkthrough

The PR advances the documented contracts to proposed revision 2026-08-12.2. It defines RSVP read/write shapes, remote mappings, mutation-token safeguards, OpenAPI schemas, supporting evidence, and contract-test coverage.

Changes

RSVP contract revision

Layer / File(s) Summary
RSVP evidence and mapping
docs/research/*, spec/partiful.api-evidence.json
Documents Firebase callable behavior, RSVP request projections, completion checks, status mappings, and unresolved release blockers.
Remote contract schemas
docs/REMOTE-API-CONTRACT.md, spec/partiful.openapi.json
Updates RSVP callable parameters and responses, strengthens RsvpDraft, and adds typed completion schemas.
Product and mutation contract
docs/CLI-PRODUCT-CONTRACT.md, docs/adr/0001-greenfield-go-module-seams.md
Separates RsvpRead from RsvpIntent and defines account-bound, single-use, non-retried mutation plans.
Contract validation
tests/remote-api-contract.test.js
Validates the proposed revision, evidence classifications, RSVP schemas, mappings, completion semantics, and shipped revision boundaries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: proposing the RSVP contract mapping.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch spec/166-rsvp-mapping

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.

@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-12 04:35 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 value

Consider recording questionnaireVersion as an integer expression.

The JSON block gives "questionnaireVersion": "event.questionnaireVersions.length - 1". The value is a string that describes an integer computation. RsvpQuestionnaireResponse.questionnaireVersion in spec/partiful.openapi.json is {"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 value

Consider 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 as typescript-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 value

Extract the RSVP mutation operation IDs into one constant.

The pair addGuest and markEventInterest is 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 value

Group the new RSVP claim keys with their sibling pointers.

The new #/paths/~1addGuest/post/responses/200 and #/paths/~1markEventInterest/post/responses/200 claims are appended at the end of the claims object. The other ~1addGuest and ~1markEventInterest claims sit at lines 2140-2254 and 2256-2379. The same applies to the RsvpDraft additions at lines 5368-5431, which are separated from the RsvpDraft block at lines 3608-3695, and to #/components/schemas/CurrentGuest/properties/status/$ref at 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

📥 Commits

Reviewing files that changed from the base of the PR and between a084b26 and 811986a.

📒 Files selected for processing (9)
  • docs/CLI-PRODUCT-CONTRACT.md
  • docs/REMOTE-API-CONTRACT.md
  • docs/adr/0001-greenfield-go-module-seams.md
  • docs/research/2026-08-10-contract-evidence-sources.md
  • docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md
  • docs/research/2026-08-12-rsvp-mapping-public-assets.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • tests/remote-api-contract.test.js

Comment on lines +259 to +265
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
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.

Comment on lines 2032 to 2050
"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
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 2

Repository: 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.

Comment thread tests/remote-api-contract.test.js Outdated
Comment on lines +301 to +306
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 4

Repository: 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:


🏁 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'
fi

Repository: 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:


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.

Ubuntu added 2 commits August 12, 2026 04:30
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
@KalebCole
KalebCole merged commit af0c469 into main Aug 12, 2026
2 checks passed
@KalebCole
KalebCole deleted the spec/166-rsvp-mapping branch August 27, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant