Skip to content

docs(spec): reconstruct remote API contract - #156

Merged
KalebCole merged 6 commits into
mainfrom
spec/reconstruct-partiful-api-contract
Aug 10, 2026
Merged

KalebCole merged 6 commits into
mainfrom
spec/reconstruct-partiful-api-contract

Conversation

@KalebCole

@KalebCole KalebCole commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds proposed remote-only OpenAPI 3.1 contract revision 2026-08-10.1 at spec/partiful.openapi.json; explicit owner approval is pending.
  • Preserves the historical 27-operation draft only as a clearly non-authoritative local research artifact, allowing clean-checkout semantic citation audits without importing product extensions into the canonical contract.
  • Audits 819 material claims: 723 historically derived claims must equal their narrow cited JSON source; all comparisons have defined source/canonical values and 0 mismatches. All 24 operation security assignments are covered.
  • Resolves the text-blast conflict from dated primary observation; uses schema-free default responses while status/error bodies are unknown; separates request/response/status citations; uses repeated query-array serialization for Firestore update masks; and leaves undocumented Firebase localId absent.

Verification

  • npm test -- tests/remote-api-contract.test.js — passed (14 tests; 1.96s test execution, no timeout).
  • npm run typecheck — passed
  • git diff --check — passed
  • Full npm test was attempted but stopped after severe host-wide slowdown caused unrelated existing suites to exceed their 5s timeouts; no completed baseline comparison is claimed.

No live probe was attempted: partiful doctor found no local credentials. No mutation was performed. Owner review/approval remains required.

Summary by CodeRabbit

  • Documentation

    • Added documentation for the proposed remote API contract, including evidence standards, review requirements, uncertainty handling, and historical context.
    • Added a research index describing evidence sources and confidence boundaries.
  • New Specifications

    • Added versioned OpenAPI definitions covering event, guest, authentication, Firestore, upload, and poster catalog operations.
    • Added an evidence ledger documenting operation classifications, citations, resolved conflicts, and unknowns.
    • Added a historical contract draft for reference.
  • Tests

    • Added comprehensive validation for contract versioning, schemas, security, evidence citations, transport behavior, and unknown response semantics.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a
@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 10, 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: 21 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: 34f6c166-4005-40ed-ac4e-092a5868b163

📥 Commits

Reviewing files that changed from the base of the PR and between 57ef6bf and 167833e.

📒 Files selected for processing (5)
  • docs/REMOTE-API-CONTRACT.md
  • docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • tests/remote-api-contract.test.js
📝 Walkthrough

Walkthrough

The PR publishes the Partiful remote API contract revision 2026-08-10.1. It adds evidence documentation, historical research artifacts, machine-readable API and evidence specifications, and validation tests.

Changes

Remote API contract

Layer / File(s) Summary
Contract authority and evidence model
docs/REMOTE-API-CONTRACT.md, docs/research/..., spec/partiful.api-evidence.json, spec/research/...
Defines contract authority, evidence classifications, 27 operations, explicit unknowns, historical provenance, and the resolved createTextBlast schema.
Machine-readable API contract
spec/partiful.openapi.json
Adds an OpenAPI 3.1 specification for remote operations, transport hosts, authentication, request and response shapes, uploads, poster retrieval, and reusable schemas.
Contract validation tests
tests/remote-api-contract.test.js
Validates versioning, operation and schema evidence, citations, transport hosts, security assignments, policy metadata exclusion, explicit unknowns, and text-blast schema details.

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

Possibly related issues

  • KalebCole/partiful-cli#153 — The PR publishes the evidence-backed, versioned remote API contract described by the issue.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 describes the main change: reconstructing the remote API contract and related specification documentation.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch spec/reconstruct-partiful-api-contract

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 10, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-10 22:29 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: 2

🤖 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 `@spec/partiful.openapi.json`:
- Around line 10-38: The OpenAPI operations claim unverified numeric 200
responses, and the contract test does not validate status-code evidence. In
spec/partiful.openapi.json lines 10-38, replace each unsupported numeric
response key with default unless corresponding reviewed status-code evidence is
recorded; in tests/remote-api-contract.test.js lines 32-46, add validation that
rejects numeric response codes lacking matching evidence-ledger status-code
evidence, while preserving payload evidence checks.
- Around line 3-6: Use a single verified contract revision across both sites: in
spec/partiful.openapi.json lines 3-6, set info.version to 2026-08-10.1 or define
an explicit mapping between API version and contract revision; in
tests/remote-api-contract.test.js lines 24-30, update the assertion to validate
that defined revision, preferably via evidence.contractRevision, instead of
1.0.0.
🪄 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: 4101a564-9da6-422b-bdf8-034a3dcb691a

📥 Commits

Reviewing files that changed from the base of the PR and between c0816fd and cf33b4e.

📒 Files selected for processing (5)
  • docs/REMOTE-API-CONTRACT.md
  • docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • tests/remote-api-contract.test.js

Comment thread spec/partiful.openapi.json Resolved
Comment thread spec/partiful.openapi.json Resolved
Ubuntu added 4 commits August 10, 2026 19:48
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a

@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: 5

🧹 Nitpick comments (5)
docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md (1)

21-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prose is coupled to a literal test substring.

Lines 21-22 repeat the same sentence pattern for two operations. tests/remote-api-contract.test.js lines 273-276 match the exact substring `<operationId>` is a TypeScript-derived inference. Any editorial merge of these two sentences breaks the test. Consider asserting the classification from spec/partiful.api-evidence.json and matching only the operation id in the document.

🤖 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-10-partiful-api-contract-evidence-ledger.md` around
lines 21 - 23, Update the contract test around the repeated “TypeScript-derived
inference” prose to derive the expected classification from
spec/partiful.api-evidence.json and assert the operation id independently,
rather than requiring the exact sentence substring in the document. Preserve
validation that both sendAuthCodeTrusted and lookupFirebaseUser are documented
with the correct classification.
tests/remote-api-contract.test.js (2)

199-208: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Guard the claim lookup before reading citation.

Line 202 reads evidence.claims[base].citation. If the pointer is absent, the test throws a TypeError instead of reporting the missing claim pointer. Add a defined check with the pointer as the assertion message.

🤖 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 199 - 208, Update the claim
assertion in the unknown-default response test to first verify that
evidence.claims[base] is defined, using base as the assertion message, before
reading its citation; keep the existing citation comparison unchanged.

210-228: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Tighten the update-mask pointer pattern.

The $ anchor at line 219 applies only to the second alternative, so the first alternative matches any pointer that contains updateMask.fieldPaths at any depth. The pattern also hard-codes parameters/1, which breaks if the parameter order changes. Match the parameter by name instead of by index.

🤖 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 210 - 228, Update the
updateMask assertion in the test to anchor the entire pointer pattern and match
the parameter by its name rather than the hard-coded parameters/1 index.
Preserve support for both updateMask.fieldPaths and the parameter’s
style/explode pointers while allowing parameter ordering to change.
spec/research/historical-27-operation-draft.json (1)

3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Mark the artifact non-authoritative inside the file.

docs/research/2026-08-10-contract-evidence-sources.md declares this file a non-authoritative copy. The file itself does not state that. A reader or a code generator that opens the JSON alone can mistake it for the canonical contract. Add the status to info.description, or add an x-status extension. Keep the change limited if you must preserve byte-exact copy semantics; in that case record the exception in the sources index.

🤖 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/research/historical-27-operation-draft.json` around lines 3 - 7, Update
the JSON artifact’s info metadata to explicitly identify it as
non-authoritative, preferably by adding that status to info.description or via
an x-status extension. Keep the change limited to this metadata and preserve
byte-exact copy semantics if required, documenting the exception in the sources
index.
spec/partiful.openapi.json (1)

1775-1787: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Wire the response schemas to the default responses, or drop them.

Nine schemas are unreachable: CallableResponse, FirestoreDocument, FirestoreListResponse, RefreshTokenResponse, FirebaseSignInResponse, FirebaseLookupResponse, UploadData, UploadPhotoResponse, and Poster. No operation references them, because every response now uses a bare default key. Code generators emit unused models, and readers cannot tell which operation each shape belongs to.

The status codes stay explicit unknowns, so a default response can still carry the observed payload shape. Example for getPosterCatalog:

♻️ Proposed change to attach an observed payload shape
         "responses": {
           "default": {
-            "description": "Response status and body are unknown."
+            "description": "Response status is unknown. The observed body is a poster catalog array.",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "`#/components/schemas/Poster`"
+                  }
+                }
+              }
+            }
           }
         },

If the payload evidence is not strong enough to publish, remove the unreferenced schemas instead.

Also applies to: 1830-1856, 1879-1936

🤖 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 1775 - 1787, Remove the unreachable
schemas CallableResponse, FirestoreDocument, FirestoreListResponse,
RefreshTokenResponse, FirebaseSignInResponse, FirebaseLookupResponse,
UploadData, UploadPhotoResponse, and Poster, unless concrete operation payload
evidence supports attaching each schema to its corresponding default response.
Ensure no unused component schemas remain and preserve the existing explicit
unknown status-code responses.
🤖 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/research/2026-08-10-partiful-api-contract-evidence-ledger.md`:
- Around line 45-49: Update the poster catalog operation and Poster schema
citation wording to reference the Markdown headings `#poster-catalog-fetch` and
`#poster-interface` in the evidence-sources ledger, rather than directly citing
src/lib/posters.ts; retain src/lib/posters.ts as the underlying source
referenced by those headings.
- Around line 39-40: Update the claim-count wording in the evidence ledger
description to consistently state 819 material claims, including the reference
to tests/remote-api-contract.test.js; preserve the surrounding
citation-resolution text.

In `@spec/partiful.openapi.json`:
- Around line 1237-1248: Update the collectionPath parameter in the
firestoreListDocuments operation to document that its value may contain
multi-segment Firestore paths and that slash separators must remain unencoded;
use the OpenAPI parameter metadata appropriate for preserving path separators or
explicitly state the reserved-character requirement. Keep the existing parameter
name, path location, and required behavior unchanged.

In `@tests/remote-api-contract.test.js`:
- Around line 284-294: Update the citation comparison in the test “does not
treat the event-image observation as poster-catalog evidence” to use the real
dated event-image note path instead of the undefined
`evidence.sources.eventImageObservation` value, while preserving the existing
poster pointer filtering and negative assertion.
- Around line 136-141: Update the assertion after constructing the pointers Set
to assert its size rather than its nonexistent length: use pointers.size and
verify it equals 819, preserving the existing claim collection logic.

---

Nitpick comments:
In `@docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md`:
- Around line 21-23: Update the contract test around the repeated
“TypeScript-derived inference” prose to derive the expected classification from
spec/partiful.api-evidence.json and assert the operation id independently,
rather than requiring the exact sentence substring in the document. Preserve
validation that both sendAuthCodeTrusted and lookupFirebaseUser are documented
with the correct classification.

In `@spec/partiful.openapi.json`:
- Around line 1775-1787: Remove the unreachable schemas CallableResponse,
FirestoreDocument, FirestoreListResponse, RefreshTokenResponse,
FirebaseSignInResponse, FirebaseLookupResponse, UploadData, UploadPhotoResponse,
and Poster, unless concrete operation payload evidence supports attaching each
schema to its corresponding default response. Ensure no unused component schemas
remain and preserve the existing explicit unknown status-code responses.

In `@spec/research/historical-27-operation-draft.json`:
- Around line 3-7: Update the JSON artifact’s info metadata to explicitly
identify it as non-authoritative, preferably by adding that status to
info.description or via an x-status extension. Keep the change limited to this
metadata and preserve byte-exact copy semantics if required, documenting the
exception in the sources index.

In `@tests/remote-api-contract.test.js`:
- Around line 199-208: Update the claim assertion in the unknown-default
response test to first verify that evidence.claims[base] is defined, using base
as the assertion message, before reading its citation; keep the existing
citation comparison unchanged.
- Around line 210-228: Update the updateMask assertion in the test to anchor the
entire pointer pattern and match the parameter by its name rather than the
hard-coded parameters/1 index. Preserve support for both updateMask.fieldPaths
and the parameter’s style/explode pointers while allowing parameter ordering to
change.
🪄 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: 97ffb634-8862-4f70-b207-95823e9cb764

📥 Commits

Reviewing files that changed from the base of the PR and between cf33b4e and 57ef6bf.

📒 Files selected for processing (7)
  • docs/REMOTE-API-CONTRACT.md
  • docs/research/2026-08-10-contract-evidence-sources.md
  • docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • spec/research/historical-27-operation-draft.json
  • tests/remote-api-contract.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/REMOTE-API-CONTRACT.md

Comment on lines +39 to +40
The 819 material claims are audited by
`tests/remote-api-contract.test.js`. Each ledger citation resolves either to a

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 | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Compare the documented claim count with the test constant and the ledger entry count.
set -euo pipefail

rg -n '819|876|776' docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md tests/remote-api-contract.test.js

fd -t f 'partiful.api-evidence.json' spec --exec sh -c 'python3 -c "
import json,sys
data = json.load(open(sys.argv[1]))
print(sys.argv[1], \"claims:\", len(data.get(\"claims\", {})), \"operations:\", len(data.get(\"operations\", {})))
" {}'

Repository: KalebCole/partiful-cli

Length of output: 458


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- ledger and test references ---'
rg -n -C 2 '819|876|776|material claims|historically derived' \
  docs/research/2026-08-10-partiful-api-contract-evidence-ledger.md \
  tests/remote-api-contract.test.js

printf '%s\n' '--- evidence JSON files ---'
git ls-files 'spec/*partiful*' 'spec/**/*.json' | sed -n '1,80p'

printf '%s\n' '--- claim counts ---'
python3 - <<'PY'
import json
from pathlib import Path

for path in Path("spec").rglob("partiful.api-evidence.json"):
    data = json.loads(path.read_text())
    print(path, "claims:", len(data.get("claims", {})),
          "operations:", len(data.get("operations", {})))
PY

printf '%s\n' '--- repository references to the disputed counts ---'
rg -n -S '876 material|776 historically|819 material|material claims|historically derived claims' . \
  -g '!node_modules' -g '!dist' -g '!build' || true

Repository: KalebCole/partiful-cli

Length of output: 1556


Correct the PR description claim count.

The committed evidence file contains 819 claims, and the test audits 819 material claims. Update the PR description to use 819 material claims.

🤖 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-10-partiful-api-contract-evidence-ledger.md` around
lines 39 - 40, Update the claim-count wording in the evidence ledger description
to consistently state 819 material claims, including the reference to
tests/remote-api-contract.test.js; preserve the surrounding citation-resolution
text.

Comment on lines +45 to +49
The event-image observation establishes fields used for an event's selected
poster image; it does **not** establish that `/posters.json` returns a catalog
array or that its entries have that shape. The catalog operation and `Poster`
schema are therefore TypeScript-derived inferences with citations to
`src/lib/posters.ts`, not dated live observations.

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 | 🟡 Minor | ⚡ Quick win

Correct the stated citation target for the poster claims.

This text says the catalog operation and Poster schema carry citations to src/lib/posters.ts. The machine ledger cites the Markdown headings #poster-catalog-fetch and #poster-interface in docs/research/2026-08-10-contract-evidence-sources.md, and tests/remote-api-contract.test.js line 287 asserts that Markdown citation. src/lib/posters.ts is the underlying source referenced by those headings.

📝 Proposed wording fix
-schema are therefore TypeScript-derived inferences with citations to
-`src/lib/posters.ts`, not dated live observations.
+schema are therefore TypeScript-derived inferences. Their citations resolve to
+the `Poster interface` and `Poster catalog fetch` headings in
+`docs/research/2026-08-10-contract-evidence-sources.md`, which record the
+`src/lib/posters.ts` evidence. They are not dated live observations.
📝 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
The event-image observation establishes fields used for an event's selected
poster image; it does **not** establish that `/posters.json` returns a catalog
array or that its entries have that shape. The catalog operation and `Poster`
schema are therefore TypeScript-derived inferences with citations to
`src/lib/posters.ts`, not dated live observations.
The event-image observation establishes fields used for an event's selected
poster image; it does **not** establish that `/posters.json` returns a catalog
array or that its entries have that shape. The catalog operation and `Poster`
schema are therefore TypeScript-derived inferences. Their citations resolve to
the `Poster interface` and `Poster catalog fetch` headings in
`docs/research/2026-08-10-contract-evidence-sources.md`, which record the
`src/lib/posters.ts` evidence. They are not dated live observations.
🤖 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-10-partiful-api-contract-evidence-ledger.md` around
lines 45 - 49, Update the poster catalog operation and Poster schema citation
wording to reference the Markdown headings `#poster-catalog-fetch` and
`#poster-interface` in the evidence-sources ledger, rather than directly citing
src/lib/posters.ts; retain src/lib/posters.ts as the underlying source
referenced by those headings.

Comment on lines +1237 to +1248
"/v1/projects/getpartiful/databases/(default)/documents/{collectionPath}": {
"get": {
"operationId": "firestoreListDocuments",
"parameters": [
{
"name": "collectionPath",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},

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

{collectionPath} will be percent-encoded and break multi-segment Firestore paths.

Firestore collection paths are multi-segment, for example events/{eventId}/guests. This parameter uses the default simple style, so generated clients and validators percent-encode the value and send events%2F{eventId}%2Fguests. Firestore then resolves a different resource or returns an error. The spec also carries no note that the value contains path separators.

Either enumerate the concrete collection paths that the contract observed, or document the reserved-character requirement on the parameter so consumers do not encode the separators.

🔧 Proposed change to document the separator requirement
           {
             "name": "collectionPath",
             "in": "path",
             "required": true,
+            "description": "Firestore collection path relative to the documents root. The value contains unencoded '/' separators, for example 'events/{eventId}/guests'. Do not percent-encode the separators.",
             "schema": {
-              "type": "string"
+              "type": "string",
+              "pattern": "^[^/]+(/[^/]+)*$"
             }
           },
📝 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
"/v1/projects/getpartiful/databases/(default)/documents/{collectionPath}": {
"get": {
"operationId": "firestoreListDocuments",
"parameters": [
{
"name": "collectionPath",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
"/v1/projects/getpartiful/databases/(default)/documents/{collectionPath}": {
"get": {
"operationId": "firestoreListDocuments",
"parameters": [
{
"name": "collectionPath",
"in": "path",
"required": true,
"description": "Firestore collection path relative to the documents root. The value contains unencoded '/' separators, for example 'events/{eventId}/guests'. Do not percent-encode the separators.",
"schema": {
"type": "string",
"pattern": "^[^/]+(/[^/]+)*$"
}
},
🤖 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 1237 - 1248, Update the
collectionPath parameter in the firestoreListDocuments operation to document
that its value may contain multi-segment Firestore paths and that slash
separators must remain unencoded; use the OpenAPI parameter metadata appropriate
for preserving path separators or explicitly state the reserved-character
requirement. Keep the existing parameter name, path location, and required
behavior unchanged.

Comment on lines +136 to +141
const pointers = new Set([
...materialClaimPointers(spec.servers, '#/servers', 'servers'),
...materialClaimPointers(spec.paths, '#/paths', 'paths'),
...materialClaimPointers(spec.components, '#/components', 'components'),
]);
expect(pointers).toHaveLength(819);

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 | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Vitest 3 toHaveLength matcher requires length property Set size

💡 Result:

The Vitest toHaveLength matcher requires that the received object has a .length property [1][2]. Because JavaScript Set objects do not have a .length property—they use a .size property instead—toHaveLength will not function as expected when used directly on a Set [1]. To verify the size of a Set in Vitest, you should access the .size property directly and use the toBe matcher [1]: javascript import { expect, test } from 'vitest' test('check set size', () => { const mySet = new Set([1, 2, 3]) expect(mySet.size).toBe(3) })

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- target test ---'
sed -n '110,155p' tests/remote-api-contract.test.js

printf '%s\n' '--- Vitest configuration and package versions ---'
find . -maxdepth 2 -type f \( -name 'package.json' -o -name 'vitest.config.*' \) -print
if [ -f package.json ]; then
  node - <<'JS'
const fs = require('fs');
const p = JSON.parse(fs.readFileSync('package.json', 'utf8'));
console.log(JSON.stringify({
  type: p.type,
  scripts: p.scripts,
  vitest: p.devDependencies?.vitest ?? p.dependencies?.vitest
}, null, 2));
JS
fi

printf '%s\n' '--- relevant matcher usage ---'
rg -n --glob '*.js' 'toHaveLength|pointers\.size|materialClaimPointers' .

Repository: KalebCole/partiful-cli

Length of output: 4399


🏁 Script executed:

#!/bin/bash
set -eu

node - <<'JS'
const pointers = new Set(['a', 'b', 'c']);
console.log(JSON.stringify({
  length: pointers.length,
  size: pointers.size,
  lengthMatchesExpected: pointers.length === 3,
  sizeMatchesExpected: pointers.size === 3,
}));
JS

Repository: KalebCole/partiful-cli

Length of output: 228


Assert pointers.size instead of using toHaveLength.

pointers is a Set without a .length property, so this assertion fails before the claim checks run. Use expect(pointers.size).toBe(819).

🤖 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 136 - 141, Update the
assertion after constructing the pointers Set to assert its size rather than its
nonexistent length: use pointers.size and verify it equals 819, preserving the
existing claim collection logic.

Comment on lines +284 to +294
it('does not treat the event-image observation as poster-catalog evidence', () => {
const posterOperation = evidence.operations.getPosterCatalog;
expect(posterOperation.classification).toBe('typescript-derived-inference');
expect(posterOperation.citation).toBe(evidence.sources.posterCatalog);
expect(evidence.sources).not.toHaveProperty('eventImageObservation');
for (const [pointer, claim] of Object.entries(evidence.claims)) {
if (pointer.includes('/posters.json') || pointer.includes('/Poster')) {
expect(claim.citation).not.toBe(evidence.sources.eventImageObservation);
}
}
});

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 | 🟡 Minor | ⚡ Quick win

The event-image loop assertion can never fail.

Line 288 asserts that evidence.sources has no eventImageObservation key. Lines 289-292 then compare each citation against evidence.sources.eventImageObservation, which is undefined. Citations are strings, so not.toBe(undefined) always passes. Compare against the event-image note path so the loop enforces the stated rule.

🐛 Proposed fix
+const eventImageNote = 'docs/research/2026-03-24-event-image-observation.md';
     expect(evidence.sources).not.toHaveProperty('eventImageObservation');
     for (const [pointer, claim] of Object.entries(evidence.claims)) {
       if (pointer.includes('/posters.json') || pointer.includes('/Poster')) {
-        expect(claim.citation).not.toBe(evidence.sources.eventImageObservation);
+        expect(claim.citation, pointer).not.toContain(eventImageNote);
       }
     }

Replace eventImageNote with the real path of the dated event-image note.

📝 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
it('does not treat the event-image observation as poster-catalog evidence', () => {
const posterOperation = evidence.operations.getPosterCatalog;
expect(posterOperation.classification).toBe('typescript-derived-inference');
expect(posterOperation.citation).toBe(evidence.sources.posterCatalog);
expect(evidence.sources).not.toHaveProperty('eventImageObservation');
for (const [pointer, claim] of Object.entries(evidence.claims)) {
if (pointer.includes('/posters.json') || pointer.includes('/Poster')) {
expect(claim.citation).not.toBe(evidence.sources.eventImageObservation);
}
}
});
it('does not treat the event-image observation as poster-catalog evidence', () => {
const posterOperation = evidence.operations.getPosterCatalog;
expect(posterOperation.classification).toBe('typescript-derived-inference');
expect(posterOperation.citation).toBe(evidence.sources.posterCatalog);
const eventImageNote = 'docs/research/2026-03-24-event-image-observation.md';
expect(evidence.sources).not.toHaveProperty('eventImageObservation');
for (const [pointer, claim] of Object.entries(evidence.claims)) {
if (pointer.includes('/posters.json') || pointer.includes('/Poster')) {
expect(claim.citation, pointer).not.toContain(eventImageNote);
}
}
});
🤖 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 284 - 294, Update the
citation comparison in the test “does not treat the event-image observation as
poster-catalog evidence” to use the real dated event-image note path instead of
the undefined `evidence.sources.eventImageObservation` value, while preserving
the existing poster pointer filtering and negative assertion.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 20afc1c6-5147-40ea-8fcc-837fbcbaa55a
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