Skip to content

[PHP-WASM] Track PHP log replacement separately for each Playground - #4392

Merged
adamziel merged 1 commit into
trunkfrom
codex/php-log-replacement-tracking
Oct 7, 2026
Merged

adamziel merged 1 commit into
trunkfrom
codex/php-log-replacement-tracking

Conversation

@adamziel

@adamziel adamziel commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Track the last PHP log separately for each Playground and emit only the unread suffix.

An import can replace debug.log with a shorter file or a different file of the same length. A shared length counter missed those errors and also leaked read offsets between Playgrounds. Reuse a prefix only when the current log still starts with the text already read.

This is PR 8 extracted from #4373. Targets trunk directly; no dependency on the other split PRs.

Testing

Append to debug.log, replace it, then remove and recreate it. Check that each new record reaches Logs once. The tests also create two collectors with different log lengths.

Summary by CodeRabbit

  • Bug Fixes
    • PHP log collection now detects new content when a log is replaced or cleared and rewritten, including when the replacement has the same length as the previous contents.
    • Separate Playground log collectors now track their progress independently, preventing one collector from affecting which log entries another collects.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f56fcdf5-7c61-4fe5-8dd2-ac1d7068fcdf
📥 Commits

Reviewing files that changed from the base of the PR and between 769e72b and eff9ec3.

📒 Files selected for processing (2)
  • packages/php-wasm/logger/src/lib/collectors/collect-php-logs.spec.ts
  • packages/php-wasm/logger/src/lib/collectors/collect-php-logs.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

PHP log collection now tracks previous log contents separately for each collector. It emits only appended content when the new log retains the previous contents as a prefix, and emits the full log when the contents change.

Changes

PHP log collection

Layer / File(s) Summary
Per-collector content tracking
packages/php-wasm/logger/src/lib/collectors/collect-php-logs.ts, packages/php-wasm/logger/src/lib/collectors/collect-php-logs.spec.ts
The collector compares each log with its previous contents and emits the suffix or full log. Tests cover repeated content, replacement, removal, and separate collectors.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to eff9e

No actionable merge-blocking risk remains; the change is ready for normal merge checks.

🚥 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 clearly describes the main change: tracking PHP log replacements separately for each Playground.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@adamziel
adamziel merged commit 0e8d732 into trunk Oct 7, 2026
@adamziel
adamziel deleted the codex/php-log-replacement-tracking branch October 7, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant