← Back to Pull requests

Support tree artifacts in Swift `srcs` #3388

Open
unknown opened this pull request with 211 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 05, 2026 21:45 UTC
Author

A swift_library can have a directory (tree artifact) in srcs, e.g. a directory of generated sources. rules_swift 4.2.0 compiles its files individually, but generating a project with one fails:

Generating Features/Episodes/EpisodesTestSupport.rules_xcodeproj.build_settings failed:
Failed to expand directory <generated file Features/Episodes/EpisodesTestSupport_apollo_test_mocks>.
Either add the directory as an input of the action or set 'expand_directories = False' ...

Three actions expand the directory without having it as an input:

  • WriteTargetBuildSettings reuses the SwiftCompile action's Args, which expand the directory. The target's directory srcs are now passed along with the Args (swift_directories) and are inputs of the action. They're taken from the target's srcs rather than from the SwiftCompile action's inputs, so no transitive inputs are flattened. Targets without directories get the same action as before.

  • WriteGeneratedDirectoriesFilelist and the generated xcfilelist map srcs to paths. They now use expand_directories = False and list a directory itself, since its files aren't known until it's built.
  • Tests:

  • New unit tests for both: write_generated_directories_filelist (no tests until now) and two write_target_build_settings cases. They fail without the fix; //test/... passes. The mock Args.use_param_file now accepts use_always.

  • Two iOS apps that use rules_apollo (generated GraphQL code as tree artifacts, schema/operations/mocks modules) generate projects and build with xcodebuild; without this change bazel run //:xcodeproj fails as above.
  • Diff: 211 lines (+158 / -53) across 2 files Reviewer: aaronsky Review duration: 36282m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 211 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.320
    Real PR Conversation Timeline
    1 comments
    "Review active on #3388"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.5% (MEDIUM) · Higher = larger blast radius
    36.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%