Skip to content

feat(changeset-hygiene): opt-in transitive re-export config#42

Merged
turnipdabeets merged 1 commit into
mainfrom
feat/changeset-hygiene-transitive-reexports
May 21, 2026
Merged

feat(changeset-hygiene): opt-in transitive re-export config#42
turnipdabeets merged 1 commit into
mainfrom
feat/changeset-hygiene-transitive-reexports

Conversation

@turnipdabeets
Copy link
Copy Markdown
Contributor

Problem

The hygiene check flags downstream packages declared in a changeset without source changes of their own as "extra" — but that's a false positive when the downstream legitimately needs to republish to deliver an upstream change to its consumers.

Motivating case: PostHog/posthog-android#525

posthog-android declares api(project(":posthog")) in Gradle. When posthog ships a public API change, posthog-android must be republished so its Maven POM points at the new core version — otherwise Android consumers don't get the feature. The hygiene script can't see Gradle deps and warns "Changeset declares posthog-android but no source files in that package changed."

Changes

  • Adds optional per-repo config at .changeset/hygiene.json:
    { "transitiveReExports": { "<upstream>": ["<downstream>", ...] } }
  • When <upstream> has source changes AND is declared in the changeset, declarations of its listed re-exporters are no longer flagged as "extra".
  • Backward-compatible: repos without the file behave exactly as today.

Edge cases preserved

  • Re-exporter declared but upstream not declared → still flagged.
  • Upstream declared with no source changes (bare bump) → re-exporters not excused.
  • Re-exporter has its own source changes → behavior unchanged.
  • Malformed JSON → logged to stderr, treated as no config.

Lets caller repos opt in via .changeset/hygiene.json to suppress the
"extra package declared" warning when a downstream re-exporter
legitimately needs to bump alongside its upstream. Targets cases the
workspace graph can't see — e.g. Gradle api(project(":x")) re-exports
where a downstream artifact must be republished to deliver an upstream
change to its own consumers.

Schema:
  { "transitiveReExports": { "<upstream>": ["<downstream>", ...] } }

Backward-compatible: repos without the file behave exactly as before.

Motivating case: PostHog/posthog-android#525
@turnipdabeets turnipdabeets requested a review from a team as a code owner May 21, 2026 22:19
@turnipdabeets turnipdabeets requested a review from a team May 21, 2026 22:25
@turnipdabeets turnipdabeets merged commit b6cef41 into main May 21, 2026
12 of 13 checks passed
@turnipdabeets turnipdabeets deleted the feat/changeset-hygiene-transitive-reexports branch May 21, 2026 22:29
turnipdabeets added a commit to PostHog/posthog-android that referenced this pull request May 22, 2026
Declares posthog-android and posthog-server as transitive re-exporters
of posthog so the hygiene check stops flagging them as 'extra' when
declared in a changeset alongside posthog without their own source
changes.

Both modules declare api(project(":posthog")) in Gradle and must
republish to deliver upstream core changes to their Maven consumers.

Config schema added in PostHog/.github#42.
Triggered by warning on #525.
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.

2 participants