interuss / dss

InterUSS Platform's implementation of the ASTM DSS concept for RID and flight coordination.
Apache License 2.0
122 stars 85 forks source link

[scd] dangling implicit subscription when OIR with implicit subscription is mutated #1056

Open Shastick opened 1 month ago

Shastick commented 1 month ago

Describe the bug

When updating an Operational Intent Reference (OIR) for which an implicit subscription was created, if the subscription id is not specified and the parameters for creating an implicit subscription are specified, the DSS will create a new implicit subscription without deleting the previous one.

This is the region of the code where it happens.

To Reproduce

  1. Create an OIR and request the creation of an implicit subscription
  2. Mutate the OIR without specifying a subscription ID and specify some parameters for an implicit subscription
  3. Observe that the returned OIR has a new implicit subscription ID
  4. Query the previous implicit subscription: it still exists, even if the OIR is now attached to the newly created implicit subscription

Expected behavior

After the mutation of an OIR with an implicit subscription, under all circumstances, either the existing implicit subscription has been reused and properly updated, or a new implicit subscription has been created, and the previous one removed if it is no longer attached to any OIR.

Additional questions/discussion

Options to solve this:

I'm in favor of option B here, as I'm not sure that allowing to indirectly mutate the callback URL of an implicit subscription is a desirable feature:

Side question: On mutation, when no subscription and no implicit subscription parameters are specified, should we:

Another way to look at this question is to ask how do we remove an implicit subscription from an OIR in the ACCEPTED state without deleting the OIR and re-creating it?

Shastick commented 1 month ago

@BenjaminPelletier FYI I'll start working on this (but can't assign myself)