Better enforce core fidelity for canonical backports

Aperta
#47 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@nikmclaughlin ci sta già lavorando.

Dal 1/12/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Our initial intent when backporting abilities from Core WP was to make the package versions as identical as possible to their Core counterparts, including class and file structures. However, I've found that exact matching is impractical given this package's requirements for usable ability declarations (esp. Registrar needing a class wrapper).

As such, I'd like us to codify the process for (1) copying exact ability code from Core as package fixtures, and then (2) generating usable ability code in the package based on those fixtures. While this means accepting some difference between what ships in Core vs. this package, I think that difference is inevitable so it's best to be explicit about, and having the fixtures + codegen tooling + generated artifacts all in one place here gives us a verifiable pipeline for code coming back from Core.


[🤖 Below is an AI write-up of the decision after an exchange related to reviewing #36, which includes more context and a more specific proposal]

Decision: Canonical (core-landed) abilities ship as two artifacts: (1) a byte-exact excerpt fixture pinned to the immutable core release tag it canonizes, and (2) loadable classes that are byte-exact mechanical projections of that fixture, produced by the canonical transform. Hand edits to either are CI-rejected. Coexistence-required edits (namespaces, load guards, provenance meta) live in a fixed wrapper outside the copied region and are excluded from the fidelity claim.

Why not literally copy core's files into the package:

  • A byte-identical paste is a redeclaration fatal on any site core also ships (wp_register_core_abilities(), WP_Abilities_*); the only escapes — guards, renames — are exactly the mutation that destroys byte-identity, so file-level byte-identity can't survive coexistence.
  • The manifest engine is class-addressed; a procedural paste can't ship, so any realistic form has a wrapper and the enforceable rule is projection identity, not file identity.
  • "Copy the core file" is ambiguous once core has multiple eras (6.9 procedural → 7.2 class files; the info trio itself was reworked in changesets r62396…r64729). Pinning the era's release tag disambiguates — which is what the fixture already is.

What #36 surfaced: the hand-port drifted by whitespace from core and passed the gate, because verify:coreify does a semantic token diff that skips whitespace; the fixtures carry byte-exact core text but are trusted, not verified, against the tag they cite.

Work:

  1. reindent(): leave whitespace-only lines empty so reverse output is byte-stable.
  2. Byte gate: reverse(fixture) ≡ package file, and forward(output) ≡ fixture, byte-for-byte, scoped to the copied region so wrapper evolution doesn't churn canonical files.
  3. Fixture fidelity: pin core blob SHAs (6.9.0 abilities.php = 0320df3b9f38a9fd2d2b73e284a7b14271c545ff) and verify each fixture is a mechanical slice of that tag in CI.
  4. Fix the whitespace drift merged in #36: src/Info/Get_Site_Info.php:19, $category_site padded vs core's $category_site = 'site';.
  5. Document the rule and the post-6.9 era ledger (r62396…r64729) in README/NAME-LIFECYCLE so package–core deltas read as accounted-for history.
Lingua principale
PHP
Stelle
4
Fork
4
Merge medio
1g 23h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/abilities

Tutte le issue di WordPress/abilities

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.