Repository navigation
Record deletions are lost when an app is promoted via the CI/CD App Repository — now-sdk install applies DELETEs without writing sys_metadata_delete #128
Unanswered
IhorKochetkov
asked this question in
Help and Questions with SDK or Fluent
Replies: 1 comment
|
I opened a case with ServiceNow regarding this same issue. The ticket agent indicated this issue is fixed in Zurich Patch 12 and later, and is also fixed in Australia. The issue is that the SDK does not create the necessary sys_metadata_delete records when the app is deployed via the SDK and this patch somehow remedies that issue going forward. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Deletions tracked by the SDK — both automatic tombstones from removing a Fluent record definition (
deleted: trueingenerated/keys.ts) and explicitNow.del()— are correctly emitted bynow-sdk buildasdist/app/author_elective_update/*.xmlwithaction="DELETE", and correctly applied bynow-sdk installon the development instance.However,
now-sdk installapplies these deletes without creatingsys_metadata_delete(Application File Delete Record) rows on the dev instance. When the app is then published through the standard CI/CD path (POST /api/sn_cicd/app_repo/publish), the package is built from the instance's app state — which now contains no trace of the deletions. The subsequentapp_repo/installon TEST/PROD upgrades every surviving file but never deletes the removed ones. They remain as active orphans, indefinitely. They do not show up as "skipped changes" either; the upgrade simply does not know about them.By contrast, deleting the same application file through the platform UI on the dev instance does create
sys_metadata_delete, and the deletion then propagates through publish/install as expected. The SDK install path bypasses that mechanism.Reproduction
sc_cat_itemoritem_option_new).now-sdk installto DEV. Publish version N viasn_cicd/app_repo/publish. Install version N on a second instance.Now.del(...)). Runnow-sdk build— observedist/app/author_elective_update/<table>_<sys_id>.xmlwithaction="DELETE".now-sdk installto DEV — the record is deleted on DEV. ✔sys_metadata_deletefor that sys_id / update name → 0 rows. ✘sn_cicd/app_repo/publish, install N+1 on the second instance.sys_upgrade_historyshows no skipped change for it.Observed on
@servicenow/sdk4.7.x and 4.8.1; re-confirmed present on 4.10.1 and 4.11.2 (2026-08-28). Zurich instances.Note for anyone searching: 4.11.0's "Fixed builds generating unsafe delete instructions for table, column, and index definitions" is a different defect (schema-object deletes at build time) and does not affect this.
Impact
Any team using the documented CI/CD pipeline — SDK for authoring, App Repository for promotion — silently accumulates deleted-but-alive records on every non-dev instance:
On one real upgrade we counted 64 such orphans across
sc_cat_item,item_option_new,question_choice,sc_cat_item_category, andsp_instance/sp_row/sp_column.The failure mode is quiet in the worst way: the build reports the DELETE, the DEV install honours it, the publish succeeds, the target install succeeds — and every one of those green signals is truthful. Nothing anywhere reports that the deletion did not travel. A team can only discover it by diffing instances.
Expected
Either:
now-sdk installregisterssys_metadata_deleteentries when it appliesaction="DELETE"records, soapp_repo/publishincludes the deletions; orapp_repo/publish(or the SDK's publish tooling) includes theauthor_elective_updateDELETE manifest in the published package.Either would make deletion behave the same way through the pipeline as it does through the UI.
Workaround we use today
A post-install pipeline step that diffs
sys_metadata(sys_package=<app>) between the dev instance and the install target, and deletes the target-only sys_ids via the Table API, with a cap and a report-only mode. Happy to share it if useful.In documentation terms we have had to write the rule as "to retire something via the pipeline, deactivate it (
active: false) — do not delete it", which is a real constraint on how apps get authored, so a fix would be very welcome.All reactions