feat: record clone — wire object.enable.clone to a real runtime#1961
Merged
Conversation
`object.enable.clone` was a parsed-but-dead capability flag. This wires it
to an actual clone path and reclassifies it dead→live in the liveness ledger.
objectql:
protocol.cloneData({ object, id, overrides?, context? }) reads the source,
drops engine-owned columns (id + created_at/created_by/updated_at/updated_by,
plus system-flagged / autonumber / formula / summary fields) so the insert
path re-derives them, applies caller overrides last, and inserts the copy.
Shallow by design. Gated on schema.enable.clone — explicit false → 403
CLONE_DISABLED; absent/true → allowed.
rest:
POST /api/v1/data/:object/:id/clone (201 → { object, id, sourceId, record }).
Optional { overrides } body (or a bare field map) wins over copied values.
Honors the existing auth + enable.apiEnabled/apiMethods gates.
Tests: 8 protocol unit tests (mock engine), 5 REST route tests (registration,
overrides, 403 mapping, 501 fallback), and 4 real-engine integration tests
proving autonumber regeneration (ACC-0001 → ACC-0002) and CLONE_DISABLED on a
genuine ObjectQL engine. Gate green; objectql 633, rest 121.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 93 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
What
object.enable.clonewas a parsed-but-dead capability flag (no runtime reader, classifieddeadin the spec-liveness ledger). This wires it to an actual record-clone path and flips itdead → live.This is the productization half of the spec-liveness cleanup: where a flag is worth keeping, build the feature rather than prune the flag. (The companion PR #1960 prunes the genuinely orphaned
recordTypes/cdcstubs.)objectql —
protocol.cloneData({ object, id, overrides?, context? })Reads the source record, drops engine-owned columns so the insert path re-derives them, applies caller
overrideslast, inserts the copy:id+ auditcreated_at/created_by/updated_at/updated_bysystem-flagged columns (e.g. injectedorganization_id)autonumberfields (re-issued)formula/summaryfields (recomputed)schema.enable.clone: default-on; explicitenable.clone === false→403 CLONE_DISABLED.rest —
POST /api/v1/data/:object/:id/clone201 → { object, id, sourceId, record }.{ overrides }(or a bare field map) overrides copied values — the place to set a newnameor clear a unique field before insert.enable.apiEnabled/apiMethodsgates; lives in the always-on data-action group alongsidelead/:id/convert.Verification
CLONE_DISABLED, default-on,RECORD_NOT_FOUND,OBJECT_NOT_FOUND.403mapping,501fallback when a protocol lackscloneData.ObjectQL+ in-memory driver) — proves the cloned row gets a regenerated autonumber (ACC-0001→ACC-0002), overrides apply,enable.clone:false→ 403, missing source → 404.object.enable.clonenowlivewith evidence);@objectstack/objectql633 passed,@objectstack/rest121 passed.Follow-ups (not in scope)
client.data.clone()) + an objectui "Clone" record action —cloneDatafollows the same untyped-extra-method pattern asconvertLead, so neither is wired to a typed client method yet.🤖 Generated with Claude Code