Skip to content

chore: migrate from deptrac to structarmed#1336

Merged
samsonasik merged 5 commits into
codeigniter4:developfrom
samsonasik:migrate-deptrac-to-structarmed
Jun 5, 2026
Merged

chore: migrate from deptrac to structarmed#1336
samsonasik merged 5 commits into
codeigniter4:developfrom
samsonasik:migrate-deptrac-to-structarmed

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Jun 4, 2026

Description

This PR try to migrate deptrac to structarmed, the vendor parts seems no need to be included in layer definition, structarmed treats dependencies on classes that don't match any defined layer as external/unregistered and automatically allows them, and src/Views/ contains only PHP template files with no class or namespace declarations, so no PHP class would ever match a View layer pattern regardless

Let me know if there is a catch so I can improve in structarmed first itself if possible.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik
Copy link
Copy Markdown
Member Author

Ready for review/merge 👍

Comment thread .github/workflows/structarmed.yml Outdated
Comment thread .github/workflows/structarmed.yml Outdated
Comment thread .github/workflows/structarmed.yml Outdated
@datamweb datamweb added the github_actions Pull requests that update GitHub Actions code label Jun 4, 2026
samsonasik and others added 3 commits June 4, 2026 20:23
Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
@samsonasik
Copy link
Copy Markdown
Member Author

@datamweb review applied 👍

@samsonasik samsonasik requested a review from datamweb June 4, 2026 13:23
@datamweb
Copy link
Copy Markdown
Collaborator

datamweb commented Jun 4, 2026

structarmed treats dependencies on classes that don't match any defined layer as external/unregistered and automatically allows them

Since structarmed allows all unregistered classes by default, it seems the only way to forbid vendor usage in a specific layer is to explicitly register those vendor namespaces via layerPattern(), and then omit them from the ruleset.
Is registering vendors as layers the recommended approach in structarmed to achieve strict boundaries? Or do you plan to add a feature like a strict mode (deny unregistered by default for specific layers)?

Copy link
Copy Markdown
Collaborator

@datamweb datamweb left a comment

Choose a reason for hiding this comment

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

LGTM!

@samsonasik
Copy link
Copy Markdown
Member Author

@datamweb I think I need a real violation example first for that, eg use of:

new \CodeIgniter\Controller();

on specific part, which not allowed. That will may use MayNotDependOnRule, probably something like:

    ->layer('CI_Vendor_Controller', ....)
    ->rule(
        'entity.must_not_use_ci_controller',
        new MayNotDependOnRule(from: 'Model', to: 'CI_Vendor_Controller')
    )

@samsonasik
Copy link
Copy Markdown
Member Author

Thank you @datamweb @michalsn , let's merge 👍

@samsonasik samsonasik merged commit 7d08382 into codeigniter4:develop Jun 5, 2026
38 checks passed
@samsonasik samsonasik deleted the migrate-deptrac-to-structarmed branch June 5, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants