bramhanandlingala opened a new pull request, #9045:
URL: https://github.com/apache/devlake/pull/9045

   ### Summary
   Fixes a bug where a subtask running for the very first time (fresh install, 
or
   a newly-added converter subtask) is silently bootstrapped into incremental
   mode, causing it to filter out the entire already-collected backlog and
   produce zero rows in the domain layer — even though the tool-layer table is
   fully populated.
   
   Repro: fresh DB → GitHub connection + CICD scope → run blueprint once →
   `_tool_github_runs` is populated, but `cicd_pipelines` returns 0 rows.
   
   ### Root Cause
   `bootstrapStateFromCollectorStateIfNeeded` (in
   `backend/helpers/pluginhelper/api/subtask_state_manager.go`) copied the
   sibling collector's `LatestSuccessStart` into the subtask's own
   `PrevStartedAt` whenever the subtask had no prior state of its own.
   
   `PrevStartedAt == nil` is the framework's signal that a subtask has never run
   before, and it's what triggers a full sync in
   `calculateStateManagerIncrementalMode`. On a fresh install, the collector
   finishes moments before the converter runs — in the same pipeline execution —
   so `LatestSuccessStart` is effectively "now". Bootstrapping `PrevStartedAt`
   from that value made the converter's genuinely-first-ever run look like a
   *returning* run, flipping it into incremental mode and filtering rows by
   `since` against historical timestamps (e.g. `github_updated_at`), which
   silently dropped the entire backlog.
   
   ### Fix
   Stop bootstrapping `PrevStartedAt` from the collector state. Only `TimeAfter`
   is still inherited from the collector, since it's just a fallback lower bound
   and has no effect on the incremental-vs-full-sync decision.
   
   This is a shared framework fix (`SubtaskStateManager`, used by
   `StatefulDataConverter`/`StatefulDataExtractor`), so it applies to every
   plugin using stateful subtasks — not just GitHub's CICD converters.
   
   Closes #9016
   
   Was generative AI tooling used ?
   
   - [X] Yes - Claude
   
   Generated-by: Claude following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to