Skip to content

Conversation

@erka
Copy link
Contributor

@erka erka commented Oct 20, 2025

Add configurable policy for handling remote git fetch failures during
startup. This allows Flipt to continue operating with stale local data
when the remote repository is temporarily unavailable.

Related #4907

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 60.46512% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.07%. Comparing base (63e2ff8) to head (19613b5).
⚠️ Report is 1 commits behind head on v2.

Files with missing lines Patch % Lines
internal/storage/environments/environments.go 0.00% 8 Missing and 1 partial ⚠️
internal/storage/git/repository.go 74.19% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #4920      +/-   ##
==========================================
+ Coverage   59.01%   59.07%   +0.05%     
==========================================
  Files         135      135              
  Lines       16874    16908      +34     
==========================================
+ Hits         9959     9988      +29     
- Misses       6234     6239       +5     
  Partials      681      681              
Flag Coverage Δ
integrationtests 33.82% <9.30%> (-0.06%) ⬇️
unittests 50.12% <60.46%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@erka erka force-pushed the rd/v2/remote-fallback branch from ebc5039 to 9dda6ef Compare October 20, 2025 23:23
@erka erka requested a review from Copilot October 20, 2025 23:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a configurable remote_startup_fetch_policy option that controls how Flipt handles remote Git fetch failures during startup. The policy can be set to "required" (default) or "optional", allowing Flipt to continue operating with stale local data when the remote repository is temporarily unavailable.

Key changes:

  • Added RemoteStartupFetchPolicy configuration field supporting "required" (default) and "optional" policies
  • Implemented connection error detection logic to differentiate network issues from other errors
  • Modified startup fetch logic to conditionally allow failures when policy is "optional" and local commits exist

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
magefile.go Updated test command to run specific test instead of full suite
internal/storage/git/repository_test.go Added comprehensive tests for new fetch policy behavior and connection error handling
internal/storage/git/repository.go Implemented fetch policy logic, connection error detection, and configuration option
internal/storage/environments/environments.go Integrated fetch policy into environment manager's repository initialization and fetch logic
internal/config/storage.go Added RemoteStartupFetchPolicy field to storage configuration
config/flipt.schema.json Added schema validation for remoteStartupFetchPolicy enum values
config/flipt.schema.cue Added CUE schema definition with default value for remote_startup_fetch_policy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@erka erka force-pushed the rd/v2/remote-fallback branch 5 times, most recently from a534d9c to e12d18f Compare October 21, 2025 17:21
@erka erka added the v2 Flipt v2 label Oct 21, 2025
@erka erka marked this pull request as ready for review October 21, 2025 17:38
@erka erka requested a review from a team as a code owner October 21, 2025 17:38
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 21, 2025
@dosubot
Copy link

dosubot bot commented Oct 21, 2025

Documentation Updates

1 document(s) were updated by changes in this PR

How did I do? Any feedback?  Join Discord

Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! just some thoughts on naming things

erka and others added 5 commits October 22, 2025 17:36
Add configurable policy for handling remote git fetch failures during
startup. This allows Flipt to continue operating with stale local data
when the remote repository is temporarily unavailable.

Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Co-authored-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
@erka erka force-pushed the rd/v2/remote-fallback branch from 70f7abb to 6814190 Compare October 22, 2025 16:39
@erka erka changed the title feat(storage): add remote_startup_fetch_policy configuration option feat(storage): add fetch_policy configuration option Oct 22, 2025
@markphelps markphelps added the needs docs Requires documentation updates label Oct 22, 2025
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! i'll likely create a release tomorrow

@erka erka merged commit 24e9764 into v2 Oct 22, 2025
53 of 55 checks passed
@erka erka deleted the rd/v2/remote-fallback branch October 22, 2025 20:46
@github-project-automation github-project-automation bot moved this to Done in Flipt V2 Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs docs Requires documentation updates size:L This PR changes 100-499 lines, ignoring generated files. v2 Flipt v2

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants