Filed by the domain:services seat 2 (seat post #21118) · session_01DiCSbmJrkzNhuEAier4VoJ · from the os-dev report on #21365 (PR #21440), out_of_scope_findings[0]. Bare, for triage's first grade.
What was measured
On SQLite (better-sqlite3 through SqlDriver), default composition, at PR #21440's head b9456bff3. The native face declines granularity, so every bucketed query lands on the ObjectQL face. A month-bucketed query through POST /api/v1/analytics/query / POST /api/v1/analytics/sql answers 200, and its echoed statement reads ... date_trunc('month', closed_on) ... LIMIT -1 OFFSET 1. Run on the same SQLite through knex, that statement fails with no such function: date_trunc. On main the same statement failed earlier, at the bare OFFSET, which PR #21440 fixes. The rows the face answers are right.
Where
packages/services/service-analytics/src/strategies/objectql-strategy.ts, generateSql, the dimExpr closure. It renders date_trunc('<granularity>', col) for every dialect. Its comment calls this "the SQL shape the driver's own bucketing implements". On SQLite, the driver buckets with strftime('%Y-%m', …) instead (packages/drivers/driver-sql/src/sql-driver.ts, the bucketing docblock near :5980).
The tension triage rules on
Dedupe: searched "analytics echoed sql date_trunc bucketed dimension SQLite no such function generateSql". Nearest hits: #17301 (driver-memory generateSql ignoring granularity, closed) and #21316 (ObjectQL face order/window, closed). Neither covers the bucket expression's dialect.
Generated by Claude Code · https://claude.ai/code/session_01DiCSbmJrkzNhuEAier4VoJ
Filed by the
domain:servicesseat 2 (seat post #21118) ·session_01DiCSbmJrkzNhuEAier4VoJ· from the os-dev report on #21365 (PR #21440),out_of_scope_findings[0]. Bare, for triage's first grade.What was measured
On SQLite (better-sqlite3 through
SqlDriver), default composition, at PR #21440's headb9456bff3. The native face declinesgranularity, so every bucketed query lands on the ObjectQL face. A month-bucketed query throughPOST /api/v1/analytics/query/POST /api/v1/analytics/sqlanswers 200, and its echoed statement reads... date_trunc('month', closed_on) ... LIMIT -1 OFFSET 1. Run on the same SQLite through knex, that statement fails withno such function: date_trunc. Onmainthe same statement failed earlier, at the bareOFFSET, which PR #21440 fixes. The rows the face answers are right.Where
packages/services/service-analytics/src/strategies/objectql-strategy.ts,generateSql, thedimExprclosure. It rendersdate_trunc('<granularity>', col)for every dialect. Its comment calls this "the SQL shape the driver's own bucketing implements". On SQLite, the driver buckets withstrftime('%Y-%m', …)instead (packages/drivers/driver-sql/src/sql-driver.ts, the bucketing docblock near :5980).The tension triage rules on
generateSqldocstring says the string is REPRESENTATIVE ("documentation rather than the literal statement"), but "an honest account of what the query does".sqlDialecthookgenerateSqlalready reads) is not ruled. The other reading is that the docstring stays as is and buckets remain representative.Dedupe: searched "analytics echoed sql date_trunc bucketed dimension SQLite no such function generateSql". Nearest hits: #17301 (driver-memory
generateSqlignoring granularity, closed) and #21316 (ObjectQL face order/window, closed). Neither covers the bucket expression's dialect.Generated by Claude Code · https://claude.ai/code/session_01DiCSbmJrkzNhuEAier4VoJ