3. refactor: extract shared service layer (internal/service/) #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
internal/service/WorkspaceServiceErrNotFound,ValidationError,ConflictError) with clean HTTP status mapping viahandleServiceErrorKey changes
internal/service/workspace.go— 11 methods: List, Get, Create, Delete, GetPixiToml, SavePixiToml, PushVersion, ListVersions, GetVersion, GetVersionFile, ListTagsinternal/service/errors.go— Typed errors for 404/400/409 mappinginternal/service/types.go— CreateRequest, PushRequest, PushResultinternal/api/handlers/workspace.go— Refactored to thin wrappers withhandleServiceErrorinternal/api/router.go— Createsservice.New()and passes to handlerReview fixes applied
os.IsNotExistvs other errors (proper 404 vs 500)slog.Errorfor unhandled errorsTest plan
go vet ./...go test ./internal/service/...— 21 unit tests covering all service methodsgo test ./internal/store/... ./cmd/nebi/...cd frontend && npx tsc --noEmit— no type errors