← Back to Pull requests

Exhaustive traversal #118

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

Shadowenv Multi-Directory Support

This PR introduces support for multiple shadowenv directories and includes several improvements to the codebase.

This PR description was written by Claude 3.5 Sonnet and revised by @jacobmichels

Key Changes

1. Multi-Directory Support: Shadowenv now loads environments from all ancestors of the current directory, applying them in order from highest to lowest in the file system tree (closest environment applied last).

2. Trust System Enhancement: The trust command now marks the closest shadowenv directory as trusted, with improved error handling for untrusted directories.

3. Activation Output: The activation message now includes information about added and removed directories, providing better visibility into shadowenv changes.

4. No-Clobber Functionality: Added a mechanism to prevent certain variables from being modified while traversing multi-directory shadowenv setups, improving stability and predictability.

5. Code Refactoring: Significant refactoring in various modules to support these new features and improve code quality.

6. Documentation: Updated getting-started.md and trust.md to explain the new multi-directory behaviour.

Detailed Changes

  • src/hash.rs: Introduced SourceList to manage multiple shadowenv sources.

  • src/hook.rs: Modified to support loading and applying multiple shadowenv directories.

  • src/loader.rs: Updated to find multiple shadowenv roots (🧠 should they still be called roots?).

  • src/output.rs: Enhanced to display more detailed activation information.

  • src/shadowenv.rs: Added support for tracking current and previous directories, and no-clobber functionality.

  • src/trust.rs: Improved to handle multiple directories and provide more informative error messages.

  • Various other files: Minor updates and refactoring to support the new features.
  • Testing 🎩

    Please thoroughly test the following scenarios:
    1. Activating shadowenv in a directory with multiple ancestor shadowenv directories.
    2. Trusting a shadowenv directory with the new command syntax.
    3. Overwriting a scalar environment variable while inside a shadowenv prevents this variable from being clobbered (see end of this comment)
    4. Verifying the new activation output format.
    5. Ensuring backwards compatibility with existing shadowenv setups.

    Next Steps

  • Identify outstanding instances of outdated user documentation

  • - Update them to reflect the new multi-directory behaviour
  • Implement no clobber for list variables, if desirable

  • Cut a new release. Major version bump required

  • Update editor plugins (?)
  • Diff: 344 lines (+258 / -86) across 4 files Reviewer: jacobmichels Review duration: 36425m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 344 lines diff across 4 files
    0.47
    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.350
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #118"
    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: 47.3% (MEDIUM) · Higher = larger blast radius
    47.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: 18.7% · Safe to merge
    18.7%