feat(packages): PATCH /packages/:id to edit a package manifest#2646
Merged
Conversation
Packages could be created (POST /packages) and acted on via lifecycle
sub-routes, but a runtime/base package's manifest — name, description,
version — could never be edited after creation. The Studio "Package
info & settings" sheet had no edit affordance because there was no
endpoint behind it.
Add the edit path end to end:
- `SchemaRegistry.updatePackageManifest(id, patch)` — merges name /
description / version into the in-memory manifest, preserving lifecycle
state (enabled / status / installedAt). It is a metadata edit, not a
reinstall, so a disabled package stays disabled.
- `protocol.updatePackage({ packageId, patch })` — merges via the
registry then re-persists the manifest to `sys_packages` (best-effort,
non-fatal, matching installPackage) so the edit survives a restart.
- `PATCH /packages/:id` in `handlePackages` — partial patch (only the
sent fields change), accepts flat or `{ manifest }`-wrapped bodies,
validates a non-empty name and semantic version, 404s an unknown
package, and falls back to the registry when no protocol service.
`id` / `scope` / `type` remain identity/structure and are not editable
here.
Tests: registry merge (preserve lifecycle, partial patch, unknown id);
dispatcher PATCH (protocol path, manifest wrapper, empty-patch 400,
bad-version 400, registry-fallback 404).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxVTSDSXrdnfqHNBkHB6yi
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 25 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 5, 2026 23:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Packages can be created (
POST /packages) and acted on via lifecycle sub-routes (enable/disable/publish/revert/duplicate/delete/…), but a runtime/base package's manifest —name,description,version— could never be edited after creation. The ObjectUI Studio "Package info & settings" sheet has no edit affordance because there was no endpoint behind it.Change — the edit path, end to end
SchemaRegistry.updatePackageManifest(id, patch)(objectql) — mergesname/description/versioninto the in-memory manifest, preserving lifecycle state (enabled/status/installedAt). It's a metadata edit, not a reinstall, so a disabled package stays disabled. Only fields present in the patch are overwritten.protocol.updatePackage({ packageId, patch })(metadata-protocol) — merges via the registry, then re-persists the merged manifest tosys_packages(best-effort, non-fatal — same contract asinstallPackage) so the edit survives a restart.PATCH /packages/:idinhandlePackages(runtime) — a partial patch: accepts the fields flat or under a{ manifest }wrapper, validates a non-emptynameand a semanticversion,404s an unknown package, and falls back to the registry when noprotocolservice is present.id/scope/typeremain identity/structure and are not editable here.Tests
registry.test.ts— merge preserves lifecycle (disabled stays disabled), partial-patch only overwrites sent fields, unknown id →undefined.http-dispatcher.test.ts— PATCH viaprotocol.updatePackage(trims name, forwards only sent fields),{ manifest }wrapper, empty patch →400, non-semantic version →400, registry fallback →404for an unknown package.@objectstack/objectql,@objectstack/metadata-protocol,@objectstack/runtimebuild clean (tsup DTS = full typecheck).Companion
Consumed by ObjectUI Studio (objectstack-ai/objectui#2297 merged the surrounding package management; the edit form wiring is a follow-up there).
🤖 Generated with Claude Code
https://claude.ai/code/session_01DxVTSDSXrdnfqHNBkHB6yi
Generated by Claude Code