← Back to Pull requests

Automatically detect project changes that require a re-create call #3165

Open
unknown opened this pull request with 243 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 27, 2026 07:54 UTC
Author

Add tracking of the context variables used to generate a project template, so that when changes are made to projects settings, the potential impact can be detected.

For example, if you change the version of a project, you need to re-generate the project template to ensure that IDE and installer configuration files contain the new version number.

This change reads the cookiecutter.json for a template, and extracts a list of keys; that list of keys are the template variables that the template is sensitive to. Those keys are extracted from the app context, and written to briefcase.toml. The write is done through a TOML-safety mechanism, as defaults can sometimes manifest as None, but None can't be output as TOML; so a None value is converted to the sentinel "<::NONE::>" for serialisation.

Before every run, build and package, the current app context is re-evaluated and converted to 'safe' TOML form. The context section of briefcase.toml is also read. If the (TOML-safe) value of any key stored in briefcase.toml is different from the current value, that indicates the template needs to be re-generated; the user is prompted (since this is potentially destructive if they've made manual changes).

This requires moving all the context generation code into the base command, so that it is accessible to build/run/package commands.

The PR includes some refactoring of the tests for generate_template; previously, most of the functionality was tested via generate_app_template, which is a wrapper around generate_template that adds app-specific behaviours.

Fixes #472
Fixes #1531

PR Checklist:


<!--- Go over all the following points, and put an x in all the boxes that apply. -->
  • I will abide by the BeeWare Code of Conduct

  • I have read and have followed the [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) file

  • This PR was generated or assisted using an AI tool
  • Diff: 243 lines (+182 / -61) across 3 files Reviewer: freakboy3742 Review duration: 5415m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 243 lines diff across 3 files
    0.39
    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.329
    Real PR Conversation Timeline
    1 comments
    "Review active on #3165"
    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: 38.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    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: 20.7% · Safe to merge
    20.7%