---
id: TST-PFM-MTD-037
title: apply endpoint deletion
kind: integration
product_area: platform
module: metadata
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
repository: services-platform
files:
  - modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js
implements:
  - ATS-PFM-MTD-013-04
  - ATS-PFM-MTD-013-05
  - ATS-PFM-MTD-019-01
  - ATS-PFM-MTD-019-02
  - ATS-PFM-MTD-019-03
  - ATS-PFM-MTD-019-04
  - ATS-PFM-MTD-019-05
  - ATS-PFM-MTD-019-06
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: >-
  Prepared integration database and the suite fixture records; fixture teardown restores or removes its own
  rows.
evidence:
  - 'services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js'
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#removes
    the association and keeps the record on the other side, answering what it removed
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#publishes
    objects.association.deleted for the association, with the payload and scope the record store publishes
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#queues
    the event for the dispatcher, under the event’s own id
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#deletes
    the custom record on the other side with its values and its association, and answers it
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#deletes
    a chain of records level by level, in the order the record store deletes them
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#writes
    every dependant’s event before the record it depended on: the associations, then the chain deepest first
    (B1)
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#leaves
    none of a chain behind
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#deletes
    a chain of ten records, the deepest a cascade may go
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    a chain of eleven with SQLSTATE AE409 and removes nothing of it
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    to delete a locked record in the cascade, naming it, and removes nothing
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#detaches
    the files the record held, due for retirement at once
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#writes
    the audit row custom_record.change, action delete, for the actor of the session
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#publishes
    objects.record.deleted with the payload the record store publishes
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#captures
    the deletion in the record’s history, attributed to the session
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    with SQLSTATE AE409 and the message the TypeScript refusal has, removing nothing
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#names
    every restricting type, counted and sorted, when several hold the record
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    with the same message through the TypeScript path
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    while the restricting association has an end date that has not passed, removing nothing
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#removes
    an ended association whatever its rule, and the deletion goes ahead
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#cascades
    to a record of an archived custom object, deleting it
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    the owner’s deletion for an open restricting association to a record of a draft custom object
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the from side under detach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the from side under detach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the to side under detach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the to side under detach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the from side under cascade
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the from side under cascade
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the to side under cascade
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the to side under cascade
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the from side under restrict
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the from side under restrict
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an open association on the to side under restrict
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
    what endpointDeletionOutcome says for an ended association on the to side under restrict
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    another tenant than the transaction’s with 42501, removing nothing
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    a transaction in no tenant with 42501
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#touches
    no row of another tenant that names the same record id
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#lets
    the sibling service’s application role call it
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#lets
    Platform’s own application role call it
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
    a role that was never granted it (42501)
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#keeps
    the internal helpers out of CRM’s reach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#keeps
    the one-endpoint rule function out of CRM’s reach
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#leaves
    the same audit rows, events, revisions and no record, as the record store does
  - >-
    services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#leaves
    the audit row, the event and the deleted revision to compare (a premise for the equality)
fixture_imports:
  - pg
  - drizzle-orm
  - '@rhythmsoftware/macroservice-testing/stage'
  - ../../../../../db/config
  - ../../../services/persistence/associations
  - ../../../rules
  - ../../../../custom-objects/services/persistence/custom-object-records
  - ../../../../custom-objects/db/custom-object-records.table
  - ../../../../custom-objects/tests/integration/support
  - ../support
  - ../../../services/persistence/associations
  - '@rhythmsoftware/macroservice-testing/refusals'
  - '@rhythmsoftware/macroservice-errors/errors'
test_doubles: []
limitations: []
unmatched_specification: null
binding_assertions:
  - scenario: ATS-PFM-MTD-013-04
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        while the restricting association has an end date that has not passed, removing nothing
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-013-05
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        a chain of eleven with SQLSTATE AE409 and removes nothing of it
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-01
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#removes
        the association and keeps the record on the other side, answering what it removed
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#deletes
        the custom record on the other side with its values and its association, and answers it
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        with SQLSTATE AE409 and the message the TypeScript refusal has, removing nothing
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#removes
        an ended association whatever its rule, and the deletion goes ahead
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#answers
        what endpointDeletionOutcome says for an open association on the to side under restrict
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-02
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#deletes
        a chain of ten records, the deepest a cascade may go
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        a chain of eleven with SQLSTATE AE409 and removes nothing of it
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        to delete a locked record in the cascade, naming it, and removes nothing
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-03
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#names
        every restricting type, counted and sorted, when several hold the record
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-04
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#leaves
        the same audit rows, events, revisions and no record, as the record store does
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#detaches
        the files the record held, due for retirement at once
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-05
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        another tenant than the transaction’s with 42501, removing nothing
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#touches
        no row of another tenant that names the same record id
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        a role that was never granted it (42501)
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#lets
        the sibling service’s application role call it
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-019-06
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#cascades
        to a record of an archived custom object, deleting it
      - >-
        services-platform:modules/associations/tests/integration/db/apply-endpoint-deletion.integration.spec.js#refuses
        the owner’s deletion for an open restricting association to a record of a draft custom object
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
---

# Apply endpoint deletion

## Verification Boundary

This integration suite checks relationship definitions and links within the local test harness. The registered file and pinned revision define its boundary.

## What This Suite Proves

The bindings identify the detailed or feature scenarios whose outcomes have assertions in this suite. Original case references remain attached to the detailed scenarios so a reviewer can inspect the exact assertion. Assertions are evidence of implemented checks; no execution result is claimed.

## What It Does Not Prove

The register does not establish a current passing run or full specification conformance. Behavior outside the suite’s fixtures and assertions remains unverified.

## Real Dependencies and Test Doubles

The fixture uses PostgreSQL and the imported persistence or API code. The fixture imports identify the setup seams; this register makes no broader claim that dependencies are undoubled.

## Must Not Be Doubled

The operation under examination and its asserted stored outcomes must remain real within the declared harness. A fixture cannot replace the write, refusal or transactional effect that the bound scenario checks.
