fix(deployment): instance delete fully removes the record
Deleting an instance only undeployed it from the site and set the state to NotDeployed, leaving an orphan record that could never be removed — the state-transition matrix rejected delete from NotDeployed. Delete now removes the instance record entirely (deployment history, snapshot, attribute/alarm overrides, and connection bindings go with it), and is permitted from any state.
This commit is contained in:
@@ -188,15 +188,14 @@ public class DeploymentServiceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteInstanceAsync_WhenNotDeployed_ReturnsTransitionError()
|
||||
public async Task DeleteInstanceAsync_InstanceNotFound_ReturnsFailure()
|
||||
{
|
||||
var instance = new Instance("TestInst") { Id = 1, SiteId = 1, State = InstanceState.NotDeployed };
|
||||
_repo.GetInstanceByIdAsync(1).Returns(instance);
|
||||
_repo.GetInstanceByIdAsync(1).Returns((Instance?)null);
|
||||
|
||||
var result = await _service.DeleteInstanceAsync(1, "admin");
|
||||
|
||||
Assert.True(result.IsFailure);
|
||||
Assert.Contains("not allowed", result.Error);
|
||||
Assert.Contains("not found", result.Error);
|
||||
}
|
||||
|
||||
// ── WP-8: Deployment comparison ──
|
||||
|
||||
Reference in New Issue
Block a user