fix(flows): only offer install for capabilities the store resolves
Some checks are pending
Security / Security check (push) Waiting to run
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:
parent
bef2dbe988
commit
08227410e6
8 changed files with 203 additions and 16 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/// Studio's own build version. Bump on every UI release so the
|
||||
/// running app self-identifies.
|
||||
const String kStudioVersion = '0.77.0';
|
||||
const String kStudioVersion = '0.78.0';
|
||||
|
||||
const String kProductName = 'Ch∆In Studio';
|
||||
const String kVendorName = 'Flemming.AI (F∆I)';
|
||||
|
|
|
|||
30
lib/data/store_caps.dart
Normal file
30
lib/data/store_caps.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Store-resolvability: which capabilities can the store actually
|
||||
// install? This is the data source behind the flow editor's
|
||||
// "Install" quick-fix and the flow list's install badge — it must
|
||||
// mirror the hub's install resolver (exact entry name, an
|
||||
// installable version, native bundle), or the UI offers installs
|
||||
// that end in "no store entry for '<name>'".
|
||||
|
||||
import 'hub.dart';
|
||||
|
||||
/// Bare capability names a store entry can install right now.
|
||||
///
|
||||
/// Mirrors the hub's `resolve_install_plan` acceptance rules:
|
||||
/// - only the entry's own `name` counts — `requiresCapabilities`
|
||||
/// are the entry's DEPENDENCIES, not things it provides, and
|
||||
/// must never be offered as installable;
|
||||
/// - `planned` entries have no downloadable version yet;
|
||||
/// - `federated` entries route through a bridge (MCP/n8n), not
|
||||
/// the bundle-install path.
|
||||
/// An empty `status` (older hub without the field) keeps the
|
||||
/// entry installable — the classified install error is the net
|
||||
/// underneath that skew.
|
||||
Set<String> installableStoreCapabilities(Iterable<StoreItem> items) {
|
||||
final caps = <String>{};
|
||||
for (final item in items) {
|
||||
if (item.isFederated) continue;
|
||||
if (item.status == 'planned') continue;
|
||||
caps.add(item.name);
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue