Goal
Auto-sync inst/extdata/parameters_habitat_rules.yaml from link whenever link's default bundle changes. Eliminates the manual cp instruction in the file's header comment that's been the source of repeated drift.
Why
The bundled sample parameters_habitat_rules.yaml is fresh's fallback for frs_habitat() callers without a config. The canonical generator is lnk_rules_build() in link, which produces the YAML from link/inst/extdata/configs/default/dimensions.csv. fresh's copy is meant to track link's default bundle but has drifted twice:
- 2026-04-12 → 2026-04-28 — last sync, missing
in_waterbody, area_only, polygon-edge filters, explicit edge codes. Caught + fixed in fresh 0.24.1.
- The next drift will happen the next time link's default bundle evolves.
Manual cp doesn't survive contact with day-to-day work. Wanted: a workflow that does the sync without anyone remembering.
Pattern to mirror
link already has .github/workflows/sync-bcfishpass-csvs.yml — a daily cron that pulls upstream bcfishpass CSVs into link with auto-PR + auto-merge for byte-only drift, halt on shape drift. Same shape works here, just inverted: fresh pulls FROM link instead of bcfishpass.
Proposed workflow
.github/workflows/sync-rules-yaml.yml in fresh:
- Trigger: workflow_dispatch (manual) + on push to link's main affecting
inst/extdata/parameters_habitat_rules.yaml (via repository_dispatch from a link-side workflow). Optionally also a daily cron as a safety net.
- Steps:
- Check out fresh.
- Fetch link's current
inst/extdata/parameters_habitat_rules.yaml (raw URL on main).
- Compare to
fresh/inst/extdata/parameters_habitat_rules.yaml.
- If different: open a PR with the new YAML + a NEWS-friendly diff summary (which species changed, which predicates added/removed). Auto-merge if no shape change (same predicate names); halt for shape drift, label
schema-drift for coordinated review.
- If same: no-op.
Where crate fits
crate is being scoped as the data-ingestion layer between external sources (bcfishpass, fwapg, FOI) and downstream packages. The rules.yaml sync is sibling-package coordination, NOT external data ingestion — different concern. crate doesn't need to handle this.
If/when crate matures into a more general "config provenance" tool (e.g., it tracks shape fingerprints + signs off on inter-package config moves), this sync could route through it. But for now, a focused GitHub Action is the right shape — match the existing sync-bcfishpass-csvs.yml pattern, no new package.
Scope
Phase 1 — basic auto-sync
- workflow_dispatch + daily cron trigger
- raw URL fetch + diff + auto-PR
- auto-merge on byte-equal-after-normalization (just whitespace differences) or actual no-op
- label + halt on shape drift
Phase 2 — link-side push trigger
- link adds a workflow that on push to main affecting
parameters_habitat_rules.yaml, fires a repository_dispatch to fresh
- fresh's sync workflow listens to repository_dispatch + runs immediately
- closes the latency gap (cron lag → seconds)
Phase 3 — defer
- Multi-bundle support: sync per-bundle rules.yaml files into named fresh fixtures (
fresh/inst/testdata/rules-bcfishpass.yaml, rules-default.yaml). Useful for fresh's tests but not required.
- Provenance tracking: write the link commit SHA into the synced file's header comment so drift is debuggable.
Out of scope
- Renaming or relocating fresh's bundled YAML.
- Removing the manual
cp instruction from the YAML header until phase 1 lands and proves itself.
Test plan
- Manual workflow_dispatch: produces a PR if drift exists; no-op if not.
- Synthetic drift test: inject a small change in link's
parameters_habitat_rules.yaml on a fork branch, point the workflow at the fork's raw URL, confirm PR opens with the right body.
- Shape-drift test: inject a change that adds a new predicate to the YAML structure; confirm the workflow labels the PR
schema-drift and doesn't auto-merge.
Goal
Auto-sync
inst/extdata/parameters_habitat_rules.yamlfrom link whenever link's default bundle changes. Eliminates the manualcpinstruction in the file's header comment that's been the source of repeated drift.Why
The bundled sample
parameters_habitat_rules.yamlis fresh's fallback forfrs_habitat()callers without a config. The canonical generator islnk_rules_build()in link, which produces the YAML fromlink/inst/extdata/configs/default/dimensions.csv. fresh's copy is meant to track link's default bundle but has drifted twice:in_waterbody,area_only, polygon-edge filters, explicit edge codes. Caught + fixed in fresh 0.24.1.Manual
cpdoesn't survive contact with day-to-day work. Wanted: a workflow that does the sync without anyone remembering.Pattern to mirror
link already has
.github/workflows/sync-bcfishpass-csvs.yml— a daily cron that pulls upstream bcfishpass CSVs into link with auto-PR + auto-merge for byte-only drift, halt on shape drift. Same shape works here, just inverted: fresh pulls FROM link instead of bcfishpass.Proposed workflow
.github/workflows/sync-rules-yaml.ymlin fresh:inst/extdata/parameters_habitat_rules.yaml(via repository_dispatch from a link-side workflow). Optionally also a daily cron as a safety net.inst/extdata/parameters_habitat_rules.yaml(raw URL on main).fresh/inst/extdata/parameters_habitat_rules.yaml.schema-driftfor coordinated review.Where crate fits
crate is being scoped as the data-ingestion layer between external sources (bcfishpass, fwapg, FOI) and downstream packages. The rules.yaml sync is sibling-package coordination, NOT external data ingestion — different concern. crate doesn't need to handle this.
If/when crate matures into a more general "config provenance" tool (e.g., it tracks shape fingerprints + signs off on inter-package config moves), this sync could route through it. But for now, a focused GitHub Action is the right shape — match the existing
sync-bcfishpass-csvs.ymlpattern, no new package.Scope
Phase 1 — basic auto-sync
Phase 2 — link-side push trigger
parameters_habitat_rules.yaml, fires a repository_dispatch to freshPhase 3 — defer
fresh/inst/testdata/rules-bcfishpass.yaml,rules-default.yaml). Useful for fresh's tests but not required.Out of scope
cpinstruction from the YAML header until phase 1 lands and proves itself.Test plan
parameters_habitat_rules.yamlon a fork branch, point the workflow at the fork's raw URL, confirm PR opens with the right body.schema-driftand doesn't auto-merge.