[bugfix] Fix invalid ManagerChannel enum value in nodepack installation (#5312)

* [bugfix] Fix invalid ManagerChannel enum value in nodepack installation

Fix nodepack installation failure caused by using 'stable' channel value
which is not defined in the ManagerChannel enum. Changed from 'stable'
to 'default' which is a valid enum value according to the backend schema.

Fixes nodepack installation requests that were failing validation at
/v2/manager/queue/task endpoint.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [refactor] Enforce type safety for enum values without type assertions

Remove type assertions (as ManagerChannel) and use explicit Record typing
to ensure compile-time validation of enum values. This prevents invalid
enum values from being used by catching them during TypeScript compilation
rather than runtime validation failures.

- Replace type assertions with Record<string, ManagerChannel> typing
- Remove manual casting that bypassed TypeScript's type checking
- Ensure invalid enum values cause compilation errors

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Christian Byrne
2025-09-02 22:55:17 -07:00
committed by GitHub
parent 65b6b27831
commit 35f5773deb

View File

@@ -109,15 +109,15 @@ const SelectedVersionValues = {
NIGHTLY: 'nightly' as SelectedVersion
}
const ManagerChannelValues = {
STABLE: 'stable' as ManagerChannel,
DEV: 'dev' as ManagerChannel
const ManagerChannelValues: Record<string, ManagerChannel> = {
DEFAULT: 'default', // ✅ Valid - will compile
DEV: 'dev' // ✅ Valid - will compile
}
const ManagerDatabaseSourceValues = {
CACHE: 'cache' as ManagerDatabaseSource,
REMOTE: 'remote' as ManagerDatabaseSource,
LOCAL: 'local' as ManagerDatabaseSource
const ManagerDatabaseSourceValues: Record<string, ManagerDatabaseSource> = {
CACHE: 'cache',
REMOTE: 'remote',
LOCAL: 'local'
}
const { nodePack } = defineProps<{
@@ -242,7 +242,7 @@ const handleSubmit = async () => {
await managerStore.installPack.call({
id: nodePack.id,
repository: nodePack.repository ?? '',
channel: ManagerChannelValues.STABLE,
channel: ManagerChannelValues.DEFAULT,
mode: ManagerDatabaseSourceValues.CACHE,
version: actualVersion,
selected_version: selectedVersion.value