← Back to Pull requests

loader: make the working directory transparent, and say what each directory is for #1005

Open
unknown opened this pull request with 311 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 23, 2026 13:00 UTC
Author

What this PR does, in one sentence

It makes explicit, in the loader and in the ResourceLoader contract, which directory a file is read from and which directory the paths of its model are resolved against, so that a relative working directory behaves like an absolute one by construction.

Context

The loader has used the name "working directory" for two different directories. For the main project they are the same. For an included or extended file they are not: the directory the paths of the model are resolved against is relative to the project including the file, so that the paths are rebased level by level and stay relative when the project is loaded with a relative working directory. Nothing said which one was meant where, nor what a ResourceLoader is expected to return from Load and to be given in Dir, and localResourceLoader.abs was only absolute when its directory was. #1004 fixed the case that surfaced (nested includes with a relative working directory, docker/buildx#3099) by making Load return an absolute path; the underlying confusion was still there.

What the PR brings

  • The local resource loader holds an absolute directory, always, so it is idempotent: Load and Dir can be given what Load returned without applying the directory again.

  • include asks Dir for the reference the loader was given, as extends already did, instead of the local file Load returned. ResourceLoader now documents what Load returns and what Dir takes and returns.

  • The directory the paths of the model are resolved against is named path base and documented where it is defined and where it is rebased (loadYamlFile, the includer, extends, ApplyInclude); abs becomes resolve, and the includer's project directory is that of the local loader instead of a guess from the working directory.
  • Guardrails: no behavior change and no exported signature change — the paths of the model are the same as before for any working directory. TestWorkingDirectoryIsTransparent pins it: nested includes, project_directory, extends across files and env files, loaded with an empty, a relative and an absolute working directory, must refer to the same files. Docker Compose's own remote loaders (git, OCI) do not follow the documented Dir contract (they return the cache directory, not the directory of the resource); the includer keeps not relying on their answer, as before.

    🤖 Generated with Claude Code

    Diff: 311 lines (+233 / -78) across 3 files Reviewer: ndeloof Review duration: 10702m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 311 lines diff across 3 files
    0.40
    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
    Diff Size diff_size
    0.344
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1005"
    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: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    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: 21.5% · Safe to merge
    21.5%