Skip to content

fix(demos): repair the AOP switch and split the demo into backend and frontend - #766

Merged
lisachenko merged 1 commit into
masterfrom
feature/tender-ritchie-gllx0a
Oct 14, 2026
Merged

lisachenko merged 1 commit into
masterfrom
feature/tender-ritchie-gllx0a

Conversation

@lisachenko

Copy link
Copy Markdown
Member

What and why

Bug: with AOP switched off, the demo page crashed halfway through rendering. The source panels called MagicConstantTransformer::resolveFileName(), which needs the aspect kernel, and the kernel isn't booted in that mode. The fatal error cut the page off before the Bootstrap bundle and the switch script were output, so the switch stuck on "Off" and none of the dropdown menu items could be clicked.

Restructure: the backend and frontend are now in separate files:

Part Files
Front controller demos/index.php (~45 lines): stores the switch state, runs the selected showcase, renders the template
Backend Demo\Showcase\{Showcase, ShowcaseCatalog, ShowcaseResult, SourceCode}: the catalog of examples, each with its scenario closure. Only woven classes (Proxy) have their file name resolved back from the cache
Template demos/templates/page.php: plain HTML, only escaping and loops
Styles / behaviour demos/assets/demo.css, demos/assets/demo.js

Demo\Highlighter is removed; highlighting is done in the browser with highlight.js.

UI:

  • AOP switch: a real switch, posted to the server, which sets the cookie and redirects back, so it works without JavaScript.
  • Navigation: the examples are in a sidebar of plain links, which becomes a drawer on mobile. There are no more dropdowns.
  • Design: light and dark themes that follow the system setting, an animated gradient background, translucent "glass" panels and a landing page with one card per example.
  • Example pages: the output is shown in a terminal-style panel with the run time. The usage code, aspect and class are in source tabs, with syntax highlighting and copy buttons.

CI: the demo smoke test used to grep case '…' lines out of index.php. It now lists the showcases from the catalog and renders every page with AOP on and off. It also checks that each page is rendered all the way to </html>, which catches the original bug: the old code fails this check.

Checklist

  • The title follows Conventional Commits (type(scope): summary)
  • Tests cover the change (the CI demo smoke test now covers both AOP modes and complete rendering)
  • composer check passes (php-cs-fixer clean, phpstan level 10 clean, phpunit 3104 tests OK)
  • User-facing or breaking changes are in CHANGELOG.md (not applicable: the demos are not part of the package)

🤖 Generated with Claude Code

https://claude.ai/code/session_01TkXmBX6yR2tyL4TqAzphcm


Generated by Claude Code

… frontend

With AOP switched off the page died halfway: resolving the source file of a
showcase called MagicConstantTransformer::resolveFileName(), which needs the
aspect kernel that is not booted in this mode. The fatal error cut the page
before the Bootstrap bundle and the switch script, so neither the dropdown
menus nor the switch reacted any more.

The demo is now split:
- index.php is a small front controller: it stores the switch state and runs
  the selected showcase
- Demo\Showcase holds the showcases (catalog, runner, result, source code);
  only woven classes (Proxy) have their file name resolved to the original
- templates/page.php is the HTML, assets/demo.css and assets/demo.js the
  styles and the behaviour of the page

The AOP switch is a form posted to the server, which keeps the state in a
cookie and redirects back, so it works without JavaScript. The navigation is
a plain sidebar (a drawer on small screens) instead of Bootstrap dropdowns.
The new design has light and dark themes, a landing page with a card per
example, the output in a terminal panel, the usage code, the aspect and the
class in source tabs highlighted with highlight.js, and copy buttons.

The CI smoke test lists the showcases from the catalog and renders every
page with AOP on and off, checking that it is rendered completely.

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

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.81%. Comparing base (f8e80c1) to head (e94fb36).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #766   +/-   ##
=========================================
  Coverage     97.81%   97.81%           
  Complexity     1841     1841           
=========================================
  Files           104      104           
  Lines          4849     4849           
=========================================
  Hits           4743     4743           
  Misses          106      106           

☔ 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.

@lisachenko
lisachenko marked this pull request as ready for review October 14, 2026 11:43
@lisachenko
lisachenko merged commit 02b9a4c into master Oct 14, 2026
14 checks passed
@lisachenko
lisachenko deleted the feature/tender-ritchie-gllx0a branch October 14, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants