Skip to content

feat: add forbidden layers configuration for deletion (MAPCO-11281) - #101

Merged
CL-SHLOMIKONCHA merged 2 commits into
masterfrom
feat/config-forbidden-layers-MAPCO-11281
Jul 30, 2026
Merged

feat: add forbidden layers configuration for deletion (MAPCO-11281)#101
CL-SHLOMIKONCHA merged 2 commits into
masterfrom
feat/config-forbidden-layers-MAPCO-11281

Conversation

@almog8k

@almog8k almog8k commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
Question Answer
Bug fix
New feature
Breaking change
Deprecations
Documentation
Tests added
Chore

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 the FORBIDDEN_LAYERS_FOR_DELETION env var (JSON array) and read from deleteLayer.forbiddenLayers. Defaults to an empty list, so behavior is unchanged unless explicitly configured.

env:
  deleteLayer:
    # layers that are protected from deletion, in the format of <productId>-<productType>
    forbiddenLayers:
      - 'VIVID_IHUD-Orthophoto'

Behavior

deleteLayer now runs validateLayerIsNotForbiddenForDeletion as 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 both productId and productType must 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:

Layer: VIVID_IHUD-Orthophoto, is configured as a forbidden layer for deletion and therefore cannot be deleted

The 403 response is documented on the delete endpoint in the OpenAPI spec, and ForbiddenError is mapped to StatusCodes.FORBIDDEN in the deleteLayer controller handler.

Tests

  • Integration: DELETE on a configured forbidden layer returns 403 and no job is created on job-manager.
  • Unit: forbidden layer throws ForbiddenError; productId-only match still deletes; productType-only match still deletes.

Full suite passes (tsc --noEmit + 159 unit + 216 integration = 375 tests) and eslint . is clean.

almog8k added 2 commits July 30, 2026 17:27
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
CL-SHLOMIKONCHA merged commit e5a184f into master Jul 30, 2026
5 checks passed
@CL-SHLOMIKONCHA
CL-SHLOMIKONCHA deleted the feat/config-forbidden-layers-MAPCO-11281 branch July 30, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants