Skip to content

feat(cli): manage workspace control by label slug - #706

Merged
pcfreak30 merged 4 commits into
developfrom
feat/workspaces-label-id
Sep 15, 2026
Merged

pcfreak30 merged 4 commits into
developfrom
feat/workspaces-label-id

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Workspace control no longer depends on the sequential numeric row ID. The user-facing workspace ID is the slug form of the workspace's opaque URL label (ws-ugki684o → ugki684o; bare labels from portal-plugin-ipfs#1040 pass through unchanged, with a numeric fallback when a workspace has no label).

A service decorator resolves the slug to the numeric ID internally by scanning the user's paged workspace list as needed, so workspaces get/attach/suspend/resume/access/delete accept the slug, the full legacy ws-<slug> label, or the plain numeric ID. Numeric IDs never trigger a scan, and an unresolvable slug fails before any backend call.

The list table drops the LABEL column (the slug is the label), keys rows by the slug ID, and is built on the CLI side so the human view carries the user-facing identifier. Both the CLI and MCP surfaces get the same behavior, since both build their workspaces deps through the same wiring.


Summary

This pull request makes workspace slugs (the human-friendly, opaque label identifiers like ugki684o) usable as the workspace ID across the CLI's single-workspace operations, in addition to the existing numeric IDs.

Functional Changes

Label-Slug Identification

  • Workspaces now have two accepted forms of user-facing identity: the label slug (e.g., ugki684o) and the legacy ws-<slug> label form (e.g., ws-ugki684o). Both resolve to the same workspace.
  • The newly added labelResolvingWorkspaces decorator (workspaces_label.go) wraps the workspaces service and intercepts the single-workspace operations (get, attach, suspend, resume, access, delete). When called with a label slug, it scans the user's paged workspace list to resolve the slug to the backend's sequential numeric ID and forwards that ID to the operation.
  • Numeric IDs continue to pass through untouched, so the existing numeric-identifier workflow keeps working.
  • An unresolvable label yields an explicit "workspace not found" error instead of a backend 404.
  • The service wiring in catalog_workspaces_wiring.go was updated so both the CLI and MCP surfaces use this label-resolving wrapper.

Output/Rendering Updates

  • The workspace list table now keys each row by the label slug and removes the separate LABEL column, since the slug is the label and the column would merely repeat the ID.
  • The single-workspace detail view (used by get/create/attach/suspend/resume) likewise shows the label slug as the ID and drops the duplicate label line.

Tests

  • Unit tests were added covering slug/label derivation, numeric-ID pass-through, multi-page slug resolution, acceptance of both bare and legacy-prefixed labels, not-found handling, and the updated table/human rendering.

Known Issue (from code review)

One high-severity finding was reported: fully numeric label slugs (e.g., a workspace whose slug happens to be all digits) are shadowed by the numeric-ID pass-through logic in resolveID, making such slugs unreachable and causing them to resolve to the wrong workspace.

- treat the workspace's URL label slug (ws- prefix stripped from
  legacy labels) as the user-facing id
- resolve slugs to numeric ids by scanning the paged list on
  get/attach/suspend/resume/access/delete
- accept slug, full legacy label, or numeric id; numeric ids
  never trigger a scan
- drop the LABEL column from the list table and key rows by the
  slug id
- apply the same mapping on the cli and mcp surfaces via the
  shared workspaces deps wiring
@kody-ai

This comment has been minimized.

Comment thread internal/cli/workspaces_label.go
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Code Coverage Report

Total Coverage: 55.3%

Generated from commit: c87bbdc
Repository: LumeWeb/pinner-cli

- resolve labels first for every id, so a purely numeric label
  slug is not shadowed by the numeric interpretation
- treat an unmatched numeric id as the numeric form the backend
  expects
@kody-ai

This comment has been minimized.

Comment thread internal/cli/workspaces_label.go
Comment thread internal/cli/workspaces_label.go Outdated
- resolve numeric ids as-is without paging the workspace list
- document that a purely numeric label slug is ambiguous with a
  row id and the numeric interpretation wins
@kody-ai

kody-ai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@pcfreak30
pcfreak30 merged commit 66c5ddc into develop Sep 15, 2026
11 checks passed
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