fix(stats): login loop, telemetry, collection dashboard, auto-deploy - #1010
Open
lane711 wants to merge 8 commits into
Open
fix(stats): login loop, telemetry, collection dashboard, auto-deploy#1010lane711 wants to merge 8 commits into
lane711 wants to merge 8 commits into
Conversation
Without CACHE_KV, withCloudflare had kv=undefined — session writes silently failed, causing a login-success → redirect → "please login" loop on stats.sonicjs.com. Reuses the shared KV namespace (a16f8246fc294d809c90b0fb2df6d363) for both default and production envs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…anges Removes the path filter so stats.sonicjs.com always runs the latest version of @sonicjs-cms/core after any merge to main. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wrangler >=4 requires Node >=22. Lock file was also out of sync with current esbuild/emnapi versions; npm install resolves fresh rather than failing on the stale lock file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oard - Removes LIMIT 20 / slice(15) so all collections appear in the table - Sorts by installations desc (most-adopted first) — chart still capped at top 20 - Adds "Custom Collections" side-by-side card: filters to installations = 1 (user-defined collections unique to one install), sorted by doc count - Both tables are scrollable (max-h-96) so the page doesn't balloon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ding bootstrap.ts read c.env.KV but the binding is named CACHE_KV in wrangler.toml. KV was always undefined → installationId defaulted to 'unknown' on every project_snapshot event, making per-installation analytics useless. Falls back to c.env.KV for any deployment that uses the legacy name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SQL bug: HAVING created_at = MAX(created_at) picked collection_counts arbitrarily (SQLite GROUP BY semantics) — most snapshot rows were silently dropped. Now reads collection_names from every snapshot row directly. Logic bug: "installations = 1" as the custom filter was wrong since all existing snapshots carry installation_id='unknown', collapsing them all into one fake installation. Replaced with a SYSTEM_COLLECTIONS exclusion set (menu_item, plugin, plugin_activity, rbac_role, rbac_verb, rbac_user_roles, content, media) — everything else is user-defined. System collections shown dimmed with [sys] label in the All Collections table so they're still visible but visually deprioritized. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Captures the scheme+host of the first cold-start request so the stats dashboard can show which domains are running SonicJS. No path, query string, or user data is collected — only the origin (e.g. "https://example.com"). Dashboard adds a "Deployed Sites" table showing all unique origins + snapshot counts. Hidden when no deploy_url data exists yet. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- plugin-middleware.test.ts: call invalidatePluginStatusCache() in each beforeEach so module-level _pluginStatusCache is cleared between tests - document-scalar-schema.ts: export resetScalarSchemaCache() to let test harnesses reset the per-isolate PRAGMA cache when a fresh DB is created - d1-sqlite.ts: call resetScalarSchemaCache() in createTestD1() so each fresh :memory: DB starts with a clean column cache - migrations-d45.test.ts: add beforeEach resetScalarSchemaCache() (test creates its own DB directly, not via createTestD1) - table-sorting.test.ts: fix broken import from @sonicjs-cms/core/templates (unbuilt dist) → relative source path ../../templates/table.template - catalog.ts: scheduleKvWrite accepts null/undefined ctx so route-level calls don't throw in environments without executionCtx - api.ts: add tryCtx() helper that safely accesses c.executionCtx, replacing all 9 raw c.executionCtx args to scheduleKvWrite Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CACHE_KVKV binding topackages/stats/wrangler.toml(Better Auth requires it for session storage)unknown— read fromCACHE_KV ?? KVinstead of missingKVbindingdeploy_url(origin only) toproject_snapshottelemetrydeploy_urlsnapshotspathsfilter from deploy workflow, bump to Node 22,npm installovernpm ciCI test fixes (25 failures → 0)
plugin-middleware.test.ts: callinvalidatePluginStatusCache()in eachbeforeEach— module-level_pluginStatusCacheMap was never cleared between testsdocument-scalar-schema.ts: exportresetScalarSchemaCache()— module-level_columnCache/_indexCache/_cacheInitPromisepersisted across fresh:memory:DB instancesd1-sqlite.ts: callresetScalarSchemaCache()increateTestD1()so every fresh test DB starts with a clean PRAGMA cachemigrations-d45.test.ts: addbeforeEachreset (creates own DB, not viacreateTestD1)table-sorting.test.ts: fix broken import@sonicjs-cms/core/templates(unbuilt dist) → relative source pathcatalog.ts:scheduleKvWriteacceptsnull | undefinedctxapi.ts: addtryCtx()helper to safely accessc.executionCtx(throws in test environments without ExecutionContext) — fixes 500 in cache integration testTest plan
🤖 Generated with Claude Code