Identity Claims v1 + RLS everywhere + base-integrity guard (canonical) - #1
Conversation
…e edits Phase 2 composition seam: an AdminPlugin dropped in src/plugins/ is now auto-registered, so a side-module (e.g. the warden console) composes in WITHOUT editing admin-config.ts or any base file. - scripts/generate-plugin-registry.mjs: scans src/plugins/ and writes a static registry barrel (registry.generated.ts). Static output (no require.context / import.meta.glob) so it works identically under Next (webpack/turbopack) and the vitest (Vite) suite. Wired to predev/prebuild/pretest. - admin-config.ts: composes buildAdminConfig(discoveredPlugins) — no manual list. - src/plugins/__tests__/registry.test.ts: enforces the registry is current (one AdminPlugin per plugin file) + names unique. - vitest.config.ts: scope to src unit tests (include src/**/*.test) so vitest stops collecting the Playwright tests/e2e specs (upstream of the warden-copy fix). FE suite green: 26 files, 205 tests (incl. the registry test). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The saas-starter is composed into each consumer by codefly install/sync (a copy). A copy only stays faithful by discipline, so make the discipline mechanical: tools/base-integrity.mjs records a sha256 manifest of every base file (generated FROM canonical, shipped into consumers via sync). `check` re-hashes those files and fails on any modified/missing base file; files not in the manifest are legal side-additions. Same command both sides: in canonical it keeps the manifest current (edit a base file without regen → CI red); in a consumer it proves no-drift. Also promotes a generic tsconfig exclude (tests/e2e) that had been a consumer-local edit, and adds a base-integrity CI job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d .gitignore - A consumer may compose a SUBSET of the base's services (mind takes the backend + frontend but brings its own gateway, omitting auth-sidecar). The guard now reads module.codefly.yaml's `services:` and skips files under non-composed services — they're legitimately absent, not "missing". module-level files stay fully enforced. - Exclude build artifacts from the manifest (*.tsbuildinfo, test-results/, playwright-report/) — they were polluting it via filesystem walk. - Add a frontend .gitignore so the web foundation is self-contained (node_modules/ .next/etc.) instead of relying on a per-machine global gitignore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
global-setup + playwright.config hardcoded the api's REST/Connect ports (5962/ 44790) — only correct in this workspace's hash. A consumer (warden, mind) hashes to different ports, so the readiness probe and the frontend→api env wiring missed. Now both resolve via the SDK: global-setup uses readyService:"api" (withDependencies resolves the REST address), and playwright.config resolves REST+Connect via resolveServiceAddressSync for the webServer env. Also exclude next-env.d.ts (a Next-generated file) from the base-integrity manifest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dev-admin seeding called Store().AddTeamMember directly with no tenant context, so the org-scoped team_members RLS policy rejected the insert (SQLSTATE 42501) — team memberships were silently dropped. Wrap it in Store().WithBypass, the same audited bootstrap-bypass RegisterUser/GrantPlatformRole already use. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
handleFixtureLogin did window.location.href="/" — a full reload that drops the
in-memory authed state login() just set and forces a cross-origin /v1/auth/refresh
round-trip to re-establish it. When the FE and api are on different ports (the
e2e direct-to-api setup), the user landed back on /auth/login. Use router.push("/")
so the root AuthProvider state is preserved and the dashboard renders immediately.
Turns 2+ admin-flow e2e tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The e2e hardcoded the frontend port (21931) and api ports across playwright.config + global-setup. Those are workspace-hash-derived (the frontend's real codefly address is e.g. :10571, not :21931), so hardcoding only works in the authoring workspace. Now every address is resolved via `codefly get endpoints` (resolveServiceAddressSync) and the config THROWS if resolution fails rather than guessing. The browser talks same-origin to the frontend's resolved URL; next.config rewrites proxy /v1/* + /customers.* to the api's resolved ports (first-party cookies). Prod-build webServer too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
💳 Subscription Requiredcodefly-dev has used all free reviews this month. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThree independent workstreams: (1) A new ChangesBase-file integrity tooling and CI enforcement
Frontend plugin auto-discovery and E2E codefly wiring
API fixture seed RLS bypass
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
What
Promotes the generic identity + RLS improvements into the canonical saas-starter — the single source of truth every consumer (warden, mind) derives from. These changes were originally made inline in the warden copy; per the "fix the original module" rule they belong upstream here, after which consumers re-derive cleanly.
Contents (8 commits)
Principal.created_by(41), claims on validate (team paths / roles / attributes), org-scoped revoke, plaintext-to-server validate (key_hash→key).plugins/*.ts, so side-modules (e.g. the warden console) register with zero base edits.tools/base-integrity.mjs(sha256 manifest); consumers ADD files, never modify the base. Composition-aware (a consumer may compose a service subset). Wired into CI; later folded intocodefly verify.Verification (local, this machine)
go build/vet✓ · fullgo test ./... -count=1green incl.infraPostgres/RLS (Docker up)vitest— 26 files / 205 tests ✓codefly verify— base intact, 744 base files ✓🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Infrastructure & Testing