fix(flows): only offer install for capabilities the store resolves
Some checks are pending
Security / Security check (push) Waiting to run

The capability set behind the flow editor's Install quick-fix and
the flow list's install badge ingested every store entry's
requiresCapabilities (dependencies, not provided capabilities) and
ignored entry status/kind. Clicking Install on such a capability
ended in the hub's "no store entry for '<name>'" error.

The set now mirrors the hub's install resolver (entry names only,
no planned or federated entries) via installableStoreCapabilities()
with unit tests for both classification states. Unresolvable
capabilities render the editor's 'not in store' state, which
explains the three recovery paths before any click; the editor pin
moves to 0.25.0 (commit-pinned until its tag exists) and the dialog
harness captures the badge states light+dark. Studio 0.78.0.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-07-22 13:46:08 +02:00
parent bef2dbe988
commit 08227410e6
8 changed files with 203 additions and 16 deletions

View file

@ -17,6 +17,7 @@ import 'package:flutter/material.dart';
import '../data/error_presentation.dart';
import '../data/flow_run_driver.dart';
import '../data/hub.dart';
import '../data/store_caps.dart';
import '../data/workspace.dart';
import '../l10n/app_localizations.dart';
import '../widgets/chain_install_confirm.dart';
@ -55,18 +56,14 @@ class _FlowsPageState extends State<FlowsPage> {
try {
final items = await HubService.instance.searchStore(limit: 500);
if (!mounted) return;
// Store items carry a list of provided capabilities. We
// ingest all of them flat so a single store entry
// shipping multiple caps still reports each as installable.
// Falls back to the item name for legacy entries.
final caps = <String>{};
for (final item in items) {
if (item.requiresCapabilities.isNotEmpty) {
caps.addAll(item.requiresCapabilities);
}
caps.add(item.name);
}
setState(() => _storeCaps = caps.toList()..sort());
// Only capabilities the store can actually install the
// editor's Install quick-fix and list badge promise exactly
// what the hub's install resolver accepts. (This set used to
// ingest requiresCapabilities too, which offered installs
// that ended in "no store entry for '<name>'".)
setState(
() => _storeCaps = installableStoreCapabilities(items).toList()..sort(),
);
} catch (_) {
// Soft-fail: empty list disables the Install button on
// unknown-cap fixes, but Add-source remains available.