From c0e3c17b703afa0f92c288e083b3383109daba9d Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 19 Mar 2026 01:05:53 -0700 Subject: [PATCH] fix: map JSONL field names to Postgres columns in telemetry-sync Local JSONL uses short names (v, ts, sessions) but the Supabase table expects full names (schema_version, event_timestamp, concurrent_sessions). Add sed mapping during field stripping. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/gstack-telemetry-sync | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/gstack-telemetry-sync b/bin/gstack-telemetry-sync index 87561d6a..e12ada1b 100755 --- a/bin/gstack-telemetry-sync +++ b/bin/gstack-telemetry-sync @@ -75,8 +75,13 @@ while IFS= read -r LINE; do [ -z "$LINE" ] && continue echo "$LINE" | grep -q '^{' || continue - # Strip _repo_slug and _branch (local-only fields) - CLEAN="$(echo "$LINE" | sed 's/,"_repo_slug":"[^"]*"//g; s/,"_branch":"[^"]*"//g')" + # Strip local-only fields + map JSONL field names to Postgres column names + CLEAN="$(echo "$LINE" | sed \ + -e 's/,"_repo_slug":"[^"]*"//g' \ + -e 's/,"_branch":"[^"]*"//g' \ + -e 's/"v":/"schema_version":/g' \ + -e 's/"ts":/"event_timestamp":/g' \ + -e 's/"sessions":/"concurrent_sessions":/g')" # If anonymous tier, strip installation_id if [ "$TIER" = "anonymous" ]; then