Skip to content

RELEASING.md step 1 verifies the installed package, not the release under test #40

Description

@parisek

Summary

RELEASING.md step 1 is described as the one check CI cannot run, to be done locally before tagging:

ddev exec "php vendor/bin/acf-schema-gen --wp-root /var/www/html --output /tmp/acf-schemas-out/"
diff -r /tmp/acf-schemas-out/ vendor/parisek/acf-json-schema/schemas/

Run that way it verifies the installed copy of the package, not the working copy being released. Any hand-curated ref change in the release under test is invisible to it.

Mechanism

acf-schema-gen boots WordPress (--wp-root). WordPress loads the theme, the theme's Composer autoloader registers, and Parisek\AcfJsonSchema\* resolves to the theme's installed copy. Confirmed by reflection while preparing v0.7.6, running the generator from a checkout of the release branch against a DDEV site whose theme requires this package:

SchemaEmitter loaded from:
/var/www/html/wp-content/themes/<theme>/vendor/parisek/acf-json-schema/src/Emit/SchemaEmitter.php

copyStaticRefs() (src/Emit/SchemaEmitter.php:162) copies from __DIR__ . '/../templates/refs' — which, with that class loaded, is the installed package's templates. So the output carries the previously released refs.

Consequence

The diff shows the release's own hand-curated changes as differences, in the direction that reads as "my edit did not make it into the generated output". Step 1's own instruction — "If diff shows changes, review them" — then invites reverting the very change being shipped.

Concretely, preparing #38 the diff was:

< "first_day": { "type": ["integer", "string"] }
---
> "first_day": { "type": ["integer", "string"] },
> "readonly": { "enum": [0, 1], … },
> "disabled": { "enum": [0, 1], … }

Every entry on the > side was the change under release. Nothing was actually wrong.

It also means the check silently under-delivers on its stated purpose: with the old code loaded, it compares the previous release against live ACF. That still catches ACF version drift — which is most of the value, and why this has not bitten before — but it cannot catch drift introduced by the release itself.

Suggested direction

Something that pins which copy runs, e.g.:

  • run the generator against a WP install that does not require the package, or
  • assert the loaded class path up front and fail if it is not the working copy — cheap, and it turns a silent wrong answer into a loud one, or
  • note the trap in RELEASING.md so the reviewer knows to expect the release's own edits on the > side.

The third alone would have been enough here; I only noticed because the diff was suspiciously exactly my own change.

No PR opened — the right fix depends on how you want the check to run, and the doc change and the code change are different calls. Happy to do either.

Found while releasing v0.7.6.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions