Skip to content

fix(config): recover cached git sources on detached head#1587

Open
dcoric wants to merge 4 commits into
finos:mainfrom
dcoric:fix/configloader-detached-head
Open

fix(config): recover cached git sources on detached head#1587
dcoric wants to merge 4 commits into
finos:mainfrom
dcoric:fix/configloader-detached-head

Conversation

@dcoric

@dcoric dcoric commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

When a git-backed config source (configurationSources) pins a branch, the refresh cycle could fail: a plain git pull on the cached clone errors once the checkout is on a detached HEAD or the remote branch has moved. The cached repo then never recovers without manual deletion.

This change makes the refresh path branch-aware:

  • the git env (GIT_TERMINAL_PROMPT=false, optional GIT_SSH_COMMAND) is now shared by clone, fetch, and pull, where previously only the initial clone used it — so authenticated refreshes work too
  • with a pinned branch: git fetch --all --prune, then checkout, then git pull --ff-only origin <branch>
  • without a pinned branch: plain git pull as before

Why a separate PR

Split out of #1532 per review feedback there — it's a standalone ConfigLoader fix, not part of the postgres sink.

Testing

test/ConfigLoader.test.ts gains coverage that a cached repository left on a detached HEAD (and on an unborn default branch) is recovered on the next refresh.

@dcoric dcoric requested a review from a team as a code owner June 11, 2026 13:59
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 815b838
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6a2abf532bad8500083dedf4

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.25000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.30%. Comparing base (8ac32ba) to head (815b838).

Files with missing lines Patch % Lines
src/config/ConfigLoader.ts 56.25% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1587      +/-   ##
==========================================
- Coverage   85.51%   85.30%   -0.21%     
==========================================
  Files          83       83              
  Lines        7877     7896      +19     
  Branches     1312     1316       +4     
==========================================
  Hits         6736     6736              
- Misses       1114     1132      +18     
- Partials       27       28       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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