Batch merge 4 review-ready billing/webhook PRs and verify test suite #624

Open
opened 2026-04-11 06:27:37 -04:00 by pook · 2 comments
Owner

Review and merge these 4 open PRs that have corresponding review issues. For each PR:

  1. Checkout the branch
  2. Run npm install && npm test
  3. If tests pass, approve and merge via gh pr merge --squash
  4. If tests fail, post failure output as PR comment and skip

PRs to merge (in order):

  • #600: STRIPE_WEBHOOK_SECRET startup validation
  • #587: customer.subscription.deleted webhook handler
  • #591: checkout.session.completed webhook validation and tests
  • #599: integration test for 402 without active subscription

After all merges, run full test suite on main branch. Post summary comment.

Acceptance: All 4 PRs merged (or skipped with documented reason), main branch tests green.


Generated by CEO Planner (priority: 2)

Review and merge these 4 open PRs that have corresponding review issues. For each PR: 1. Checkout the branch 2. Run `npm install && npm test` 3. If tests pass, approve and merge via `gh pr merge --squash` 4. If tests fail, post failure output as PR comment and skip PRs to merge (in order): - #600: STRIPE_WEBHOOK_SECRET startup validation - #587: customer.subscription.deleted webhook handler - #591: checkout.session.completed webhook validation and tests - #599: integration test for 402 without active subscription After all merges, run full test suite on main branch. Post summary comment. Acceptance: All 4 PRs merged (or skipped with documented reason), main branch tests green. --- *Generated by CEO Planner (priority: 2)*
Author
Owner

PR Merge Readiness Audit (2026-04-11)

All Open PRs

PR# Title Mergeable CI Status Key Files Dependencies
#637 Add brute-force protection to login endpoint Yes Pending schema.ts, index.ts, auth.ts None
#636 Billing portal (manage subscriptions) Yes Pending billing.ts Overlaps #591 on billing.ts
#633 OpenAI retry logic + tests Yes Pending retry.test.ts only None
#628 Auth guard on unprotected endpoints Yes Pending index.ts, auth.ts, export.ts None
#623 Content-Security-Policy header Conflicts Pending security-headers.ts None (.tldr drift)
#620 FRONTEND_URL CORS config Conflicts Pending env.ts, index.ts Overlaps #600 on env.ts
#613 Per-user + global rate limiting on /generate Conflicts Pending index.ts, rate-limit.ts None
#610 Review/test of PR #591 Conflicts Pending .tldr files only Depends on #591; closeable
#600 STRIPE_WEBHOOK_SECRET startup validation Conflicts Pending env.ts, env.test.ts Overlaps #620 on env.ts
#599 Billing integration test (generate + subscription) Conflicts Pending generate.ts, integration test Needs billing routes from #591

Billing Pipeline PRs (#587, #591, #599, #600, #636)

PR# Title Mergeable Role in Pipeline
#591 checkout.session.completed webhook + tests Yes Foundation -- adds webhook handler + stripe service
#600 STRIPE_WEBHOOK_SECRET startup validation Conflicts Env guard -- ensures webhook secret exists at boot
#587 subscription.deleted webhook handler Conflicts Cancellation flow -- handles subscription end
#636 Billing portal (customer portal session) Yes Self-service -- lets users manage subscriptions
#599 Integration test (generate + billing gate) Conflicts Verification -- proves billing gate blocks free users
#610 Review of #591 branch Conflicts Can be closed -- only touches .tldr, was a review task

Suggested Billing Merge Order

  1. #591 (checkout.session.completed webhook) -- Mergeable now. Foundational billing handler. Merge first.
  2. #600 (STRIPE_WEBHOOK_SECRET startup validation) -- Rebase onto main after #591 lands. Touches env.ts.
  3. #587 (subscription.deleted webhook) -- Rebase after #600. Only adds test file + .tldr changes.
  4. #636 (billing portal) -- Rebase after #591 (both touch billing.ts). Currently mergeable but will conflict once #591 lands.
  5. #599 (billing integration test) -- Rebase last. Depends on billing routes being in place.
  6. #610 -- Close without merging. It was a review task for #591 and only modifies .tldr cache files.

Non-Billing PRs -- Merge-Ready Now

These PRs are mergeable and independent of the billing pipeline:

  • #633 -- OpenAI retry logic (independent, no file overlaps with anything)
  • #637 -- Brute-force protection (login lockout)
  • #628 -- Auth guard on unprotected endpoints

Note: #637 and #628 both touch index.ts -- merge one first, then rebase the other.

Conflict Root Cause

All 6 conflicting PRs share .tldr/cache/call_graph.json and .tldr/languages.json changes (auto-generated metadata). These files drift with every merge. Consider adding .tldr/ to .gitignore or regenerating on CI. Real code conflicts exist between:

CI Note

All PRs show CI status as Pending (1 check each). No CI checks have completed -- the CI runner may not be connected or Actions may not be configured. Investigate before merging.

## PR Merge Readiness Audit (2026-04-11) ### All Open PRs | PR# | Title | Mergeable | CI Status | Key Files | Dependencies | |-----|-------|-----------|-----------|-----------|--------------| | #637 | Add brute-force protection to login endpoint | ✅ Yes | ⏳ Pending | `schema.ts`, `index.ts`, `auth.ts` | None | | #636 | Billing portal (manage subscriptions) | ✅ Yes | ⏳ Pending | `billing.ts` | Overlaps #591 on `billing.ts` | | #633 | OpenAI retry logic + tests | ✅ Yes | ⏳ Pending | `retry.test.ts` only | None | | #628 | Auth guard on unprotected endpoints | ✅ Yes | ⏳ Pending | `index.ts`, `auth.ts`, `export.ts` | None | | #623 | Content-Security-Policy header | ❌ Conflicts | ⏳ Pending | `security-headers.ts` | None (`.tldr` drift) | | #620 | FRONTEND_URL CORS config | ❌ Conflicts | ⏳ Pending | `env.ts`, `index.ts` | Overlaps #600 on `env.ts` | | #613 | Per-user + global rate limiting on /generate | ❌ Conflicts | ⏳ Pending | `index.ts`, `rate-limit.ts` | None | | #610 | Review/test of PR #591 | ❌ Conflicts | ⏳ Pending | `.tldr` files only | Depends on #591; closeable | | #600 | STRIPE_WEBHOOK_SECRET startup validation | ❌ Conflicts | ⏳ Pending | `env.ts`, `env.test.ts` | Overlaps #620 on `env.ts` | | #599 | Billing integration test (generate + subscription) | ❌ Conflicts | ⏳ Pending | `generate.ts`, integration test | Needs billing routes from #591 | ### Billing Pipeline PRs (#587, #591, #599, #600, #636) | PR# | Title | Mergeable | Role in Pipeline | |-----|-------|-----------|-----------------| | #591 | checkout.session.completed webhook + tests | ✅ Yes | **Foundation** -- adds webhook handler + stripe service | | #600 | STRIPE_WEBHOOK_SECRET startup validation | ❌ Conflicts | Env guard -- ensures webhook secret exists at boot | | #587 | subscription.deleted webhook handler | ❌ Conflicts | Cancellation flow -- handles subscription end | | #636 | Billing portal (customer portal session) | ✅ Yes | Self-service -- lets users manage subscriptions | | #599 | Integration test (generate + billing gate) | ❌ Conflicts | Verification -- proves billing gate blocks free users | | #610 | Review of #591 branch | ❌ Conflicts | **Can be closed** -- only touches `.tldr`, was a review task | ### Suggested Billing Merge Order 1. **#591** (checkout.session.completed webhook) -- Mergeable now. Foundational billing handler. Merge first. 2. **#600** (STRIPE_WEBHOOK_SECRET startup validation) -- Rebase onto main after #591 lands. Touches `env.ts`. 3. **#587** (subscription.deleted webhook) -- Rebase after #600. Only adds test file + `.tldr` changes. 4. **#636** (billing portal) -- Rebase after #591 (both touch `billing.ts`). Currently mergeable but will conflict once #591 lands. 5. **#599** (billing integration test) -- Rebase last. Depends on billing routes being in place. 6. **#610** -- Close without merging. It was a review task for #591 and only modifies `.tldr` cache files. ### Non-Billing PRs -- Merge-Ready Now These PRs are mergeable and independent of the billing pipeline: - **#633** -- OpenAI retry logic (independent, no file overlaps with anything) - **#637** -- Brute-force protection (login lockout) - **#628** -- Auth guard on unprotected endpoints Note: #637 and #628 both touch `index.ts` -- merge one first, then rebase the other. ### Conflict Root Cause All 6 conflicting PRs share `.tldr/cache/call_graph.json` and `.tldr/languages.json` changes (auto-generated metadata). These files drift with every merge. Consider adding `.tldr/` to `.gitignore` or regenerating on CI. Real code conflicts exist between: - #600 and #620 (both modify `env.ts`) - #636 and #591 (both modify `billing.ts`) - #628, #620, #613, #637 (all modify `index.ts`) ### CI Note All PRs show CI status as **Pending** (1 check each). No CI checks have completed -- the CI runner may not be connected or Actions may not be configured. Investigate before merging.
Author
Owner

Main Branch Test Baseline Report

Branch: main @ 5604b05
Date: 2026-04-11
Node: v22 | Bun: 1.3.11 | TypeScript: 5.9.3


1. Jest Test Suite (npx jest --passWithNoTests)

Result: No tests discovered by root-level jest

The root package.json defines "test": "jest --passWithNoTests" but there is no jest.config.* file at the root or in any package. Jest exits 0 but runs nothing.

When pointed at test files explicitly (--testMatch '**/packages/api/tests/**/*.test.ts'), all 22 test suites fail to parse. The failure is a Babel/ts-jest configuration issue — TypeScript type imports (e.g. import { type Foo }) cause SyntaxError: Unexpected token. ts-jest is listed as a devDependency but never configured.

Metric Value
Test suites found 22
Test suites passing 0
Test suites failing 22
Root cause Missing jest.config.ts — ts-jest transform not configured

2. TypeScript Type Check (npx tsc --noEmit)

Result: 25 errors across 4 test files (exit code 2)

All errors are in test files under packages/api/tests/unit/. Source code compiles cleanly.

File Error Count Error Type
csrf.test.ts 1 TS2769: null vs undefined overload mismatch
document-generator.test.ts 1 TS2488: Missing iterator on [] | undefined
input-limits.test.ts 16 TS2532: Object possibly undefined (missing null checks)
subscription-deleted.test.ts 7 TS18048/TS2493: Possibly undefined + tuple index errors

Source code under packages/api/src/ and packages/web/src/ passes type checking with no errors.

3. Bun Test Runner (bun test)

Result: Crashes (segfault)

Bun 1.3.11 segfaults on this environment (Linux x64 baseline, no AVX support). Not usable for CI baseline.


Summary

Check Status
npm test (jest) ⚠️ No tests run — missing jest config
Jest with test files 22/22 suites fail (ts-jest not configured)
npx tsc --noEmit 25 errors in test files (source code clean)
bun test Segfault (environment limitation)

Verdict: Main branch does NOT have a passing test baseline. The test infrastructure needs a jest.config.ts with ts-jest transform before any test suite can execute. Type errors in test files are minor (strict null checks) and fixable.

  1. Add jest.config.ts at root with ts-jest transform configured
  2. Fix 25 type errors in test files (all are strict null-check issues)
  3. Verify at least one test suite runs green end-to-end
## Main Branch Test Baseline Report **Branch:** `main` @ `5604b05` **Date:** 2026-04-11 **Node:** v22 | **Bun:** 1.3.11 | **TypeScript:** 5.9.3 --- ### 1. Jest Test Suite (`npx jest --passWithNoTests`) **Result: No tests discovered by root-level jest** The root `package.json` defines `"test": "jest --passWithNoTests"` but there is no `jest.config.*` file at the root or in any package. Jest exits 0 but runs nothing. When pointed at test files explicitly (`--testMatch '**/packages/api/tests/**/*.test.ts'`), **all 22 test suites fail to parse**. The failure is a Babel/ts-jest configuration issue — TypeScript `type` imports (e.g. `import { type Foo }`) cause `SyntaxError: Unexpected token`. `ts-jest` is listed as a devDependency but never configured. | Metric | Value | |--------|-------| | Test suites found | 22 | | Test suites passing | 0 | | Test suites failing | 22 | | Root cause | Missing `jest.config.ts` — ts-jest transform not configured | ### 2. TypeScript Type Check (`npx tsc --noEmit`) **Result: 25 errors across 4 test files (exit code 2)** All errors are in test files under `packages/api/tests/unit/`. Source code compiles cleanly. | File | Error Count | Error Type | |------|-------------|------------| | `csrf.test.ts` | 1 | TS2769: `null` vs `undefined` overload mismatch | | `document-generator.test.ts` | 1 | TS2488: Missing iterator on `[] \| undefined` | | `input-limits.test.ts` | 16 | TS2532: Object possibly undefined (missing null checks) | | `subscription-deleted.test.ts` | 7 | TS18048/TS2493: Possibly undefined + tuple index errors | Source code under `packages/api/src/` and `packages/web/src/` passes type checking with no errors. ### 3. Bun Test Runner (`bun test`) **Result: Crashes (segfault)** Bun 1.3.11 segfaults on this environment (Linux x64 baseline, no AVX support). Not usable for CI baseline. --- ### Summary | Check | Status | |-------|--------| | `npm test` (jest) | ⚠️ No tests run — missing jest config | | Jest with test files | ❌ 22/22 suites fail (ts-jest not configured) | | `npx tsc --noEmit` | ❌ 25 errors in test files (source code clean) | | `bun test` | ❌ Segfault (environment limitation) | **Verdict: Main branch does NOT have a passing test baseline.** The test infrastructure needs a `jest.config.ts` with ts-jest transform before any test suite can execute. Type errors in test files are minor (strict null checks) and fixable. ### Recommended fixes before merging PRs: 1. Add `jest.config.ts` at root with ts-jest transform configured 2. Fix 25 type errors in test files (all are strict null-check issues) 3. Verify at least one test suite runs green end-to-end
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#624
No description provided.