Skip to content

Add demo composer scripts and stree outputs - #20

Merged
koriym merged 1 commit into
1.xfrom
codex/demo-composer-scripts
Apr 24, 2026
Merged

koriym merged 1 commit into
1.xfrom
codex/demo-composer-scripts

Conversation

@koriym

@koriym koriym commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Align demo composer.json files with the current demo dependency baseline by updating PHPUnit to ^12.
  • Add dev, profile, stree, and stree:full Composer scripts to the demos that have bin/be.php dev entrypoints.
  • Commit generated stree.txt and stree-full.txt outputs for the four runnable semantic-log demos.

Validation

  • Ran composer update for all eight demos.
  • Ran composer dev for hello-world, user-registration, order-processing, and medical-triage.
  • Ran composer stree and composer stree:full for those four demos and saved the outputs.
  • Ran composer validate --no-check-publish for all eight demos. Composer reported only the existing license warning; one run also warned that the local Composer cache was not writable and proceeded without cache.

Summary by CodeRabbit

  • Chores

    • Updated PHPUnit testing dependency from v10 to v12 across all demo projects
    • Added Composer script shortcuts for running demos and generating execution traces
  • Documentation

    • Added semantic execution trace files documenting workflow outputs for hello-world, medical-triage, order-processing, and user-registration demos

@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Multiple demo projects upgrade PHPUnit from v10 to v12 in require-dev, while several add Composer script commands for running demos with profiling and semantic tree visualization. New trace artifact files document representative execution flows for selected demos.

Changes

Cohort / File(s) Summary
PHPUnit Version Upgrade (Simple)
demos/blog-publishing/composer.json, demos/contact-form/composer.json, demos/insurance-claim/composer.json, demos/loan-application/composer.json
Upgraded phpunit/phpunit dev dependency from ^10.0 to ^12.
PHPUnit Upgrade + Composer Scripts
demos/hello-world/composer.json, demos/medical-triage/composer.json, demos/order-processing/composer.json, demos/user-registration/composer.json
Upgraded phpunit/phpunit from ^10.0 to ^12 and added Composer script shortcuts for dev, profile, stree, and stree:full with human-readable descriptions.
Demo Execution Trace Artifacts
demos/hello-world/stree.txt, demos/hello-world/stree-full.txt, demos/medical-triage/stree.txt, demos/medical-triage/stree-full.txt, demos/order-processing/stree.txt, demos/order-processing/stree-full.txt, demos/user-registration/stree.txt, demos/user-registration/stree-full.txt
New text files documenting structured execution traces for representative demo scenarios, showing input flows, processing stages, and final outcomes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Our demos now hop to PHPUnit's latest tune,
With scripts to profile and traces that bloom,
Each stree shows the path from input to done,
A pattern repeated—consistency's won!
Scripts scripts everywhere, semantic flows bright! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add demo composer scripts and stree outputs' accurately describes the main changes: adding Composer scripts and stree output files across multiple demo projects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/demo-composer-scripts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@koriym koriym changed the title [codex] Add demo composer scripts and stree outputs Add demo composer scripts and stree outputs Apr 24, 2026
@koriym
koriym marked this pull request as ready for review April 24, 2026 14:16
@koriym

koriym commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@demos/medical-triage/composer.json`:
- Around line 22-27: The composer scripts "stree" and "stree:full" fail silently
when no var/log/*.json exists and are non-portable; update those scripts to
compute the most-recent log in a portable way (e.g., call a short PHP one‑liner
or a tiny PHP helper that checks glob('var/log/*.json'), returns the latest path
or exits with a clear error) and pass that path to vendor/bin/stree so the
script errors explicitly instead of invoking stree with an empty arg; for the
"profile" script, avoid the hardcoded platform-specific suffix by either
removing the ".so" suffix (use -d extension=xhprof) or document the xhprof
prerequisite in the composer "scripts-descriptions" entry for "profile" so users
know xhprof must be installed/available on their platform.
- Around line 19-21: Run the demo-level PHPUnit suites to verify PHPUnit ^12
compatibility by executing composer install && composer test inside each demo
directory that contains composer.json (the demos referencing "phpunit/phpunit":
"^12"); if tests fail, update the failing test(s) or adjust composer constraints
and regenerate composer.lock (run composer update phpunit/phpunit) until
composer test passes, then commit the updated lockfile or test fixes before
merging.

In `@demos/order-processing/stree-full.txt`:
- Line 4: The demo semantic trace contains a full PAN in the cardNumber field
(seen in OrderInput / PaymentCompleted payloads and the Been/close payload);
update the producer and payload generation to never emit full PANs by either
masking or tokenizing cardNumber (e.g., replace all but last 4 digits with
asterisks) and regenerate the stree artifacts; specifically, modify the upstream
source class that sets payment.cardNumber and the OrderInput/PaymentCompleted
serialization so cardNumber is replaced with a masked value (or removed) before
it is added to Been/close and then re-run the artifact generation to commit the
sanitized trace.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 54a9fbc1-5bba-463c-938a-1740fe6b3ca3

📥 Commits

Reviewing files that changed from the base of the PR and between b82fdd5 and c19d238.

📒 Files selected for processing (16)
  • demos/blog-publishing/composer.json
  • demos/contact-form/composer.json
  • demos/hello-world/composer.json
  • demos/hello-world/stree-full.txt
  • demos/hello-world/stree.txt
  • demos/insurance-claim/composer.json
  • demos/loan-application/composer.json
  • demos/medical-triage/composer.json
  • demos/medical-triage/stree-full.txt
  • demos/medical-triage/stree.txt
  • demos/order-processing/composer.json
  • demos/order-processing/stree-full.txt
  • demos/order-processing/stree.txt
  • demos/user-registration/composer.json
  • demos/user-registration/stree-full.txt
  • demos/user-registration/stree.txt

Comment thread demos/medical-triage/composer.json
Comment thread demos/medical-triage/composer.json
Comment thread demos/order-processing/stree-full.txt
@koriym

koriym commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

Review — rendering verification

Ran vendor/bin/stree and vendor/bin/stree --full against each committed var/log/*.json and diffed against the committed snapshots:

Demo compact full
hello-world MATCH MATCH
user-registration MATCH MATCH
order-processing MATCH MATCH
medical-triage MATCH MATCH

All four JSON logs are valid JSON, and composer run -l shows scripts-descriptions rendering correctly. Re-running composer dev produces structurally identical trees; only timestamp/random values differ (userId date, bcrypt salt, welcome token, reservation/auth/tracking IDs) — expected, not a regression.

Strengths

  • The 4 demos without scripts are exactly the 4 without bin/be.php — scope is consistent.
  • scripts-descriptions is populated, so composer run -l is self-documenting.
  • PHPUnit bump is uniform across all 8 demos, not just the 4 getting new scripts.

Suggestions (non-blocking)

  1. $(ls -t var/log/*.json | head -1) is not portable. Requires a POSIX shell; fails on Windows. A PHP-based fallback (php -r "echo array_slice(glob('var/log/*.json'), -1)[0];") would be portable if cross-platform dev is a goal.
  2. stree silently breaks if var/log/ is empty. ls emits No such file or directory, then stree gets an empty argument. A one-line hint ("run composer dev first") would be friendlier.
  3. profile assumes xhprof is installed locally. Without xhprof, PHP emits a warning and continues. Fine for dev, but scripts-descriptions could mention the prereq.
  4. Snapshot drift risk. stree.txt / stree-full.txt will go stale if demo code changes. Consider a CI check that regenerates and diffs (ignoring volatile fields), or a README note that these are frozen reference renderings.

Verdict

Rendering is correct and deterministic modulo timestamps/randomness. Ship-ready; the polish items above are optional.

@koriym

@koriym
koriym merged commit 8c33433 into 1.x Apr 24, 2026
25 checks passed
@koriym
koriym deleted the codex/demo-composer-scripts branch April 24, 2026 14:30
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.

1 participant