Skip to content

Remove duplicated file queries in pipeline staging - #116

Merged
yoonspark merged 2 commits into
mainfrom
fix-pipeline-file-query-duplication
Aug 14, 2026
Merged

Remove duplicated file queries in pipeline staging#116
yoonspark merged 2 commits into
mainfrom
fix-pipeline-file-query-duplication

Conversation

@yoonspark

@yoonspark yoonspark commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Scan the input directory once per staging pass: _prepare_staging_inputs replaces _build_staging_context and returns both the candidate files and the StagingContext, with waiting derived from that same list.
  • Extract _count_finished and _all_tracked_files_settled so the finished-file count and the "everything settled" check live in one place instead of being repeated in _handle_processed_files and _check_inactivity.

The pipeline counted the same files in more than one place: `waiting`
re-scanned the input directory for files middleware already receives as
`candidates`, and the finished-directory scan was repeated in the staging
context, completion logging, and the inactivity check.

- Drop `waiting` from `StagingContext`; the remaining counts describe
  files that are staged, completed, or failed
- Add `_count_finished` and `_all_tracked_files_settled` as the single
  source for those counts
@yoonspark yoonspark added bug Something isn't working refactor Make code cleaner, clearer, and easier to understand labels Aug 14, 2026
The previous commit dropped `waiting` because middleware already
receives those files as `candidates`. That holds only for the first step
in the chain: once a step filters the list, later steps can no longer
see the full input backlog.

Recovering the count would mean a second scan of the input directory, so
merge the candidate scan into the context builder instead: one scan
feeds both, and `waiting` comes from the list the chain receives. The
builder is renamed `_prepare_staging_inputs` to match.
@yoonspark

Copy link
Copy Markdown
Collaborator Author

Separate from this PR, StagingContext needs probe on its own. That is, we need to evaluate if its current shape is effective and general enough to support different staging needs.

@yoonspark
yoonspark merged commit 4cb4acd into main Aug 14, 2026
8 checks passed
@yoonspark
yoonspark deleted the fix-pipeline-file-query-duplication branch August 14, 2026 19:44
@yoonspark yoonspark linked an issue Aug 14, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working refactor Make code cleaner, clearer, and easier to understand

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated file accounting in Pipeline

1 participant