episoda 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,15 +134,26 @@ const supabase = createClient(supabaseUrl, supabaseKey);
134
134
  const branchMatch = '${NEW_BRANCH}'.match(/^(?:module\/)?EP(\d+)-/);
135
135
  if (branchMatch) {
136
136
  const uid = 'EP' + branchMatch[1];
137
+ // EP970: Also fetch checkout_at to detect if orchestrator already handled this
137
138
  const { data: module } = await supabase
138
139
  .from('module')
139
- .select('id, project_id')
140
+ .select('id, project_id, checkout_at, checkout_user_id')
140
141
  .eq('uid', uid)
141
142
  .maybeSingle();
142
143
 
143
144
  if (module) {
144
145
  moduleId = module.id;
145
146
  projectId = module.project_id;
147
+
148
+ // EP970: Skip if orchestrator already handled checkout within last 10 seconds
149
+ // This prevents duplicate RPC calls when dragging cards on the kanban board
150
+ if (module.checkout_at && module.checkout_user_id === userId) {
151
+ const checkoutAge = Date.now() - new Date(module.checkout_at).getTime();
152
+ if (checkoutAge < 10000) {
153
+ console.log('SKIP:Orchestrator already handled checkout (' + Math.round(checkoutAge/1000) + 's ago)');
154
+ process.exit(0);
155
+ }
156
+ }
146
157
  }
147
158
  }
148
159
  }