fix: update dir.go to deny walkthrough non supported file types - #1069
Merged
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesModel registration
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@models/registration/dir.go`:
- Around line 84-95: Normalize the extension returned in the file-filtering
logic before checking nonEntityExtensions, so uppercase variants such as .MD,
.REGO, and .SVG match the existing lowercase entries. Update the extension
handling near filepath.Ext(path) without changing the skip behavior for
supported or already-lowercase extensions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 163c6c44-166a-40c3-93da-71774e072967
📒 Files selected for processing (1)
models/registration/dir.go
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Notes for Reviewers
Description
Model directory registration (
registration.NewDir(...).Register(...)) walks every file in a model package and tries to parse it as an entity definition. Non-JSON/YAML files like OPA.regopolicy scripts (e.g. undermeshery-core/policies/) were being sniffed as YAML (since.regois plain text), then failing JSON parsing — surfacing misleadingunsupported extension for operation 'import'errors during registration.Fix
Skip known non-entity file extensions (
.rego,.template,.svg,.png,.md) early inprocessDir(models/registration/dir.go), before any content parsing is attempted. Genuinely malformed entity files (bad.json/.yaml) still surface as errors — only known non-model assets are ignored.Testing
go build ./...— cleango test ./models/registration/...— passreplaceinmeshery/go.mod— clean.regofiles no longer appear as invalid definitions in~/.meshery/logs/registery/registry-errors.logsSigned commits
Summary by CodeRabbit