Skip to content

fix: apply lint and test fixes for waitlist and firestore packages#6

Merged
amondnet merged 5 commits into
mainfrom
amondnet/plural-pewter
Mar 24, 2026
Merged

fix: apply lint and test fixes for waitlist and firestore packages#6
amondnet merged 5 commits into
mainfrom
amondnet/plural-pewter

Conversation

@amondnet

@amondnet amondnet commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Applied ESLint auto-fix on @please-auth/waitlist package (5181 style errors: tabs to spaces, double to single quotes, remove semicolons) and manually fixed one remaining tab in error-codes.ts
  • Added --passWithNoTests flag to vitest run in @please-auth/firestore so CI passes when no test files exist yet
  • Fixed client.ts status method that was double-wrapping query params; updated signature from (data: { token: string }) to (data: { query: { token: string } }) and extracted data.query before passing to $fetch

Test Plan

  • Lint passes: pnpm lint in packages/waitlist
  • Tests pass: pnpm test in both packages/waitlist and packages/firestore
  • Build passes: pnpm build in packages/waitlist

Summary by cubic

Fixes query param handling in the @please-auth/waitlist client and ensures @please-auth/firestore tests pass when empty. CI now uses Node.js 24 for node:sqlite and makes Codecov upload non-blocking.

  • Bug Fixes

    • @please-auth/waitlist: Fixed client.ts status method that double-wrapped query params; signature is now (data: { query: { token: string } }) and passes data.query to the fetch call. Updated status() docs and examples.
    • @please-auth/firestore: Added --passWithNoTests to vitest run so CI passes when the package has no tests.
    • CI: Use Node.js 24 in tests to support node:sqlite and set Codecov upload to non-blocking.
  • Migration

    • Update client calls: replace auth.waitlist.status({ token }) with auth.waitlist.status({ query: { token } }).

Written for commit 71e1254. Summary will update on new commits.

- Auto-fix 5181 ESLint style errors in @please-auth/waitlist
  (tabs to spaces, double to single quotes, remove semicolons)
- Manually fix remaining tab character in error-codes.ts
- Add --passWithNoTests flag to firestore vitest run
- Fix client.ts status method double-wrapping query params
  Change signature to (data: { query: { token: string } })
  and extract data.query before passing to $fetch

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/waitlist/src/client.ts">

<violation number="1" location="packages/waitlist/src/client.ts:64">
P1: The new `status` parameter shape is not backward-compatible and can silently drop the token for existing `{ token }` callers. Accept both shapes or normalize input before building the query.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant App as Application / UI
    participant Client as Waitlist Client
    participant Hook as Waitlist Middleware (Hook)
    participant API as Waitlist API Endpoints
    participant DB as Database (Adapter)

    Note over App,DB: Waitlist Status Check (Bug Fix)

    App->>Client: CHANGED: status({ query: { token } })
    Client->>Client: Extract query object from data
    Client->>API: GET /waitlist/status (with query params)
    API->>DB: findOne({ lookupToken: token })
    DB-->>API: Waitlist Entry
    API-->>App: { status: "pending" | "approved" | ... }

    Note over App,DB: Registration Gate (Core Architectural Flow)

    App->>Hook: POST /sign-up/email
    Hook->>Hook: Match path in interceptPaths
    Hook->>DB: findUserByEmail(email)
    
    alt User is new (Waitlist Check)
        Hook->>DB: findOne({ email, status: "approved" })
        DB-->>Hook: Result
        
        alt Not Approved
            Hook-->>App: 403 Forbidden (NOT_APPROVED)
        else Approved
            Hook-->>App: Allow Registration Proceed
        end
    else User Exists (Login)
        Hook-->>App: Allow Login Proceed
    end

    Note over App,DB: Admin Action (Context)

    App->>API: POST /waitlist/approve { email }
    API->>API: Verify Admin Session/Role
    API->>DB: update(status: "approved", inviteCode: UUID)
    DB-->>API: Updated Entry
    opt sendInviteEmail configured
        API->>API: Trigger Email Service
    end
    API-->>App: 200 OK (Updated Entry)
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread packages/waitlist/src/client.ts Outdated
Update the @example in waitlistClient() to reflect the corrected
status() signature: { query: { token } } instead of { token }.
@amondnet amondnet self-assigned this Mar 24, 2026
better-auth's getTestInstance uses node:sqlite (Node.js 22.5+ built-in
module). CI test job was failing because Node.js was not explicitly
installed. Add actions/setup-node with node-version 22 to the test job.
- Upgrade Node.js from 22 to 24 for test job
- Set fail_ci_if_error to false for Codecov upload since the repository
  may not be configured on Codecov yet
@amondnet
amondnet merged commit c9b403f into main Mar 24, 2026
4 checks passed
@amondnet
amondnet deleted the amondnet/plural-pewter branch March 24, 2026 05: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