Altinn / Altinn/app-lib-dotnet

Validate an archived instance gives 500 as response code

Open
#55 0 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

## Describe the bug
**This is a negative test**
When an user tries to validate an instance that is archived (The process has ended), the response code is 500 Internal Server error

## To Reproduce
Steps to reproduce the behavior:
1. Login in SBL and get the cookies for API calls (AltinnStudioRuntime)
2. Start an instance and complete the process of the instance (archive instance)
3. Send a GET request to validate the archived instance.
[https://{{org}}.apps.{{envUrl}}/{{org}}/{{app}}/instances/{{instanceOwnerId}}/{{instanceId}}/validate](url)
4. The response code is 500 Internal server error and the pod logs says

> An unhandled exception was thrown by the application.
Altinn.App.Services.Models.Validation.ValidationException: Unable to validate instance without a started process.
at AltinnCore.Runtime.RestControllers.ValidateController.ValidateInstance(String org, String app, Int32 instanceOwnerPartyId, Guid instanceGuid)

## Expected behavior
The response code should be 400 Bad request / 409 conflict

## Additional info
Env: AT23
App: ttd/negative-test

Contributor guide

Open the contributing guide

Research direction

Start at ValidateController.ValidateInstance and reproduce the GET request against an archived instance using the steps in the issue. Trace how ValidationException is handled when the process is not started, then verify that the endpoint returns the agreed 400 Bad Request or 409 Conflict response instead of an unhandled 500 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.