feat(scan): platform profile JSON loader and ScanConfig merge (#362) - #682
Conversation
Introduce bundled JSON validation presets with inheritance, merge into ScanConfig after defaults, and wire qtmesh scan --profile / profile: in project config ahead of local rules and CLI overrides. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughIntroduces platform profiles: JSON profile files, a loader API, applyPlatformProfile, ScanConfig refactor for project-file application, CLI flags ChangesPlatform Profile Foundation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 780077b94b
ℹ️ 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".
| COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
| ${CMAKE_SOURCE_DIR}/profiles | ||
| $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/profiles |
There was a problem hiding this comment.
Install bundled profiles with packaged binaries
This post-build copy makes --profile/--list-profiles work from the build tree, but I checked the install/package rules: the top-level install(TARGETS ...) only installs the binary to bin, and there is no matching install(DIRECTORY profiles ...) like media/CMakeLists.txt has for media. In installed DEB/CPack builds, QCoreApplication::applicationDirPath() will be the installed binary directory and none of the searched profiles locations will exist, so qtmesh scan --list-profiles returns “No built-in platform profiles found” and built-in profile ids cannot be used unless users manually provide QTMESH_PROFILES_DIR.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Installed bundled profiles by adding \ + , so packaged installs get \ like the build tree.
There was a problem hiding this comment.
Installed bundled profiles by adding profiles/CMakeLists.txt + ADD_SUBDIRECTORY(profiles), so packaged installs get <bin>/profiles/*.json like the build tree.
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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 `@src/CLIPipeline.cpp`:
- Around line 3989-3999: The list-profiles early-exit and the config/profile
source selection paths lack Sentry breadcrumbs; add
SentryReporter::addBreadcrumb calls: when handling the listProfiles branch
(before printing and before returning) call
SentryReporter::addBreadcrumb("ui.action", "cli: list-profiles (found N
profiles)") and include the directory via
PlatformProfileLoader::builtinProfilesDirectory(); for each config/profile
selection branch (the config flag branch, the local auto-config branch, and the
profile load branch referenced around the other config/profile branches) add
breadcrumbs like SentryReporter::addBreadcrumb("file.import", "config: loaded
from --config <path>"), SentryReporter::addBreadcrumb("file.import", "config:
loaded from local auto-config"), and
SentryReporter::addBreadcrumb("ai.tool_call", "profile: loaded <profileId>")
respectively; place these calls near the existing cliWrite/return points and
where PlatformProfileLoader::listBuiltinIds() or the config/profile resolution
occurs so Sentry has a clear trace of user-visible actions.
In `@src/PlatformProfile.cpp`:
- Around line 152-174: The profile discovery functions lack Sentry
breadcrumbs—add SentryReporter::addBreadcrumb(...) calls to record key
user-facing actions and failures: in
PlatformProfileLoader::builtinProfilesDirectory() add a breadcrumb when a
candidate directory is checked (category "file.import" or "ui.action" with
message indicating the candidate path) and another breadcrumb when a directory
is found (e.g., "builtin profiles directory found: <path>"); in
PlatformProfileLoader::listBuiltinIds() add a breadcrumb at function entry
(category "file.import" message "listBuiltinIds called"), a breadcrumb when
dirPath is empty/failure (category "file.import" message "no builtin profiles
directory"), and a breadcrumb after collecting ids (category "file.import"
message "found N builtin profiles"), using the actual values (dirPath, count) in
the message to aid diagnostics and ensure calls reference
SentryReporter::addBreadcrumb directly.
- Around line 61-67: warnUnknownRuleKeys is being called and then
filterKnownRuleKeys emits the same warnings again, producing duplicates for
scope.pathPattern; fix by ensuring unknown-rule warnings are emitted only once:
call warnUnknownRuleKeys(rawRules, QStringLiteral("profile scope
'%1'").arg(scope.pathPattern), warnings) once, then make
filterKnownRuleKeys(rawRules, QStringLiteral("profile scope
'%1'").arg(scope.pathPattern), warnings) skip emitting warnings (either add a
suppressWarnings/skipWarnings parameter or remove its internal warning logic)
and return the filtered rules to assign to scope.rules to avoid double-reporting
the same keys.
- Around line 263-271: The code currently only assigns result.profile.id from
displayIdHint when id is missing, allowing a built-in profile to declare a
conflicting id; update the logic to detect and reject mismatched ids early:
after parsing (where result.profile.id is available) add a check that if
displayIdHint is non-empty and result.profile.id is non-empty and
result.profile.id != displayIdHint then set result.error (include absolutePath,
result.profile.id and displayIdHint in the message) and return result so
conflicting built-in ids are refused rather than silently accepted.
In `@src/ScanConfig.cpp`:
- Around line 392-412: In ScanConfig::loadProjectMapFromFile add Sentry
breadcrumbs around the file import/parse flow: call
SentryReporter::addBreadcrumb("file.import",
QString("open_attempt:%1").arg(path)) before attempting QFile::open,
addBreadcrumb("file.import", QString("open_failed:%1").arg(path)) on the open
failure branch, addBreadcrumb("file.import",
QString("parse_attempt:%1").arg(path)) before parsing, then on parse success
call addBreadcrumb("file.import", QString("parse_success:%1").arg(path)) and on
parse failure (both JSON invalid branch and any parse error from
parseSimpleYaml) call addBreadcrumb("file.import",
QString("parse_failed:%1").arg(path)) so open/parse attempts and outcomes for
ScanConfig::loadProjectMapFromFile are recorded.
🪄 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
Run ID: 51c30dab-de68-4a5a-a36e-ba5149b6dbc7
📒 Files selected for processing (11)
CLAUDE.mdprofiles/example-base.jsonprofiles/example-minimal.jsonqtmesh.example.ymlsrc/CLIPipeline.cppsrc/CMakeLists.txtsrc/PlatformProfile.cppsrc/PlatformProfile.hsrc/PlatformProfile_test.cppsrc/ScanConfig.cppsrc/ScanConfig.h
- Add PlatformProfile.cpp to tests/CMakeLists TEST_SRC_FILES (fixes CI link). - Install bundled profiles/ with packaged binaries. - Reject built-in profile id mismatches; dedupe scope rule warnings. - Add Sentry breadcrumbs for scan profile/config paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Use QTMESH_PROFILES_DIR so the loader resolves by id and exercises the displayIdHint mismatch guard. Co-authored-by: Cursor <cursoragent@cursor.com>
QVERIFY is a Qt Test macro; PlatformProfile_test uses Google Test. Co-authored-by: Cursor <cursoragent@cursor.com>
Emit breadcrumbs for scan config open/parse outcomes and platform profile load/list/apply steps to improve diagnosability. Co-authored-by: Cursor <cursoragent@cursor.com>
|



Summary
profiles/with aPlatformProfileLoaderthat resolves built-in ids, file paths, andextendsinheritance.ScanConfigin order: defaults → profile → project config → CLI flags.qtmesh scan --profile <id>,profile:inqtmesh.yml, and--list-profiles.Test plan
UnitTests --gtest_filter="PlatformProfile*:ApplyPlatformProfile*"(9 tests)UnitTests --gtest_filter="ScanConfig*"(37 tests)./qtmesh scan --list-profileslistsexample-baseandexample-minimalCloses #362
Made with Cursor
Summary by CodeRabbit
New Features
Documentation
Tests