Skip to content

Playground demos: open on a demo page covering every input format - #102

Merged
dknauss merged 2 commits into
mainfrom
claude/keen-tesla-49orwb
Sep 26, 2026
Merged

dknauss merged 2 commits into
mainfrom
claude/keen-tesla-49orwb

Conversation

@dknauss

@dknauss dknauss commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

What changed?

The release, main-build, and WordPress.org Preview blueprints now open the block editor on a generated demo page. Before, they opened a one-block starter.

  1. Section 1: samples of every accepted input. Copy-ready code blocks, grouped by format, above an empty Bibliography block:

    • DOI: bare, doi:, and a doi.org link.
    • PMID and PMCID.
    • arXiv: modern, legacy, arxiv.org link, and an arXiv DOI.
    • ISBN: labeled ISBN-13, bare ISBN-13, and ISBN-10.
    • BibTeX and BibLaTeX.
    • Formatted book, journal article, chapter, and webpage citations, plus one with an embedded DOI.

    23 samples in total, well under the 50-per-paste limit.

  2. Section 2: brief feature notes. Styles, editing entries, manual entry, duplicates, ordering, exports, per-entry Cite / Export, machine-readable output, and a link to the post's read-only REST data.

  3. Section 3: example bibliographies.

    • The three examples are Chicago notes-bibliography with Cite / Export and COinS, APA 7, and IEEE.
    • At boot they are formatted by the plugin's own citeproc formatter and rendered by its PHP port of save() from Phase 05 M2 spike: PHP save() port with parity harness; M1 review-route fixes #97. They therefore validate against whatever version the blueprint installs.
    • A release without the port (anything before 1.7.0) shows a note in their place.
    • Citations are stored in display order, together with the export strings the editor computes. The untouched page therefore opens with no unsaved changes.
  4. Welcome Guide. It is turned off (the core/edit-post persisted preference), so the page is what opens.

Maintenance.

  • The page is defined once, in playground/demo-content.json (the data) and playground/demo-content.php (the writer).
  • Blueprints can't load repository files, so npm run playground:build inlines both into each blueprint's runPHP step. It also reformats short arrays in the blueprints, which is cosmetic.
  • The new src/playground-demo.test.js fails when:
    • a blueprint is stale;
    • a sample stops reaching the parser backend it claims (the test runs offline, and each resolver's error identifies the route);
    • the samples stop covering every format;
    • the stored export strings drift from computeExportStrings.
  • playground/ joins scripts/ in the exclusions for the first-party PHP metric, since it never ships (it is already in .distignore).

Why? So visitors can try every input format and the key features without having to find their own identifiers.

Heads-up, not changed here: the bundled CSL styles in packages/citation-style-language-styles/ are about 2 KB, project-written stand-ins. So "APA" and "Chicago" output initializes given names and omits volume, issue, and pages. The examples show exactly what the editor produces.

Validation

  • npm run lint:js passes
  • npm run lint:css: no CSS changes
  • npm run lint:i18n: no source strings changed
  • npm run test passes (872 passed)
  • npm run build succeeds
  • Tested in the block editor. I ran the generated main blueprint in a local Playground (CLI 3.1.40, WordPress trunk, this build mounted) and checked it in Chromium:
    • all 44 blocks are valid, including the 4 bibliographies;
    • the editor reports no unsaved changes;
    • no Welcome Guide appears;
    • the front end renders every bibliography with its Cite / Export panels.
  • verify-metrics.sh passes

I haven't run the hosted playground.wordpress.net Playground: WordPress.org is blocked in this sandbox. The runPHP step uses only core APIs plus the plugin's own functions, and those calls are guarded with function_exists.

Checklist

  • Linked issue or explained why none was needed: requested directly (demo coverage of every input format).
  • No sensitive details disclosed publicly

🤖 Generated with Claude Code

https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2


Generated by Claude Code

The release, main-build, and WordPress.org Preview blueprints now open the
editor on a generated demo page instead of a one-block starter:

- Copy-ready samples of every accepted input: DOI (bare, doi:, doi.org
  link), PMID, PMCID, arXiv (modern, legacy, link, arXiv DOI), ISBN-13 and
  ISBN-10, BibTeX and BibLaTeX, and formatted book, article, chapter, and
  webpage citations (one with an embedded DOI), above an empty block.
- Brief notes on the key features.
- Three example bibliographies (Chicago notes with Cite / Export, APA 7,
  IEEE), formatted by the plugin's own formatter and rendered by its PHP
  port of save() at boot, so they validate against whatever version the
  blueprint installs; releases without the port get a note instead. They
  are stored sorted and with the editor's export strings, so the untouched
  page opens with no unsaved changes.
- The Welcome Guide is turned off so the page is what opens.

The page is defined once in playground/demo-content.{json,php};
`npm run playground:build` inlines it into each blueprint's runPHP step.
src/playground-demo.test.js fails on a stale blueprint, on a sample that
stops reaching the parser backend it claims, and on export strings that
drift from what the editor computes. playground/ joins scripts/ in the
first-party PHP metric's exclusions, since it never ships.

Checked in a local Playground (CLI 3.1.40, WordPress trunk, this build):
all 44 blocks valid, no unsaved changes, no Welcome Guide, and the front
end renders all four bibliographies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2
@dknauss
dknauss marked this pull request as ready for review September 26, 2026 16:17
@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.65%. Comparing base (3afed26) to head (70468c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #102   +/-   ##
=======================================
  Coverage   86.65%   86.65%           
=======================================
  Files          52       52           
  Lines        5367     5367           
  Branches      597      597           
=======================================
  Hits         4651     4651           
  Misses        235      235           
  Partials      481      481           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dknauss
dknauss merged commit cd4a381 into main Sep 26, 2026
16 checks passed
@dknauss
dknauss deleted the claude/keen-tesla-49orwb branch September 26, 2026 16:26
dknauss pushed a commit that referenced this pull request Sep 26, 2026
Full GPL CSL styles and locales (#103), Phase 05 M0-M3 (stable IDs,
review routes and abilities, opt-in citation and block write routes:
#104, #106), the save-markup language fix, reference-manager .bib
fixes, the Playground demo page (#102), and the runtime matrix on the
release package with formatter-parity and write-route checks (#105).

Version bumped in the plugin header, block.json, readme.txt Stable tag,
the POT header, and the package manifests. CHANGELOG [Unreleased] is
dated as 1.7.0; readme.txt gains a user-facing changelog entry, an
Upgrade Notice, and an FAQ note on the opt-in write routes. README
highlights and STATE/ROADMAP move to the 1.7.0 baseline.

Tested up to stays 7.1: WordPress latest is 7.1.2, which CI's runtime
matrix exercises, including formatter parity across all nine styles.

package-release.sh now also prunes .git directories from vendor/. When
Composer falls back from dist to a git clone (as it did in this
sandbox), the ZIP otherwise carried 4 MB of git metadata.

Release checklist gates run locally: lint:js, lint:css, lint:i18n,
npm audit (0), composer audit (none), Jest 873 passed / 2 skipped,
PHPUnit 318 OK (the 4 vendor deprecations already on main), build,
package:release (552,718-byte ZIP). citeproc-php v2.7.1 is current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2
@dknauss dknauss mentioned this pull request Sep 26, 2026
9 tasks done
dknauss added a commit that referenced this pull request Sep 26, 2026
* chore(release): 1.7.0

Full GPL CSL styles and locales (#103), Phase 05 M0-M3 (stable IDs,
review routes and abilities, opt-in citation and block write routes:
#104, #106), the save-markup language fix, reference-manager .bib
fixes, the Playground demo page (#102), and the runtime matrix on the
release package with formatter-parity and write-route checks (#105).

Version bumped in the plugin header, block.json, readme.txt Stable tag,
the POT header, and the package manifests. CHANGELOG [Unreleased] is
dated as 1.7.0; readme.txt gains a user-facing changelog entry, an
Upgrade Notice, and an FAQ note on the opt-in write routes. README
highlights and STATE/ROADMAP move to the 1.7.0 baseline.

Tested up to stays 7.1: WordPress latest is 7.1.2, which CI's runtime
matrix exercises, including formatter parity across all nine styles.

package-release.sh now also prunes .git directories from vendor/. When
Composer falls back from dist to a git clone (as it did in this
sandbox), the ZIP otherwise carried 4 MB of git metadata.

Release checklist gates run locally: lint:js, lint:css, lint:i18n,
npm audit (0), composer audit (none), Jest 873 passed / 2 skipped,
PHPUnit 318 OK (the 4 vendor deprecations already on main), build,
package:release (552,718-byte ZIP). citeproc-php v2.7.1 is current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2

* Parse each CSL style once per format request

CiteProc::render() calls init() every time, which builds a new Context,
reads and parses the locale file, and rebuilds the style's object tree:
about 3 ms, against well under 1 ms to render an entry. With one render
per entry (the fix that stopped an "et al." entry from dropping the
next entry's "and"), 50 entries took about 90 ms, against about 8 ms in
1.6.0 with its short stand-in styles.

Bibliography_Builder_Reusable_CiteProc parses once, records every
property of every object in the parsed style tree, and before each later
render restores them, resets the Context's per-render lists, and zeroes
Layout's static cited-item counter. Each entry renders against the state
a fresh parse would give it: 50 entries now take about 25 ms.

The nine style goldens still match byte for byte. A new test formats the
corpus in reverse order, putting the "et al." and APA 21+ entries ahead
of the short author lists, and requires every entry to match its golden
line; with the restore disabled, both the goldens and the new test fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2

* Drop the #[\Override] attribute from the reusable formatter

PHP 7.4 reads an attribute on its own line as a comment (php -l on
7.4 passes, and so does the PHP 7.4 runtime smoke), but Copilot flagged
it as a 7.4 parse error, and compatibility scanners can do the same. It
does nothing at runtime, so drop it, and turn off Psalm's
MissingOverrideAttribute, which cannot apply to a plugin that supports
PHP 7.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2

---------

Co-authored-by: Claude <noreply@anthropic.com>
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