Skip to content

refactor!: decide each policy once, in the crate that owns it - #215

Merged
sweepies merged 3 commits into
mainfrom
refactor/policy
Nov 9, 2026
Merged

sweepies merged 3 commits into
mainfrom
refactor/policy

Conversation

@sweepies

@sweepies sweepies commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Seventh in the untangle series.

Why

Several policy decisions were made in more than one place, or by a crate that doesn't own them:

  • Release age: automerge recomputed published + wait_hours <= now beside lookup's own copy of that rule.
  • Schedule windows: update::plan::in_window re-implemented window evaluation (zone parsing, the since window, the one-minute fallback), and lockfile maintenance hardcoded its Monday default.
  • Patterns: the grammar was implemented three times (config::Patterns, validate's re-parse, lookup's Filter). semver: always used the Rust semver crate, so on a PEP 440, Maven or RubyGems dependency an unparseable version silently flipped allow/deny.
  • Scheme resolution: patchula_lookup::scheme was called by update and engine, which need no policy.
  • Digest policy: checked by asking for a proposal with the fake digest "probe".
  • LTS: allowed only for two hardcoded Node package identities.
  • Extractor regexes: compiled up to three times per dependency per run, with failures silently ignored.
  • Inert config: submodules and ignoreAuthors were accepted and never read.
  • Schema doc: said "only npm takes a registry", while the validator accepts npm and pypi.

What

  • lookup::eligible_at is the one release-age formula. Automerge calls it.
  • config::Window::due, config::due and Config::maintenance_windows own window evaluation, including the Monday default. Their tests moved to config.
  • config::{Patterns, Filter} own the sigils, and validation calls the real compilers. semver: uses the dependency's own versioning. On a scheme without ranges (loose, Go, Docker) it's an evaluation error, not a silent non-match.
  • versioning::Ecosystem::of(scheme, source) replaces lookup::scheme.
  • Evaluator::digest_policy_applies replaces every "probe".
  • channel = "lts" follows the catalog's lts dist-tag for any source.
  • Extractor regexes compile once per evaluator. A pattern that fails to compile is an error.
  • PatchulaConfig.pkl registry doc fixed.

Breaking

feat(config)!: submodules and ignoreAuthors are removed from the schema. A config that sets them no longer validates. Neither ever changed behaviour.

Behaviour changes

  • A semver: filter on a dependency whose scheme has no ranges is now an error.
  • LTS works for any catalog with an lts dist-tag. The error for a catalog without one no longer names Node.
  • An invalid extractor regex, or a policy that can't be evaluated, now surfaces as a warning or error instead of being silently skipped.

Docs: guide/lookup-policy.md, guide/configuration.md, reference/configuration.mdx.

View guided diff Turn on auto-fix

sweepies and others added 2 commits November 9, 2026 09:33
Neither field was read anywhere; the schema accepted them only to say so.
Configs that set them now fail validation.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Release-age eligibility is one formula, patchula_lookup::eligible_at,
  shared by evaluation and automerge.
- Schedule windows and the lockfile-maintenance default live in config
  (Window::due, due, Config::maintenance_windows); update consumes them.
- Version filters are patchula_config::Filter: one grammar (!, regex:,
  semver:) validated by the real compiler, with semver: ranges read in the
  dependency's own versioning and rejected where it has none.
- (Scheme, Source) resolves through versioning's Ecosystem::of.
- digest_policy_applies replaces the "probe" sentinel.
- channel = "lts" follows the catalog's lts dist-tag for any source.
- Custom extractor regexes compile once per Evaluator; failures are
  evaluation errors.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 2583d4b Commit Preview URL

Branch Preview URL
Nov 09 2026, 09:44 AM

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 25 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread crates/config/src/matching.rs Resolved
Comment thread crates/config/tests/windows.rs Resolved
@sweepies
sweepies merged commit af2520c into main Nov 9, 2026
13 checks passed
@sweepies
sweepies deleted the refactor/policy branch November 9, 2026 09:53
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant