Skip to content

feat(framework): Enable user-specified include/exclude for FAB build#6805

Open
chongshenng wants to merge 48 commits intomainfrom
feat/include-based-fab-build
Open

feat(framework): Enable user-specified include/exclude for FAB build#6805
chongshenng wants to merge 48 commits intomainfrom
feat/include-based-fab-build

Conversation

@chongshenng
Copy link
Member

@chongshenng chongshenng commented Mar 20, 2026

This PR:

  • Removes .gitignore based include/exclude rules for flwr build. FAB contents are computed from user include/exclude rules and then constrained by the built-in FAB include/exclude safeguards.
  • Raise errors for pattern issues:
    • fab-include or fab-exclude set to an empty list
    • A pattern that is syntactically invalid
    • A pattern that matches no files
    • fab-include patterns whose matched files are all removed by built-in constraints
  • If fab-include and fab-exclude patterns overlap, fab-exclude patterns prevail and the matching files are filtered out.
  • Fixes a KeyError for Windows-style path separators in build_fab_from_files: all keys are now normalized to forward slashes up-front, so callers passing src\client.py-style keys are handled correctly.
  • Adds tests covering the new behavior and exclusions.

Merge after:

@chongshenng chongshenng self-assigned this Mar 20, 2026
@github-actions github-actions bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Mar 20, 2026
@chongshenng chongshenng force-pushed the feat/include-based-fab-build branch from f79f7c0 to 1cb1020 Compare March 23, 2026 08:42
@chongshenng chongshenng changed the base branch from main to feat/bridge-fab-build-core March 23, 2026 08:43
@chongshenng chongshenng changed the title feat(framework): Enable include-based FAB build feat(framework): Unify warning handling for user specfied include/exclude for FAB build Mar 23, 2026
@chongshenng chongshenng changed the base branch from feat/bridge-fab-build-core to main March 23, 2026 20:01
Base automatically changed from feat/minimal-fab-pattern-config-validation to main March 24, 2026 09:09
Copilot AI review requested due to automatic review settings March 24, 2026 12:22
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 updates FAB bundling (flwr build) so that file selection is driven by user-provided [tool.flwr.app].fab-include / fab-exclude patterns (when configured), and then constrained by the built-in FAB include/exclude safeguards. It also standardizes how warnings/notes are emitted for pattern issues and adds tests for the updated behavior.

Changes:

  • Remove .gitignore-based filtering from FAB build; rely on user include/exclude patterns plus built-in constraints.
  • Add unified warning/note emission for empty lists, unmatched patterns, include/exclude overlap, and built-in constraint removals.
  • Add tests validating filtering outcomes and warning output.

Reviewed changes

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

File Description
framework/py/flwr/cli/build.py Reworks FAB path filtering to apply user patterns and built-in constraints; adds consistent warning/note emission.
framework/py/flwr/cli/build_test.py Adds helper and tests for new filtering behavior and warning messages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +384 to +389
if user_exclude_spec:
final_paths = [
path
for path in built_in_constrained_paths
if not user_exclude_spec.match_file(path)
]
Copy link
Member

Choose a reason for hiding this comment

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

Since we decided to allow overlaps between fab-include and fab-exclude by applying exclusion rules first, should we move this above and use both fab-include and fab-exclude to build the candidate paths?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FAB inclusion/exclusion rules Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants