Skip to content

docs(contract): formalize Firebase transport configuration for #163 - #178

Merged
KalebCole merged 8 commits into
mainfrom
spec/163-auth-transport-correction
Aug 11, 2026
Merged

KalebCole merged 8 commits into
mainfrom
spec/163-auth-transport-correction

Conversation

@KalebCole

@KalebCole KalebCole commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Proposes remote contract revision 2026-08-11.3, pending explicit owner approval. It adds the Firebase transport configuration required by the Go auth implementation in #177 but absent from owner-reviewed revision .2.

Contract changes

  1. Public Firebase web-key configuration

    • Records the public browser configuration through a dedicated privacy-safe redacted evidence extract.
    • The unsafe historical auth artifact is not registered or cited by machine or human contract provenance.
    • A semantic regression guard rejects that unsafe provenance.
  2. Firebase Referer request requirement

    • Requires the one observed accepted Referer value on signInWithCustomToken, refreshToken, and lookupFirebaseUser.
    • Records the full remotely accepted Referer set as explicitly unknown.
  3. Origin remains unknown

    • Origin is unmodelled because sanitized evidence establishes no Origin request fact.
    • Semantic tests reject unsupported claims that probes omitted Origin or that Origin was unnecessary.

The correction retains 1008 evidence-covered material pointers and keeps the human and machine ledgers aligned.

Review fixes

Both blocking Standards findings are addressed test-first at 0b3d744ef1942c2c8d0312fe994e8f1ab292b752:

  • Replaced unsafe provenance with a purpose-built privacy-safe public-configuration extract and added a provenance regression guard.
  • Sanitized the tracked historical auth note in place, retaining only public transport structure and redacted placeholders; a semantic guard rejects private-value patterns.
  • Removed the unsupported Origin-omission statement and added semantic recurrence guards.

Review cycle 1 Spec review reported no findings. Review cycle 2 Standards review reported no findings; its Spec blocker is fixed by classifying every authentication request schema as a TypeScript-derived inference with exact preserved request-schema provenance. Response metadata/shapes and the separately observed public Firebase key and Referer facts remain dated-live observations. The semantic guard now compares each canonical auth request body to its cited source and independently checks response/transport classifications.

Safety and validation

No live authentication, SMS, credential entry, browser login, live probes, or Partiful integration tests were used. No private value is introduced or quoted by the correction.

  • Targeted contract suite: 20 passed
  • Pacific-time non-live JS suite: 284 passed
  • TypeScript typecheck: passed
  • go test -race ./..., go vet ./..., go build ./..., go mod verify: passed
  • Safe-file privacy and diff guards: passed

Status and merge dependency

Status remains proposed; no owner approval or merge has occurred. Required order:

  1. Owner reviews and merges this correction.
  2. Rebase feat(auth): implement human authentication and session lifecycle (#163) #177 onto updated main, update its advertised revision and tests from .2 to .3, and rerun all checks.
  3. Only then may feat(auth): implement human authentication and session lifecycle (#163) #177 be considered for merge.

Linked: #163

Summary by CodeRabbit

  • Documentation

    • Updated the API contract and OpenAPI snapshot to revision 2026-08-11.3, pending approval.
    • Documented Firebase authentication requirements, including the public API key and required Referer header.
    • Redacted sensitive authentication examples and added privacy-safe research evidence.
    • Clarified unresolved behavior around accepted Referer and Origin values.
  • Tests

    • Added validation for authentication transport configuration, evidence provenance, privacy protections, and unresolved contract details.

Propose remote contract revision 2026-08-11.3 adding two transport
configuration facts absent from 2026-08-11.2 that the Go implementation
(PR #177) requires for signInWithCustomToken, refreshToken, and
lookupFirebaseUser:

1. Firebase web API key value: the firebaseApiKey security scheme now
   carries x-publicValue with the observed public key. This is embedded
   in every Partiful web client and documented in the March 24, 2026
   browser interception. It is not a credential.

2. Referer header requirement: each Firebase operation now has a required
   Referer: https://partiful.com/ header parameter. Documented in the
   August 11, 2026 auth observation. Requests without it receive 403
   API_KEY_HTTP_REFERRER_BLOCKED.

Origin is NOT modelled. Agent probes succeeded without Origin, receiving
valid 400 error responses. Origin is browser CORS behavior, not a
Firebase transport requirement.

Material claims: 992 -> 1008
Contract revision: 2026-08-11.3 (proposed, pending owner approval)
Pacific full suite: 338 passed, 6 skipped, 0 failed

Linked to #163

Co-authored-by: Copilot <[email protected]>
@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 11, 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: 55 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: 0e60fd2a-a258-4b3e-97d3-83bb363f79e9

📥 Commits

Reviewing files that changed from the base of the PR and between 1db0a9f and 46c0f0d.

📒 Files selected for processing (6)
  • 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
  • tests/remote-api-contract.test.js
📝 Walkthrough

Walkthrough

The proposed contract revision adds privacy-safe Firebase API-key and Referer evidence, updates the OpenAPI snapshot and evidence ledger, redacts historical authentication examples, and adds provenance and privacy validation tests.

Changes

Firebase contract evidence

Layer / File(s) Summary
Evidence and authority records
docs/REMOTE-API-CONTRACT.md, docs/research/*
Research records now use the August 11 privacy-safe observation, redact authentication values, and document Firebase API-key and Referer behavior. The revision is pending owner approval.
Evidence contract and OpenAPI snapshot
spec/partiful.api-evidence.json, spec/partiful.openapi.json
The proposed revision records Firebase API-key provenance, required Referer headers for three endpoints, and unresolved Referer and Origin behavior.
Provenance and privacy validation
tests/remote-api-contract.test.js
Tests validate Firebase evidence, header requirements, provenance hygiene, revision metadata, claim counts, and redacted authentication examples.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • KalebCole/partiful-cli#156: Introduced the remote API contract artifacts, evidence ledger, OpenAPI specification, and related tests.
  • KalebCole/partiful-cli#176: Added authentication evidence that this change extends with Firebase API-key and Referer configuration.
🚥 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 describes the main change: formalizing Firebase transport configuration in the remote contract.
✨ 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/163-auth-transport-correction

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

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://KalebCole.github.io/partiful-cli/pr-preview/pr-178/

Built to branch gh-pages at 2026-08-11 06:09 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Describe the observed accepted Referer separately from the unknown complete allowlist so revision 2026-08-11.3 does not overstate remote behavior.

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

Copilot-Session: 8453c76f-a887-4fce-be42-d7997ed94292
@KalebCole

Copy link
Copy Markdown
Owner Author

Independent review cycle 1: Standards 2 blocking findings; Spec 0 findings. Required corrections: sanitize the legacy auth research source before using it as provenance and remove the unsupported assertion about Origin omission. The resulting tree and semantic guards must remain privacy-safe; no private values should be quoted in discussion or output.

Ubuntu and others added 2 commits August 11, 2026 05:53
Move the public Firebase configuration claim to a dedicated privacy-safe evidence extract, reject unsafe provenance, and keep Origin unmodelled and unknown.

Co-authored-by: Copilot <[email protected]>
Require redacted identity fields, retain public transport structure, and reject private-value patterns in the tracked historical auth note.

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

Copy link
Copy Markdown
Owner Author

Independent review cycle 2: Standards 0 findings; Spec 1 blocking finding. Request-shape claims for getLoginToken and signInWithCustomToken currently over-apply response/transport observation evidence. Correct the provenance or downgrade unsupported request claims, keep the separately observed Firebase transport facts exact, and add semantic coverage.

Ubuntu and others added 2 commits August 11, 2026 06:04
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 8453c76f-a887-4fce-be42-d7997ed94292
Keep all authentication request schemas TypeScript-derived while preserving dated observation classifications for responses and the separately observed Firebase transport facts.

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

@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 `@docs/research/2026-08-10-contract-evidence-sources.md`:
- Around line 42-44: Update the August 11 authentication observation references
and the related entries for getLoginToken and signInWithCustomToken in
spec/partiful.api-evidence.json so their request-shape claims return to the
prior inference class. Describe the observation as response and status evidence
only, and align the surrounding evidence wording with the API contract evidence
ledger.

In `@tests/remote-api-contract.test.js`:
- Around line 701-705: Update the Origin parameter lookup in the firebaseOps
validation loop to compare header names case-insensitively, using
p.name?.toLowerCase() against "origin", so modeled origin, Origin, or ORIGIN
headers are all detected and rejected.
🪄 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: b956ea31-1af3-48eb-a466-488a189f6d82

📥 Commits

Reviewing files that changed from the base of the PR and between 9409346 and 1db0a9f.

📒 Files selected for processing (8)
  • docs/REMOTE-API-CONTRACT.md
  • docs/research/2026-03-24-auth-flow-endpoints.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-11-firebase-public-api-key-redacted.md
  • spec/partiful.api-evidence.json
  • spec/partiful.openapi.json
  • tests/remote-api-contract.test.js

Comment on lines +701 to +705
// Origin is NOT modelled for Firebase operations — evidence does not support it as required
for (const { path: opPath, id } of firebaseOps) {
const operation = spec.paths[opPath].post;
const origin = (operation.parameters ?? []).find((p) => p.name === 'Origin');
expect(origin, `${id} must not claim Origin`).toBeUndefined();

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- target lines ---'
sed -n '680,720p' tests/remote-api-contract.test.js

printf '%s\n' '--- related declarations and Origin checks ---'
rg -n -C 4 'firebaseOps|Origin|origin' tests/remote-api-contract.test.js

Repository: KalebCole/partiful-cli

Length of output: 5060


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- spec loading and Firebase operation sources ---'
rg -n -C 5 'spec\s*=|openapi|accounts:signInWithCustomToken|lookupFirebaseUser|refreshToken|parameters:' tests/remote-api-contract.test.js --glob '*.js'

printf '%s\n' '--- all Origin parameter declarations and Firebase paths ---'
rg -n -C 3 'name:\s*['"'"'"]?[Oo]rigin|name:\s*['"'"'"]?[Rr]eferer|accounts:signInWithCustomToken|/v1/token|accounts:lookup' . --glob '*.js' --glob '*.json' --glob '*.yaml' --glob '*.yml'

printf '%s\n' '--- deterministic case/location probe ---'
python3 - <<'PY'
cases = [
    {"name": "Origin", "in": "header"},
    {"name": "origin", "in": "header"},
    {"name": "ORIGIN", "in": "header"},
    {"name": "origin", "in": "query"},
    {"name": "Referer", "in": "header"},
]
for parameter in cases:
    exact = parameter.get("name") == "Origin"
    ci_header = (
        isinstance(parameter.get("name"), str)
        and parameter["name"].lower() == "origin"
        and parameter.get("in") == "header"
    )
    print(f'{parameter!r} exact_match={exact} case_insensitive_header_match={ci_header}')
PY

Repository: KalebCole/partiful-cli

Length of output: 50378


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
import json

with open("spec/partiful.openapi.json", encoding="utf-8") as f:
    spec = json.load(f)

paths = [
    ("/v1/accounts:signInWithCustomToken", "signInWithCustomToken"),
    ("/v1/token", "refreshToken"),
    ("/v1/accounts:lookup", "lookupFirebaseUser"),
]

for path, operation_id in paths:
    operation = spec["paths"][path]["post"]
    print(operation_id)
    for parameter in operation.get("parameters", []):
        print(" ", {
            "name": parameter.get("name"),
            "in": parameter.get("in"),
            "required": parameter.get("required"),
        })

def current_rejects(parameters):
    return any(parameter.get("name") == "Origin" for parameter in parameters)

def proposed_rejects(parameters):
    return any(
        isinstance(parameter.get("name"), str)
        and parameter["name"].lower() == "origin"
        for parameter in parameters
    )

cases = [
    [{"name": "Origin", "in": "header"}],
    [{"name": "origin", "in": "header"}],
    [{"name": "ORIGIN", "in": "header"}],
    [{"name": "origin", "in": "query"}],
    [{"name": "Referer", "in": "header"}],
]

print("predicate comparison")
for parameters in cases:
    print({
        "parameters": parameters,
        "current_rejects": current_rejects(parameters),
        "proposed_rejects": proposed_rejects(parameters),
    })
PY

Repository: KalebCole/partiful-cli

Length of output: 928


Match Origin header names case-insensitively.

A modeled origin or ORIGIN header bypasses this check. Compare p.name?.toLowerCase() with "origin".

🤖 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 701 - 705, Update the Origin
parameter lookup in the firebaseOps validation loop to compare header names
case-insensitively, using p.name?.toLowerCase() against "origin", so modeled
origin, Origin, or ORIGIN headers are all detected and rejected.

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

Copilot-Session: 8453c76f-a887-4fce-be42-d7997ed94292
@KalebCole
KalebCole merged commit b396db6 into main Aug 11, 2026
2 checks passed
@KalebCole
KalebCole deleted the spec/163-auth-transport-correction branch August 11, 2026 06:11
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