← Back to Pull requests

Use shadowenv parent links instead of traversing the entire file tree #1

Closed
unknown closed this pull request without merging on Oct 28, 2024 19:04 UTC
View on GitHub
unknown unknown commented on Oct 24, 2024 21:11 UTC
Author

Note: This PR is for reviewing, it depends on the PR opened upstream here. If the other PR changes are accepted, I will reopen the PR upstream for final merging.

Example tree:

/example
├── .shadowenv.d
├── a
│   ├── .shadowenv.d
│   │       └── parent (/example/.shadowenv.d)
│   └── c
│       └── .shadowenv.d
│           └── parent (../../.shadowenv.d)
└── b
    └── .shadowenv.d

example <- a <- c form a hierarchy throught their parent links. However, b stands alone.
Note that c/.shadowenv.d/parent resolves the relative path from inside c/.shadowenv.d.
Links can skip any amount of levels, ie. c having example root as a parent is perfectly valid.

Let's say everything is untrusted, then being in c prints:

shadowenv failure: The following directories contain untrusted shadowenv programs (see shadowenv help trust to learn more):
/example/a/c/.shadowenv.d
/example/.shadowenv.d

shadowenv trust: will trust /example/a/c/.shadowenv.d.

Being in b prints:

shadowenv failure: directory: '/example/b/.shadowenv.d' contains untrusted shadowenv program: shadowenv help trust to learn more.

shadowenv trust: will trust /example/b/.shadowenv.d.

Error modes


Parent is not a symlink:
shadowenv failure: Error for parent file at /example/a/c/.shadowenv.d/parent: Not a symlink

Parent linked to doesn't exist:

shadowenv failure: Error for parent file at /example/a/c/.shadowenv.d/parent: No such file or directory (os error 2)

Shadowenv references itself as parent:

shadowenv failure: Shadow env at /Users/dom/Documents/shadowenv-example/a/c/.shadowenv.d references itself

Shadowenv parent is not an ancestor:

shadowenv failure: Parent symlink /example/b/.shadowenv.d must be an ancestor of /example/a/.shadowenv.d

Shadowenv parent linked is not a .shadowenv.d:

shadowenv failure: Parent symlink at /example/a/.shadowenv.d/parent must link to a .shadowenv.d directory, but links to not-a-shadowenv.

Diff: 263 lines (+197 / -66) across 3 files Reviewer: jacobmichels Review duration: 5632m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 263 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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.334
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 39.3% (MEDIUM) · Higher = larger blast radius
39.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: 60.5% · Lower = rushed or shallow review
60.5%
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: 15.5% · Safe to merge
15.5%