Skip to content

Fix inconsistend backend gating of snapshot description endpoint#7330

Open
cstns wants to merge 3 commits into
make-nrassistant-plugin-instalation-conditionalfrom
inconsistend-backend-gating-of-snapshot-description-endpoint
Open

Fix inconsistend backend gating of snapshot description endpoint#7330
cstns wants to merge 3 commits into
make-nrassistant-plugin-instalation-conditionalfrom
inconsistend-backend-gating-of-snapshot-description-endpoint

Conversation

@cstns
Copy link
Copy Markdown
Contributor

@cstns cstns commented May 25, 2026

Important

This PR is part of a nested merge list. Do not merge until its target branch is main.

Description

The device and project snapshot description endpoints had inconsistent gating compared to other AI features. They checked enterprise license tier and team feature property but did not check the platform feature flag or validate that the assistant service was configured before calling invokeLLM().

Changes in forge/routes/api/device.js and forge/routes/api/project.js:

  • Added app.config.features.enabled('generatedSnapshotDescription') platform feature flag check in the preHandler
  • Split the previous combined hasFeature check into separate hasPlatformFeature and hasTeamFeature checks for clarity
  • Added assistant configuration validation (assistant.enabled and assistant.service.url) before reaching the handler logic. Returns 400 with assistant_not_configured instead of letting the invokeLLM call fail with a raw error

Gating order (both endpoints):

  1. Enterprise license check (404)
  2. ai flag, platform + team (404)
  3. generatedSnapshotDescription platform feature flag (404)
  4. generatedSnapshotDescription team feature property (404)
  5. Assistant config validation (400)

This aligns both endpoints with the pattern used by the FIM inline completions endpoint in assistant.js.

Related Issue(s)

closes #7314

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this May 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.61%. Comparing base (3e3a09c) to head (1fb733c).

Files with missing lines Patch % Lines
forge/routes/api/device.js 83.33% 1 Missing ⚠️
forge/routes/api/project.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@                                 Coverage Diff                                 @@
##           make-nrassistant-plugin-instalation-conditional    #7330      +/-   ##
===================================================================================
- Coverage                                            76.61%   76.61%   -0.01%     
===================================================================================
  Files                                                  405      405              
  Lines                                                20630    20638       +8     
  Branches                                              5002     5006       +4     
===================================================================================
+ Hits                                                 15805    15811       +6     
- Misses                                                4825     4827       +2     
Flag Coverage Δ
backend 76.61% <83.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Task 5: Fix inconsistent backend gating on snapshot description endpoints

1 participant