Skip to content

feat(init): pre-select features based on project dependencies#595

Draft
MathurAditya724 wants to merge 1 commit intomainfrom
feat/init-feature-detection
Draft

feat(init): pre-select features based on project dependencies#595
MathurAditya724 wants to merge 1 commit intomainfrom
feat/init-feature-detection

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

Summary

Addresses #483

Instead of pre-selecting all features by default in the sentry init wizard, this PR adds dependency-based feature detection to only recommend features that are actually relevant to the project.

Changes

  • New module: src/lib/init/feature-detection.ts - Scans project dependencies and computes recommended features
  • Updated: interactive.ts - Uses detected recommendations instead of selecting all features
  • Updated: types.ts - Added optional recommendedFeatures field to MultiSelectPayload for future server-side recommendations

Feature Detection Matrix

Feature Detection Signals
performanceMonitoring Always ON
logs Always ON
crons node-cron, celery, robfig/cron, etc.
aiMonitoring openai, langchain, anthropic, etc.
sessionReplay Frontend detected (react-dom, vue, next, etc.)
sourceMaps TypeScript or frontend Node.js projects
profiling Backend services
userFeedback Frontend projects
metrics Default OFF (no detection yet)

Platform Support

  • Node.js: package.json (dependencies + devDependencies)
  • Python: requirements.txt, pyproject.toml (PEP 621 + Poetry)
  • Go: go.mod

Backwards Compatibility

  • The recommendedFeatures field is optional, so existing server responses work unchanged
  • When the server doesn't provide recommendations, local detection kicks in

Testing

  • 35 unit tests covering all platforms and feature combinations
  • 19 property-based tests verifying invariants (subset, no duplicates, determinism)

Demo

Before (all features pre-selected):

◆  Which features would you like to enable?
│  ◼ Session Replay
│  ◼ Performance Monitoring (Tracing)
│  ◼ Crons           ← Not relevant for this project
│  ◼ AI Monitoring   ← Not relevant for this project
│  ...

After (only relevant features pre-selected):

◆  Which features would you like to enable?
│  ◼ Session Replay
│  ◼ Performance Monitoring (Tracing)
│  ◻ Crons           ← Unchecked (no scheduler detected)
│  ◻ AI Monitoring   ← Unchecked (no AI packages detected)
│  ...

Instead of pre-selecting all features by default in the init wizard,
analyze project dependencies to only recommend relevant features.

Features are now defaulted to OFF unless:
- They're always-on (performanceMonitoring, logs)
- Positive signals are detected (e.g., node-cron → crons, openai → aiMonitoring)

Detection supports:
- Node.js (package.json)
- Python (requirements.txt, pyproject.toml)
- Go (go.mod)

Also adds optional recommendedFeatures field to MultiSelectPayload
for server-provided recommendations.

Closes #483
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Init

  • Pre-select features based on project dependencies by MathurAditya724 in #595
  • Surface server-provided detail in spinner messages by MathurAditya724 in #588

Other

  • AsyncIterable streaming support for library SDK by BYK in #586

Bug Fixes 🐛

Dashboard

  • Normalize numeric org IDs from DSN auto-detection by BYK in #593
  • Show actionable error messages instead of raw API errors by BYK in #592

Other

  • (auth) Skip stale cached user info for env var tokens in auth status by BYK in #589
  • (upgrade) Move delta patch log.info outside spinner callback by BYK in #590

Internal Changes 🔧

  • Regenerate skill files and command docs by github-actions[bot] in 0276f760

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

129 passed | Total: 129 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1266 uncovered lines.
✅ Project coverage is 95.73%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.68%    95.73%    +0.05%
==========================================
  Files          202       203        +1
  Lines        29253     29626      +373
  Branches         0         0         —
==========================================
+ Hits         27987     28360      +373
- Misses        1266      1266         —
- Partials         0         0         —

Generated by Codecov Action

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