Skip to content

Reorganize compiler code into src-compile directory#132

Draft
koriym wants to merge 3 commits into1.xfrom
claude/separate-compiled-injector-01QLnL9zQtJ8WAo5HSNBBWhZ
Draft

Reorganize compiler code into src-compile directory#132
koriym wants to merge 3 commits into1.xfrom
claude/separate-compiled-injector-01QLnL9zQtJ8WAo5HSNBBWhZ

Conversation

@koriym
Copy link
Copy Markdown
Member

@koriym koriym commented May 2, 2026

Summary

This PR reorganizes the Ray.Compiler codebase by moving all compilation-related code into a dedicated src-compile directory, while keeping runtime code in src. This is a preparatory step toward the proposed separation of runtime (CompiledInjector) and build-time (Compiler) concerns.

Key Changes

  • Directory restructuring: Moved all compiler implementation files from src/ to src-compile/:

    • Compiler.php, CompileVisitor.php, InstanceScript.php, Scripts.php
    • InjectorFactory.php, FilePutContents.php
    • CompilerModule.php, DiCompileModule.php, OverrideLazyModule.php, LazyModuleInterface.php
    • Annotation/Compile.php
    • Exception/ subdirectory with compilation-specific exceptions
  • Configuration updates: Updated all analysis and linting tools to include the new src-compile directory:

    • composer.json: Added src-compile to PSR-4 autoload paths and script commands
    • phpcs.xml: Added src-compile to checked files
    • phpstan.neon: Added src-compile to analysis paths
    • psalm.xml: Added src-compile to project files

Implementation Details

  • The src/ directory now contains only runtime code (CompiledInjector, ScriptInjectorInterface, InjectionPoint, Types, and runtime exceptions)
  • The src-compile/ directory contains all build-time compilation logic
  • All autoloading and analysis tools continue to work seamlessly with both directories under the Ray\Compiler\ namespace
  • This separation enables future extraction of runtime code into a separate ray/compiled-injector package while maintaining backward compatibility

Related

This change implements the directory structure proposed in SEPARATION_PROPOSAL.md, which outlines the full separation of runtime and compiler concerns for improved security and reduced deployment size.

https://claude.ai/code/session_01QLnL9zQtJ8WAo5HSNBBWhZ

This proposal outlines the plan to split Ray.Compiler into two packages:
- ray/compiled-injector: Runtime execution (11KB, production dependency)
- ray/compiler: Build tool (35KB, dev dependency)

Benefits:
- Security: Remove compilation code from production
- Size: 75% reduction in production deployment
- Clarity: Clear separation of runtime vs build-time concerns
- Simple migration: Only composer.json changes needed

The proposal includes:
- Detailed implementation plan (Phase 1-3)
- File classification and migration checklist
- Package structure and composer.json specifications
- Migration guide for existing users
…erns

Move build-time files (Compiler, CompileVisitor, etc.) from src/ to
src-compile/ to clarify the separation between runtime and compile-time
concerns. Runtime files (CompiledInjector, InjectionPoint, etc.) remain
in src/.

This is a structural reorganization only:
- No namespace changes (Ray\Compiler\* preserved)
- No public API changes
- Full backward compatibility via PSR-4 multi-path autoload
- Sets up future option to extract a ray/compiled-injector package

Updates:
- 14 files moved to src-compile/ via git mv (history preserved)
- composer.json: autoload paths + cs/cs-fix/metrics/phpmd scripts
- phpstan.neon, psalm.xml, phpcs.xml: include src-compile

Verified:
- composer test: 88 tests, 149 assertions PASS
- composer cs: PASS
- psalm: No errors
- phpstan: No errors

https://claude.ai/code/session_01QLnL9zQtJ8WAo5HSNBBWhZ
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cf2f4ef4-7410-40d5-8960-e99ef4e453ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/separate-compiled-injector-01QLnL9zQtJ8WAo5HSNBBWhZ

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9e3a2d0) to head (2829c16).

Additional details and impacted files
@@             Coverage Diff              @@
##                 1.x      #132    +/-   ##
============================================
  Coverage     100.00%   100.00%            
+ Complexity        93        25    -68     
============================================
  Files             11         2     -9     
  Lines            232        64   -168     
============================================
- Hits             232        64   -168     

☔ View full report in Codecov by Sentry.
📢 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.

The proposal file was a planning artifact and is no longer needed
now that the structural reorganization (src/ vs src-compile/) has
been implemented.

https://claude.ai/code/session_01QLnL9zQtJ8WAo5HSNBBWhZ
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