Filed from #14113 (aggregation-alias escaping on the Turso remote transport). Same defect class, the other output-name position in the same method, not fixed by that card — it carries a landed pin asserting the current behaviour, so reversing it needs its own judgement rather than a rider.
What
RemoteTransport.aggregate (packages/drivers/driver-turso/src/remote-transport.ts) has exactly two positions that emit a caller-supplied output NAME:
selectParts.push(outKey === field ? `"${field}"` : `"${field}" AS "${outKey}"`); // groupBy alias
selectParts.push(`${lowering.sql}(${argSql}) AS ${this.aliasIdentifierSql(alias)}`); // aggregation alias
#14113 moved the aggregation alias to escaping (quote doubled, assertSafeIdentifier dropped from that position only). The groupBy alias (outKey, which is g.alias ?? g.field) still goes through assertSafeIdentifier, so any groupBy alias that is not a bare [A-Za-z_][A-Za-z0-9_]* is refused with a bare Error — no code, no status, an opaque 500 out of mapDataError.
Why it is a divergence
driver-sql post-#13714 routes both positions through SqlDriver.aliasIdentifierSql:
sql-driver.ts groupBy select site — ?? as ${this.aliasIdentifierSql(outKey)}sql-driver.ts aggregation select sites — ${lowering.sql}(*) as ${this.aliasIdentifierSql(agg.alias)}- and the window-function alias site
So after #14113 the Turso remote face agrees with the SQL face on the aggregation alias and still disagrees on the groupBy alias. GroupByNodeSchema.alias is an output-column key, the same class of thing as AggregationNodeSchema.alias, and the in-memory path projects g.alias ?? g.field verbatim.
Why it was NOT patched inline under #14113
The position carries a landed pin that asserts the refusal:
packages/drivers/driver-turso/src/remote-transport-groupby-node.test.ts — [#6401] refuses an unsafe identifier in \alias`, not only in `field`, asserting unsafe identifier rejected` and the offending text.
That pin was a deliberate call at #6401, when the alias was newly read here. Reversing it is a judgement about the same reference-versus-name line #13714 and #14113 drew, not a mechanical edit, so it is filed rather than folded into a card dispatched for the aggregation position. #14113 leaves a regression control pinning this position's current behaviour, so the state cannot drift silently while this card is open.
Exposure
⚠️ Lower than #14113's, and measured rather than assumed: no analytics query sends a dotted groupBy alias. ObjectQLStrategy.resolveFieldName resolves a dimension to member.sql or member.split('.')[1], so dimensions reach the driver as bare column names; only the measure arrives as CUBE.MEASURE. The reachable population is a caller writing groupBy: [{ field: 'region', alias: 'Region Name' }] through the Query Protocol directly, which works on the in-memory, MongoDB and SQL faces and is an opaque 500 on Turso remote.
Acceptance
Either escape the groupBy alias the way #14113 escaped the aggregation alias (and rewrite the #6401 pin to assert the new truth, as #14113 did not have to), or rule that this position stays gated and record why the two output-name positions differ. Either way the two faces should stop disagreeing silently.
Generated by Claude Code
Filed from #14113 (aggregation-alias escaping on the Turso remote transport). Same defect class, the other output-name position in the same method, not fixed by that card — it carries a landed pin asserting the current behaviour, so reversing it needs its own judgement rather than a rider.
What
RemoteTransport.aggregate(packages/drivers/driver-turso/src/remote-transport.ts) has exactly two positions that emit a caller-supplied output NAME:#14113 moved the aggregation alias to escaping (quote doubled,
assertSafeIdentifierdropped from that position only). The groupBy alias (outKey, which isg.alias ?? g.field) still goes throughassertSafeIdentifier, so any groupBy alias that is not a bare[A-Za-z_][A-Za-z0-9_]*is refused with a bareError— nocode, nostatus, an opaque 500 out ofmapDataError.Why it is a divergence
driver-sqlpost-#13714 routes both positions throughSqlDriver.aliasIdentifierSql:sql-driver.tsgroupBy select site —?? as ${this.aliasIdentifierSql(outKey)}sql-driver.tsaggregation select sites —${lowering.sql}(*) as ${this.aliasIdentifierSql(agg.alias)}So after #14113 the Turso remote face agrees with the SQL face on the aggregation alias and still disagrees on the groupBy alias.
GroupByNodeSchema.aliasis an output-column key, the same class of thing asAggregationNodeSchema.alias, and the in-memory path projectsg.alias ?? g.fieldverbatim.Why it was NOT patched inline under #14113
The position carries a landed pin that asserts the refusal:
packages/drivers/driver-turso/src/remote-transport-groupby-node.test.ts—[#6401] refuses an unsafe identifier in \alias`, not only in `field`, assertingunsafe identifier rejected` and the offending text.That pin was a deliberate call at #6401, when the alias was newly read here. Reversing it is a judgement about the same reference-versus-name line #13714 and #14113 drew, not a mechanical edit, so it is filed rather than folded into a card dispatched for the aggregation position. #14113 leaves a regression control pinning this position's current behaviour, so the state cannot drift silently while this card is open.
Exposure
ObjectQLStrategy.resolveFieldNameresolves a dimension tomember.sqlormember.split('.')[1], so dimensions reach the driver as bare column names; only the measure arrives asCUBE.MEASURE. The reachable population is a caller writinggroupBy: [{ field: 'region', alias: 'Region Name' }]through the Query Protocol directly, which works on the in-memory, MongoDB and SQL faces and is an opaque 500 on Turso remote.Acceptance
Either escape the groupBy alias the way #14113 escaped the aggregation alias (and rewrite the #6401 pin to assert the new truth, as #14113 did not have to), or rule that this position stays gated and record why the two output-name positions differ. Either way the two faces should stop disagreeing silently.
Generated by Claude Code