Skip to content

Fix critical metadata retargeting and linear batch team-cache regression - #23

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-2763
Draft

Fix critical metadata retargeting and linear batch team-cache regression#23
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-2763

Conversation

@cursor

@cursor cursor Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

This investigation found and fixed two high-severity correctness regressions in recent commits:

  1. Shared-server metadata reconciliation could silently retarget a workspace to a different server database when metadata.json project_id and configured dolt_database disagreed but both appeared authoritative.
  2. Linear batch push could fail the entire sync if any configured team cache failed to build, even when no issue targeted that team.

Root causes

  • In reconcileAuthoritativeServerMetadata, a single project_id match could override dolt_database without first rejecting contradictory authoritative signals from the currently configured database.
  • In linear.Tracker.BatchPush, state caches were built eagerly for all configured teams before processing, turning unrelated team failures into global batch failures.

Fixes

  • Added a fail-closed guard in metadata reconciliation:
    • If project_id maps to one database but configured dolt_database has a different authoritative project ID, reconciliation now returns an error instead of auto-retargeting.
  • Made Linear team state-cache loading lazy:
    • Build primary cache up front for creates.
    • Load non-primary caches only when an issue routes to that team.
    • Team-cache failures now surface as per-issue errors instead of aborting the whole batch.

Validation

  • go test -tags gms_pure_go ./cmd/bd/doctor/fix -run 'TestReconcileAuthoritativeServerMetadata'
  • go test -tags gms_pure_go ./internal/linear -run 'TestBatchPush_IgnoresUnusedBrokenTeamCache|TestBatchPush_PerTeamStateCache'
  • Also ran make test; suite has unrelated environment/pre-existing failures outside touched codepaths (e.g., dolt binary/path and cmd/bd connectivity expectations), while touched packages pass.
Open in Web View Automation 

cursoragent and others added 2 commits July 3, 2026 11:03
Co-authored-by: Medhaug <Medhaug@users.noreply.github.com>
Co-authored-by: Medhaug <Medhaug@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant