feat(local): auto-propose registry patches and track the feedback loop #117

Merged
pat-s merged 1 commit from t3code/propose-patches-and-tracking into main 2026-07-14 15:03:25 +00:00
Owner

Implements steps 3 + 4 of #115, building on the classifier merged in #116. Now that bincraft v4.4.3 applies registry patch/makevars/configure_args to the target package build (previously deps-only), a trial patched build is a meaningful acceptance gate, so the "propose" half is viable.

Step 3 — propose, do not apply

  • local/propose-patches.R — for each classified, safe fix affecting a package with no current registry entry, emits a pre-filled registry.json entry and validates the candidate set against a temporary merged registry (the real one is never touched unless asked).
    • default: print candidates + validation, take no action
    • --write: append entries to registry.json + the proposals ledger (you commit + open the PR)
    • --open-issue: post/update a Forgejo tracking issue (reuses the weekly-audit httr2 + FORGEJO_TOKEN pattern)
  • local/trial-build-patch.R — isolated bincraft build of one package with the registry applied (no upload/archive/metadata; patchhash keeps it out of the real cache). Exit 0/1, so it gates a CI step or manual pre-merge check.

The human gate stays: nothing merges. Acceptance = validate-patches.R passes (checked automatically) and the trial build succeeds. Novel source diffs and unknown signatures are never proposed (they carry auto = FALSE).

Step 4 — feedback loop

  • local/proposal-tracking.R (read-only) — signature hit rate (builds/pkgs/addressed/open per signature), proposed-vs-merged (a proposal counts merged once its package is in the registry), and retirement candidates (registry entries whose package no longer fails, i.e. likely fixed upstream).
  • local/proposal-tracking-lib.R — the pure metric/ledger helpers.

Scheduled pipeline

  • .crow/weekly-patch-proposals.yaml — a single (non-matrix) job that runs both steps weekly: posts/updates the Forgejo tracking issue via propose-patches.R --open-issue, then logs the step-4 metrics via proposal-tracking.R. Clones read-only; the only write is the tracking issue. Register the weekly-patch-proposals cron in the crow UI, or trigger manually with task=weekly-patch-proposals.

Supporting changes

  • Refactored the classify helpers to expose a pure build_triage_report() + a list-returning entry builder; failing-builds-report.R now renders from the shared function (no behaviour change).
  • validate-patches.R gains optional PATCH_DIR/REGISTRY_FILE overrides (backward-compatible) so a candidate registry can be validated in isolation.
  • Documented the propose/trial-build/tracking/scheduled workflow in local/patches/README.md.

Verification

  • 71 unit tests pass (incl. new test-proposal-tracking-lib.R) under the Dockerized R 4.5.3 build env.
  • All pre-commit hooks pass (air-format, validate-patches, yamllint, prettier, etc.).
  • Smoke-tested all three entrypoints end-to-end with a stubbed DB: dry-run, --write (produces a registry that passes the canonical validator + a valid ledger, then reverted), and the tracker.

Closes #115

Implements steps 3 + 4 of #115, building on the classifier merged in #116. Now that bincraft **v4.4.3** applies registry `patch`/`makevars`/`configure_args` to the *target* package build (previously deps-only), a trial patched build is a meaningful acceptance gate, so the "propose" half is viable. ## Step 3 — propose, do not apply - **`local/propose-patches.R`** — for each classified, safe fix affecting a package with no current registry entry, emits a pre-filled `registry.json` entry and validates the candidate set against a *temporary* merged registry (the real one is never touched unless asked). - default: print candidates + validation, **take no action** - `--write`: append entries to `registry.json` + the proposals ledger (you commit + open the PR) - `--open-issue`: post/update a Forgejo tracking issue (reuses the weekly-audit `httr2` + `FORGEJO_TOKEN` pattern) - **`local/trial-build-patch.R`** — isolated bincraft build of one package with the registry applied (no upload/archive/metadata; `patchhash` keeps it out of the real cache). Exit 0/1, so it gates a CI step or manual pre-merge check. The human gate stays: nothing merges. Acceptance = `validate-patches.R` passes (checked automatically) **and** the trial build succeeds. Novel source diffs and unknown signatures are never proposed (they carry `auto = FALSE`). ## Step 4 — feedback loop - **`local/proposal-tracking.R`** (read-only) — signature hit rate (builds/pkgs/addressed/open per signature), proposed-vs-merged (a proposal counts merged once its package is in the registry), and retirement candidates (registry entries whose package no longer fails, i.e. likely fixed upstream). - **`local/proposal-tracking-lib.R`** — the pure metric/ledger helpers. ## Scheduled pipeline - **`.crow/weekly-patch-proposals.yaml`** — a single (non-matrix) job that runs both steps weekly: posts/updates the Forgejo tracking issue via `propose-patches.R --open-issue`, then logs the step-4 metrics via `proposal-tracking.R`. Clones read-only; the only write is the tracking issue. Register the `weekly-patch-proposals` cron in the crow UI, or trigger manually with `task=weekly-patch-proposals`. ## Supporting changes - Refactored the classify helpers to expose a pure `build_triage_report()` + a list-returning entry builder; `failing-builds-report.R` now renders from the shared function (no behaviour change). - `validate-patches.R` gains optional `PATCH_DIR`/`REGISTRY_FILE` overrides (backward-compatible) so a candidate registry can be validated in isolation. - Documented the propose/trial-build/tracking/scheduled workflow in `local/patches/README.md`. ## Verification - 71 unit tests pass (incl. new `test-proposal-tracking-lib.R`) under the Dockerized R 4.5.3 build env. - All pre-commit hooks pass (`air-format`, `validate-patches`, `yamllint`, prettier, etc.). - Smoke-tested all three entrypoints end-to-end with a stubbed DB: dry-run, `--write` (produces a registry that passes the canonical validator + a valid ledger, then reverted), and the tracker. Closes #115
Implement steps 3 + 4 of issue #115 on top of the failure classifier, now
that bincraft v4.4.3 applies registry patches/makevars/configure_args to the
target build (not just dependencies), so a trial patched build is meaningful.

- refactor the classify helpers to expose a pure build_triage_report() and a
  list-returning entry builder; failing-builds-report.R now renders from it
- add local/propose-patches.R (step 3, "propose, do not apply"): emit a
  pre-filled registry.json entry for each classified, safe, unregistered
  failure, validate the candidate set against a temporary merged registry,
  and (only on request) --write it plus a proposals ledger, or --open-issue a
  Forgejo tracking issue; the human gate and validator/trial-build acceptance
  stay, and novel source diffs / unknown signatures are never proposed
- add local/trial-build-patch.R: isolated bincraft build of one package with
  the registry applied (no upload/archive/metadata) as the pre-merge gate
- add local/proposal-tracking.R + local/proposal-tracking-lib.R (step 4):
  signature hit rate, proposed-vs-merged, and retirement candidates, with the
  pure helpers covered by tests
- teach validate-patches.R optional PATCH_DIR/REGISTRY_FILE overrides so a
  candidate registry can be validated without touching the real one
- document the propose/trial-build/tracking workflow in local/patches/README.md
pat-s merged commit 1c297c01bf into main 2026-07-14 15:03:25 +00:00
pat-s deleted branch t3code/propose-patches-and-tracking 2026-07-14 15:03:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
devxy/build-cran-binaries!117
No description provided.