Start a Lunch Flow import at the sync's window when it has one
Summary
Lunch Flow convergence, C1b: a Lunch Flow sync now honours its sync window, as Brex's does. When a sync has an explicit window_start_date, every account's transaction fetch starts there. Without one, nothing changes.
Part of jaysbeekay/sure#670 (Track B, Lunch Flow convergence). Stacked on C1a (jaysbeekay/sure#726) in fork stack #687.
Upstream draft PR: https://github.com/we-promise/sure/pull/5238 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.
Behaviour delta (Lunch Flow)
| Sync | Before | After |
|---|---|---|
| no window (scheduled and manual syncs) | the start date from the account's history and the chosen start date | unchanged |
with window_start_date | the window was ignored | each fetch starts at the window's start, overriding the incremental start, as Brex's importer does |
| a windowed fetch of an account that still needs history | recorded history_synced_from | no history marker is recorded, because the fetch didn't start at the chosen start date, so the next unwindowed sync still fetches the history |
transactions_synced_through is still recorded after every successful fetch: a windowed fetch runs from the window start to now.
What changed
LunchflowItem::Syncerpassessync.window_start_datetoimport_latest_lunchflow_data(sync_start_date:), which passes it toLunchflowItem::Importer.LunchflowItem::Importer#determine_sync_start_datereturns the window's start when given.fetch_and_store_transactionsrecords the history marker only for an unwindowed fetch.
Demo data
No demo data needed.
Migration notes
No migration.
Verification
-
Tests (fail-first):
- New
LunchflowItem::ImporterSyncWindowTest:- a window sets where a later fetch starts, over the incremental start;
- a window sets where a first fetch starts, over the chosen start date, and records no history marker;
- the connection hands its import the window.
LunchflowItem::SyncerTest: "the import starts from the sync's window".
Before the change they fail:
unknown keyword: :sync_start_date, and the import was called without the window. - New
-
Existing tests unchanged:
LunchflowItem::ImporterStartDateTest(the unwindowed start-date rules) passes unedited. -
Mutations, each caught: the window ignored by the importer; a windowed fetch recording history; the connection dropping the window; the syncer dropping the window.
-
bin/rails test(full, at the C1b commit): 16,313 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image). -
bin/rubocopon changed files: no offenses.bin/brakeman: no warnings. -
Size: non-test +15 / -7.
-
Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
import_latest_lunchflow_datahas one caller, the syncer, and its keyword is optional.LunchflowItem::Importer.newhas one app caller.