-
Notifications
You must be signed in to change notification settings - Fork 64
Add Router Forms MVP #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
207f04f
feat: add Router Forms MVP
brijr 34827c1
fix: harden Router Forms lifecycle
brijr cec0d0a
fix: track Next.js type declarations
brijr eac46f1
fix: close Router Forms review gaps
brijr 93c4796
fix: address Router Forms review findings
brijr 426e9c9
fix: address Router Forms review findings
brijr 058e467
fix: close Router Forms review findings
brijr 7207dd5
fix: resolve final forms review findings
brijr bd8377f
fix: close remaining forms review findings
brijr f8c65c7
fix: close final forms review findings
brijr 9f6dea7
fix: resolve forms review findings
brijr d72b0e7
fix: resolve latest forms review findings
brijr 283e96b
fix: close remaining forms review gaps
brijr 4e7fa0f
Fix form compatibility, usage alerts, and loading announcements
brijr 1ed76ad
Fix validation errors for prototype-named fields
brijr 7de62dd
Fix review findings and unblock WordPress runtime CI
brijr 12e699d
Support local PostgreSQL through Neon's wsproxy in development
brijr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| application: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.15.9 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm lint | ||
| - run: pnpm typecheck | ||
| - run: pnpm test:unit | ||
| - name: Credential-free production build | ||
| run: pnpm build | ||
| env: | ||
| AUTH_SECRET: credential-free-build-secret-for-ci-only | ||
| FORM_SUBMISSION_SECRET: credential-free-form-secret-for-ci-only | ||
| FORM_RATE_LIMIT_SECRET: credential-free-rate-secret-for-ci-only | ||
| - run: pnpm check:server-actions | ||
|
|
||
| postgres: | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
| env: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: router_test | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd "pg_isready -U postgres" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.15.9 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - name: Apply forward migrations | ||
| env: | ||
| PGURL: postgresql://postgres:postgres@localhost:5432/router_test | ||
| run: | | ||
| chmod +x scripts/test-forward-migrations.sh | ||
| scripts/test-forward-migrations.sh | ||
| - run: pnpm test:db | ||
| env: | ||
| TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/router_test | ||
|
|
||
| browser: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.15.9 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm exec playwright install --with-deps chromium | ||
| - run: pnpm test:browser | ||
|
|
||
| wordpress: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: "7.4" | ||
| - run: chmod +x integrations/wordpress/check.sh integrations/wordpress/package.sh | ||
| - run: integrations/wordpress/check.sh | ||
|
|
||
| wordpress-runtime: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 25 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: [".wp-env.6.6.json", ".wp-env.latest.json"] | ||
| theme: ["twentytwentyfour", "twentytwentyone"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.15.9 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm exec playwright install --with-deps chromium | ||
| - run: pnpm exec wp-env start --config="${{ matrix.config }}" --update | ||
| - run: chmod +x integrations/wordpress/test-matrix.sh | ||
| - run: integrations/wordpress/test-matrix.sh "${{ matrix.config }}" "${{ matrix.theme }}" | ||
| - if: always() | ||
| run: pnpm exec wp-env stop --config="${{ matrix.config }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "$schema": "https://schemas.wp.org/trunk/wp-env.json", | ||
| "core": "WordPress/WordPress#6.6", | ||
| "phpVersion": "8.2", | ||
| "plugins": [ | ||
| "./integrations/wordpress/router-forms", | ||
| "./integrations/wordpress/test-fixtures/router-forms-test-api" | ||
| ], | ||
| "testsEnvironment": false, | ||
| "port": 8888 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "$schema": "https://schemas.wp.org/trunk/wp-env.json", | ||
| "core": null, | ||
| "phpVersion": "8.2", | ||
| "plugins": [ | ||
| "./integrations/wordpress/router-forms", | ||
| "./integrations/wordpress/test-fixtures/router-forms-test-api" | ||
| ], | ||
| "testsEnvironment": false, | ||
| "port": 8888 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { normalizePostHogHost } from "../lib/analytics/server"; | ||
|
|
||
| describe("PostHog server analytics", () => { | ||
| it("normalizes a documented bare host to an absolute HTTPS URL", () => { | ||
| expect(normalizePostHogHost("app.posthog.com")).toBe( | ||
| "https://app.posthog.com" | ||
| ); | ||
| }); | ||
|
|
||
| it("preserves an explicit protocol and proxy path", () => { | ||
| expect(normalizePostHogHost("http://localhost:3000/ingest/")).toBe( | ||
| "http://localhost:3000/ingest" | ||
| ); | ||
| }); | ||
|
|
||
| it("rejects unsupported protocols", () => { | ||
| expect(() => normalizePostHogHost("ftp://posthog.example")).toThrow( | ||
| "HTTP or HTTPS" | ||
| ); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { readFileSync } from "node:fs"; | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| describe("scheduled maintenance", () => { | ||
| it("runs form rate-bucket pruning at least hourly", () => { | ||
| const config = JSON.parse(readFileSync("vercel.json", "utf8")) as { | ||
| crons: Array<{ path: string; schedule: string }>; | ||
| }; | ||
|
|
||
| expect(config.crons).toContainEqual({ | ||
| path: "/api/cron/forms-maintenance", | ||
| schedule: "17 * * * *", | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.