fix(sync): repair silently-broken latestSyncFetcher type assertion #774
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 253 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #774"
general
weight: 0.35
arreyder
PR #473 ("Clean up APIs to specify sync type and sync ID in more places.")
renamed C1File.LatestFinishedSync to LatestFinishedSyncID but did not
update the locally-declared latestSyncFetcher interface in pkg/sync/syncer.go,
which still required a method named LatestFinishedSync with the same
signature.
Since that commit, the type assertion at syncer.getPreviousFullSyncID
has silently failed every time (no type satisfies the stale interface),
causing the function to return the empty string instead of the previous
full sync ID. This is used by fetchResourceForPreviousSync to look up
the previous resource's ETag; the empty sync ID short-circuits that
lookup and makes etag-based grant reuse partially ineffective.
The fix moves the capability interface to pkg/connectorstore as
LatestFinishedSyncIDFetcher with the correct method name, adds a
compile-time impl-assertion on C1File, and deletes the stale local
declaration. Placing the interface next to the other connectorstore
types makes producer and consumer reference a single authoritative
declaration; future renames on either side become compile errors,
not silent drift.
TestSyncGrants_EtagMatchMissingPreviousEtag was written against the
broken behavior: it relied on the previous sync ID being empty to
force fetchEtaggedGrantsForResource into its "no previous sync" error
branch. With the fix, the previous sync ID is correctly resolved, so
the etag reuse path is actually reached — the test's stated intent
("no previous etag stored") requires the connector to have skipped
returning an ETag annotation on its first sync. The mock gains a
skipEtag flag that models this explicitly, and the test uses it to
genuinely reproduce the missing-etag condition.
No public behavior change: external connectors never consumed the
local latestSyncFetcher interface, and the new LatestFinishedSyncIDFetcher
interface is an additive declaration. The only observable difference
is that etag-based grant reuse now functions for partial syncs as
originally intended.