@@ -632,6 +632,7 @@ func (c *StoreReconciler) provision(
632
632
633
633
func (c * StoreReconciler )TrackResourceReplacement (ctx context.Context ,workspaceID ,buildID ,claimantID uuid.UUID ,replacements []* sdkproto.ResourceReplacement ) {
634
634
// Set authorization context since this may be called in the background (i.e. with a bare context).
635
+ // nolint:gocritic // Necessary to query all the required data.
635
636
ctx = dbauthz .AsSystemRestricted (ctx )
636
637
// Since this may be called in a fire-and-forget fashion, we need to give up at some point.
637
638
trackCtx ,trackCancel := context .WithTimeout (ctx ,time .Minute )
@@ -642,6 +643,7 @@ func (c *StoreReconciler) TrackResourceReplacement(ctx context.Context, workspac
642
643
}
643
644
}
644
645
646
+ // nolint:revive // Shut up it's fine.
645
647
func (c * StoreReconciler )trackResourceReplacement (ctx context.Context ,workspaceID ,buildID ,claimantID uuid.UUID ,replacements []* sdkproto.ResourceReplacement )error {
646
648
if err := ctx .Err ();err != nil {
647
649
return err
@@ -683,12 +685,12 @@ func (c *StoreReconciler) trackResourceReplacement(ctx context.Context, workspac
683
685
// Use the claiming build here (not prebuild) because both should be equivalent, and we might as well spot inconsistencies now.
684
686
templateVersion ,err := c .store .GetTemplateVersionByID (ctx ,build .TemplateVersionID )
685
687
if err != nil {
686
- return xerrors .Errorf ("fetch template version %q: %w" ,build .TemplateVersionID .String ())
688
+ return xerrors .Errorf ("fetch template version %q: %w" ,build .TemplateVersionID .String (), err )
687
689
}
688
690
689
691
org ,err := c .store .GetOrganizationByID (ctx ,workspace .OrganizationID )
690
692
if err != nil {
691
- return xerrors .Errorf ("fetch org %q: %w" ,workspace .OrganizationID .String ())
693
+ return xerrors .Errorf ("fetch org %q: %w" ,workspace .OrganizationID .String (), err )
692
694
}
693
695
694
696
// Track resource replacement in Prometheus metric.