-
Notifications
You must be signed in to change notification settings - Fork 16
feat: programmatic architectural enforcement via ESLint boundaries #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
yanekyuk
wants to merge
3
commits into
indexnetwork:dev
from
yanekyuk:feat/architectural-enforcement
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Run architectural boundary checks on PRs to dev. | ||
| # | ||
| # Enforces protocol layering rules (eslint-plugin-boundaries) | ||
| # and adapter naming conventions. | ||
| # | ||
| # NOTE: Only boundary violations fail the check. Pre-existing lint | ||
| # errors (no-explicit-any, no-unused-vars) are not gated here yet. | ||
| # Full lint enforcement is tracked separately. | ||
| name: Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [dev] | ||
|
|
||
| concurrency: | ||
| group: lint-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: "1.2.20" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| bun install | ||
| cd protocol && bun install | ||
|
|
||
| - name: Check architectural boundaries | ||
| run: | | ||
| cd protocol | ||
| bunx eslint src/ --format json 2>/dev/null | bun -e ' | ||
| const results = JSON.parse(await Bun.stdin.text()); | ||
| const violations = results | ||
| .flatMap(r => r.messages.filter(m => m.ruleId === "boundaries/dependencies")) | ||
| .map((m, i, _, r = results.find(r2 => r2.messages.includes(m))) => | ||
| `${r?.filePath}:${m.line} - ${m.message}` | ||
| ); | ||
| if (violations.length > 0) { | ||
| console.log("❌ Architectural boundary violations found:\n"); | ||
| violations.forEach(v => console.log(` ${v}`)); | ||
| console.log(`\n${violations.length} violation(s) total.`); | ||
| process.exit(1); | ||
| } else { | ||
| console.log("✅ No architectural boundary violations."); | ||
| } | ||
| ' | ||
|
|
||
| - name: Check adapter naming conventions | ||
| run: ./scripts/check-adapter-names.sh | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 105
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 1308
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 1058
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 193
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 1248
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 69
🏁 Script executed:
cat -n protocol/eslint.config.mjs | head -100Repository: indexnetwork/index
Length of output: 4165
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 1652
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 610
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 1258
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 2439
🏁 Script executed:
Repository: indexnetwork/index
Length of output: 4968
Fail this job on ESLint fatal/parser errors.
The step filters ESLint JSON output to only catch
ruleId === "boundaries/dependencies"violations. Parser/fatal errors haveruleId: nulland are not caught by this filter, allowing malformed TypeScript to pass the check.Suggested guard
🧰 Tools
🪛 actionlint (1.7.11)
[error] 35-35: shellcheck reported issue in this script: SC2016:info:2:53: Expressions don't expand in single quotes, use double quotes for that
(shellcheck)
🤖 Prompt for AI Agents