Skip to content

refactor(manager): simplify the role taxonomy, proposal facts and registry readers - #355

Merged
sweepies merged 16 commits into
mainfrom
refactor/simplify-manager
Nov 22, 2026
Merged

sweepies merged 16 commits into
mainfrom
refactor/simplify-manager

Conversation

@sweepies

@sweepies sweepies commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

A simplification pass over crates/manager, crates/mise and crates/words, plus three follow-ups from #350. Only one thing changes for users: the order of disabledUpdates in report JSON (item 9). Item 10 makes the metadata check stricter. Everything else is unchanged; the reasoning is below, per item.

Items

  1. Delete CredentialCheck. committed_credentials already scanned only the files the taxonomy gives a credential_scan. Its Skip early return could never fire, because no scanned file was ranked Skip. Removed: the enum, credential_check, EcoRoles.check/selected, Roles.check and the MISE_FILES table (now MISE_SELECTED plus the mise lock name). Also removed the tools test every_materialized_file_has_a_credential_decision, which only checked that a decision existed.
    • Replacement: roles::tests::credential_bearing_settings_are_scanned. Its probes are every name the taxonomy lists plus one path per role predicate, at the root and nested. Every file whose tool reads credentials must have a scan. Every other file that can name registries must appear in an explicit unscanned list with a reason, or the test fails.
    • Security: unchanged. The scan is hygiene, not the public partition's boundary.
  2. Registry files come from the taxonomy alone. Every Ecosystem::registry_file restated eco_roles(..).registry, so the hook is gone and the Scanner reads the role directly. actions.lock gets the registry role in the taxonomy. mise's backend rows now name the settings files their project checks read (Project { settings, check }), which replaces the per-ecosystem backend_settings hook. Same file sets as before; the classification table is unchanged.
  3. Drop Proposing::resolved_via_listing. The listing path returned None unless selector_resolved was set. Every descriptor that set only resolved_via_listing (npm, NuGet, devcontainer and pre-commit tools) has fixed short tags, so lookup returns None for them either way. Lookup now gates on selector_resolved.
  4. Edits follow Proposing::edits. Copier's edit_refusal and Nix's inventory_only restated Edits::ReportOnly and Edits::Relock. edits() now matches on the fact, and ReportOnly carries the refusal reason, so the corpus refusal text is identical.
    • One edge: a Nix edit now returns empty before the edit range is checked. It was always a no-op.
    • Not done (judgement): Flux's /flux-version refusal and Cargo's workspace = true keep their hooks.
  5. npm and PyPI verdict pre-checks dropped. They listed exactly the names the match arms parse; a name with no arm already has no verdict, so the run it steers fails closed.
  6. .npmrc and Composer repositories parsed once (security: agreement now by construction). Before, the lookup origin, the public verdict and the credential scan each decided separately which .npmrc lines set a registry, and how repositories flattens. They now share npm::npmrc_lines (NpmrcLine::{Ignored, Registry, Setting, Other}), composer::repositories and composer::packagist_switch.
    • Every deny-by-default rule stays with its reader: the verdict still requires each registry value to parse as public and every other key and value to pass string_ok; a wrong-shape repositories still fails the verdict and the origin.
  7. Each Public lists its hosts. This replaces seven closures of the same shape. is_public keeps crates.io's git-index and registry+/sparse+ forms through cargo::crates_io, which now reads CRATES.on_host.
  8. Lock::reported(dep) computed once. Seven descriptors repeated the same tail: not a tool or toolchain, and has resolved. Lock now holds lock_resolved (npm, Bun, Terraform: a lockfile the Count does not move fills resolved), and reported is (movable || lock_resolved) && tail. Same truth table for every descriptor.
  9. Update::RANKED replaced by declaration order. The variants are now declared Major, Minor, Patch, Pin, Digest, so ALL, Ord and the new WORDS give the rank. RANKED, RANKED_WORDS and rank() are gone. I checked every Update::ALL loop and every derived Ord that holds an Update:
    • Output that changes: lookupEvidence.disabledUpdates in report JSON now lists pin before digest, because disabled_updates pushes in ALL order.
    • Order-independent: catalog_wait_hours (min) and lockfile_wait_hours (max).
    • Ties only: plan::Change derives Ord with kind after value/version/digest, so order differs only when two changes tie on every earlier field, which one proposal per declaration rules out.
    • Unchanged: report sorting uses as_str; the CLI --type choices and the TUI filter cycle were already in rank order.
  10. The metadata host-name check, kept and tightened (changed after review). The first version removed METADATA_NAMES on the theory that the DNS check covers those names. It does not: the check stripped a trailing dot before resolving, so under Kubernetes ndots:5 or a search domain with a wildcard record, metadata.google.internal. could resolve to a harmless address and pass, while mise fetches the absolute name, which reaches 169.254.169.254.
    • Now: metadata.google.internal and metadata are refused before any lookup, compared without trailing dots and case-insensitively. Every other host is resolved exactly as written, trailing dot kept, so the check resolves what mise requests.
    • The tests assert the deterministic refusal (no live DNS) and cover the trailing-dot forms.
    • Security: strictly stronger than main. guide/sources.md keeps main's wording.
  11. The preserve-rule test builds its probe with testing::dependency.

From the #350 report:

  • 1. Scanner::shared_name no longer excludes registry, settings and credential-scanned files, and the engine's local shared_name wrapper (tooling reads/manifests) is gone. No such file has a .pkl name. Replaced by the engine test no_role_names_a_pkl_file: its probes are every taxonomy name with .pkl appended, plus .pkl files in the folders each role predicate reads.
  • 4. The pkg.pkl-lang.org arm is ("pkg.pkl-lang.org", _), and PklPackage::parse decides the shape. Any other shape gets the same UNSUPPORTED_PATH. The ? check stays.
  • 7. github_segment is private to config. The field-by-field Pkl Proposing assertion is now pkl_package_updates_write_an_exact_version_under_widen in lookup: under widen, every Pkl update writes exactly the release version. shown()'s doc comment is shorter.

State and derived versions are bumped for every row whose sources changed: extract, files, config, config-files, catalog, catalog-controls, osv-advisory, changelog, notes-adapter, notes-adapter-listing, parsed-postgres-sgml, parsed-go-history.

Dropped

None of the items assigned to this PR.

Follow-ups

The new credential test names three files that can hold credentials their tools read but that are not scanned yet. These are gaps in the hygiene check, not in the public boundary:

  • pdm.toml: PDM repository passwords.
  • .bundle/config: BUNDLE_<HOST> credentials.
  • Maven settings.xml: server passwords.

Checks run

On the VM:

  • clippy -D warnings on manager, config, lookup, engine, words, mise, cli, update and tools.
  • Tests for manager (corpus snapshot included), config, lookup, words, mise, engine and cli.
  • Workspace parity tests.

After review

An adversarial review found two defects; both are fixed.

  • Item 10 removal reverted (a6c55eef). See item 10 above: the metadata names are refused deterministically again, and the lookup now resolves the host as mise requests it (trailing dot kept), which closes the search-domain bypass. Trailing-dot tests added; the tests no longer depend on live DNS.
  • credential_bearing_settings_are_scanned was too narrow (b10cf2f3). It guarded only files whose roles name registries, so pnpm-workspace.yaml, Gemfile and composer.json could lose their scan, along with their SCANNED entry, without failing it.
    • It now guards every materialized or steering file: the settings, read, writable, registry or steers role.
    • "Scanned but not listed" is asserted unconditionally.
    • GRADLE_WRAPPER, PYTHON_READ and NUGET_WRITABLE are probed, along with suffix-matched sources, workflows and action files.
    • Each unscanned entry must really be a guarded file, so stale entries fail.
    • Mutation-checked: removing composer.json's scan fails the test, both with and without its SCANNED entry.
  • Another not-scanned-yet file: gradle-wrapper.properties can carry a user and password in distributionUrl. Like the three in Follow-ups, it is a gap in the hygiene check, not in the public boundary.
  • Checks on the VM: clippy -D warnings on manager and mise; manager and mise tests (220 passed); workspace parity, with state hashes refreshed in dc24b80c.

View guided diff Turn on auto-fix

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 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 ed3bf05 Commit Preview URL

Branch Preview URL
Nov 22 2026, 08:11 PM

committed_credentials scans exactly the files the taxonomy gives a
credential_scan; the Skip early return could never fire. A test over
the taxonomy now fails when a file that can name registries has neither
a scan nor a stated reason, replacing the tools test that only checked
a decision existed.
Every Ecosystem::registry_file restated eco_roles; the Scanner now reads
the registry role directly, Actions' lockfile gets it in the taxonomy,
and mise's backend rows name the settings files their project checks
read instead of a backend_settings hook per ecosystem.
… implies

The listing path returned nothing unless selector_resolved was set, and
every descriptor that set only resolved_via_listing has fixed short
tags, so lookup gating on selector_resolved returns the same.
…hooks

Copier's edit_refusal and Nix's inventory_only restated Edits::ReportOnly
and Edits::Relock; edits() now matches on the fact, and ReportOnly
carries the refusal reason.
The name pre-checks listed exactly the names the match arms parse; a
name with no arm already has no verdict.
The lookup origin, the public verdict and the credential scan each
parsed which .npmrc lines set a registry and how composer.json's
repositories flatten; they now share npm::npmrc_lines and
composer::repositories / packagist_switch, so they agree by
construction. Every deny-by-default rule stays with its reader.
Every Public carried a closure of the same shape over web_host; it now
lists its hosts, and is_public keeps crates.io's index and source forms
through cargo::crates_io.
Seven descriptors repeated the not-a-tool, has-resolved tail; the lock
fact now says only whether a lockfile the Count does not move fills
resolved (npm, Bun, Terraform), and Lock::reported adds the movable
case and the tail.
metadata.google.internal and metadata resolve to a link-local address
where they reach an endpoint, which the address check refuses, and do
not resolve anywhere else, which is refused with a message that names
the metadata endpoint.
Update::RANKED restated a fixed order beside the enum; the variants are
now declared in that order (pin before digest), so ALL, Ord and the new
WORDS give it and RANKED, RANKED_WORDS and rank() go.
Scanner::shared_name and the engine's wrapper excluded registry,
settings, credential-scanned and tooling files, none of which has a
.pkl name. An engine test now pins that no role names a .pkl file.
The pkg.pkl-lang.org arm restated the shapes parse accepts, so it now
takes any path and parse decides. github_segment becomes private to
config, the field-by-field Pkl Proposing test becomes a lookup test that
widen still writes an exact version, and shown()'s doc is shorter.
…the name mise requests

Restores the METADATA_NAMES refusal: stripping a trailing dot before the
lookup let search domains (Kubernetes ndots, a wildcard record) answer
metadata.google.internal. with a harmless address while mise fetches the
absolute name. The names are now compared without trailing dots and
refused deterministically, and the lookup resolves the host as written.
The tests no longer depend on live DNS for the names.
…ntial-scan test

The test only partitioned files that name registries, so dropping the
scan of pnpm-workspace.yaml, Gemfile or composer.json along with its
SCANNED entry still passed. It now covers every file with a settings,
read, writable, registry or steers role, asserts scanned files are
listed unconditionally, and rejects stale unscanned entries.
@sweepies
sweepies force-pushed the refactor/simplify-manager branch from dc24b80 to ed3bf05 Compare November 22, 2026 20:10
@sweepies
sweepies merged commit 80ff360 into main Nov 22, 2026
13 checks passed
@sweepies
sweepies deleted the refactor/simplify-manager branch November 22, 2026 20:19
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 22, 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