Skip to content

Stack Elevator layer-purity rules#1

Merged
alexstandiford merged 1 commit into
mainfrom
rocky/readiness
Jul 18, 2026
Merged

Stack Elevator layer-purity rules#1
alexstandiford merged 1 commit into
mainfrom
rocky/readiness

Conversation

@alexstandiford

Copy link
Copy Markdown
Contributor

Summary

Part of the Project Rocky agent-readiness wave.

  • Adds two new PHPStan rules enforcing Stack Elevator layer purity:
    • CoreLayerPurityRule — Core-layer classes must not depend on Service- or Platform-layer symbols
    • ServiceLayerPurityRule — Service-layer classes must not depend on Platform-layer symbols
  • Adds StackElevatorLayerResolver and StackElevatorNameExtractor services for classifying symbols into stack layers, plus a StackLayer enum defining the hierarchy
  • Registers the rules and services in extension.neon
  • Adds PHPUnit coverage for both rules with fixture data (clean and violating cases); full suite green (74 tests, 76 assertions)
  • Updates composer.json and README.md accordingly

Assumptions made during this work are logged in the charter-756 assumption log.

🤖 Generated with Claude Code

https://claude.ai/code/session_0138jQKyzwyDfEbbAeMmYNnL

- New CoreLayerPurityRule and ServiceLayerPurityRule enforcing Stack Elevator layer boundaries (Core must not depend on Service/Platform layers; Service must not depend on Platform)
- StackElevatorLayerResolver and StackElevatorNameExtractor services for classifying symbols into stack layers
- StackLayer enum defining the layer hierarchy
- Test coverage for both rules with fixture data across clean and violating cases
- Rules registered in extension.neon; composer.json and README updated

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138jQKyzwyDfEbbAeMmYNnL

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2f087ad5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if ($node instanceof Expr\New_
|| $node instanceof Expr\StaticCall
|| $node instanceof Expr\StaticPropertyFetch
|| $node instanceof Expr\ClassConstFetch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include namespace constant fetches in layer checks

When Core or Service code reads a namespaced constant such as \Novatorius\Fixture\Integration\STRIPE_KEY, PHP-Parser emits Expr\ConstFetch, not Expr\ClassConstFetch, so extract() returns no name and both purity rules miss the lower-layer dependency even though constant fetches are documented as checked. Add handling for Expr\ConstFetch here so namespace constants cannot bypass the layer rules; built-in constants will still be ignored by the existing prefix checks.

Useful? React with 👍 / 👎.

@alexstandiford
alexstandiford merged commit cfac1c3 into main Jul 18, 2026
6 checks passed
@alexstandiford
alexstandiford deleted the rocky/readiness branch July 18, 2026 12:51
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