feat: add forbidden layers configuration for deletion (MAPCO-11281) - #101
Merged
CL-SHLOMIKONCHA merged 2 commits intoJul 30, 2026
Merged
Conversation
Add a configurable safety list of layers that are protected from deletion. Layers are identified by their map serving name (<productId>-<productType>) and configured via the FORBIDDEN_LAYERS_FOR_DELETION env var, settable at Helm values level under env.deleteLayer.forbiddenLayers. deleteLayer now validates the requested layer against this list before any other check and throws a ConflictError explaining that the layer cannot be deleted.
…1281) ForbiddenError better expresses that the layer is configured as protected than ConflictError does — the request does not conflict with any state, it is simply not permitted. Map ForbiddenError to 403 in the deleteLayer controller handler and document the 403 response on the delete endpoint in the OpenAPI spec.
CL-SHLOMIKONCHA
approved these changes
Jul 30, 2026
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.
Related issues: MAPCO-11281
Further information:
Adds a safety mechanism that protects specific layers from being deleted.
Configuration
A forbidden-layers list is configurable at Helm values level under
env.deleteLayer.forbiddenLayers, exposed to the service as theFORBIDDEN_LAYERS_FOR_DELETIONenv var (JSON array) and read fromdeleteLayer.forbiddenLayers. Defaults to an empty list, so behavior is unchanged unless explicitly configured.Behavior
deleteLayernow runsvalidateLayerIsNotForbiddenForDeletionas its first validation — before the unpublished check and the parallel-jobs check — so a protected layer is rejected as early as possible and no delete job is created. Layers are matched by their map serving name (getMapServingLayerName(productId, productType)), meaning bothproductIdandproductTypemust match an entry; a partial match on either one alone does not block deletion.On a match the request fails with
403 Forbidden(ForbiddenError) — the request does not conflict with any state, it is simply not permitted:The
403response is documented on the delete endpoint in the OpenAPI spec, andForbiddenErroris mapped toStatusCodes.FORBIDDENin thedeleteLayercontroller handler.Tests
DELETEon a configured forbidden layer returns 403 and no job is created on job-manager.ForbiddenError; productId-only match still deletes; productType-only match still deletes.Full suite passes (
tsc --noEmit+ 159 unit + 216 integration = 375 tests) andeslint .is clean.