From 591b5936c1ce9aceed80ee1e5eb4dc0e3b87b3b1 Mon Sep 17 00:00:00 2001 From: Stacksbot Date: Sun, 12 Jul 2026 16:13:53 +0000 Subject: [PATCH] test(etl): stub Groups::Connector in sync_all rake test (fixes Heroku CI failure) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sync_all's sync_all test didn't stub Stacks::Etl::Groups::Connector when stacks:etl:sync_google_groups was wired into sync_all (50bd261). CI's own test run for stacks:etl:sync_all was therefore invoking the REAL connector, which fetched real Google Group threads and tried to index chunks — creating an Embedding record with the 'embedding' vector column. That column is added outside db/schema.rb specifically so schema:load works on Postgres without pgvector (Heroku CI's in-dyno Postgres), so the raw column write raised: ActiveModel::UnknownAttributeError: unknown attribute 'embedding' for Embedding. (surfaced in the ops thread via /app/lib/stacks/etl/connector.rb:54 → etl.rake:38 → test/lib/tasks/etl_rake_test.rb:37). Fix: stub Stacks::Etl::Groups::Connector#new/#run in the sync_all test, mirroring how the Meet sweeps are already stubbed via Stacks::Etl::Meet.expects(:sweep_all_users!) in the same test — so the test asserts sync_all's three-source wiring/order without touching Google or Embedding at all. --- test/lib/tasks/etl_rake_test.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/lib/tasks/etl_rake_test.rb b/test/lib/tasks/etl_rake_test.rb index bcf6e671..7edf4232 100644 --- a/test/lib/tasks/etl_rake_test.rb +++ b/test/lib/tasks/etl_rake_test.rb @@ -27,12 +27,24 @@ class EtlRakeTest < ActiveSupport::TestCase Rake::Task['stacks:etl:backfill_meet_all'].invoke('30') end - test 'sync_all invokes sync_meet_all (api) before sync_gemini_notes_all (gemini_notes, parse_transcript: false)' do + test 'sync_all invokes sync_meet_all (api) before sync_gemini_notes_all (gemini_notes, parse_transcript: false), then sync_google_groups' do seq = sequence('sync_all_sweeps') Stacks::Etl::Meet.expects(:sweep_all_users!).with(has_entry(mode: :api)).in_sequence(seq) Stacks::Etl::Meet.expects(:sweep_all_users!).with(has_entries(mode: :gemini_notes, until_time: nil, parse_transcript: false)).in_sequence(seq) + # sync_google_groups instantiates Stacks::Etl::Groups::Connector directly (no + # sweep_all_users! helper) — stub it the same way sync_meet's own test does, so + # sync_all's invocation of stacks:etl:sync_google_groups doesn't run the REAL + # connector against test fixtures. Without this, index_chunks! actually tries to + # persist a chunk's `embedding` attribute, which db/schema.rb intentionally omits + # (pgvector is added outside the dumped schema — see schema.rb's top-of-file note), + # so Heroku CI's in-dyno Postgres blows up with + # ActiveModel::UnknownAttributeError: unknown attribute 'embedding' for Embedding. + groups_connector = mock('groups_connector') + groups_connector.expects(:run).once.in_sequence(seq) + Stacks::Etl::Groups::Connector.expects(:new).with(has_entry(:admin_email)).returns(groups_connector).in_sequence(seq) Rake::Task['stacks:etl:sync_meet_all'].reenable Rake::Task['stacks:etl:sync_gemini_notes_all'].reenable + Rake::Task['stacks:etl:sync_google_groups'].reenable Rake::Task['stacks:etl:sync_all'].reenable Rake::Task['stacks:etl:sync_all'].invoke end