diff --git a/.gitignore b/.gitignore index 5708d6c..1937d8a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ *.env !*.env.example ImplementationPlan/evidence/*.log + +**/__pycache__/ +*.pyc diff --git a/HealthApp.slnx b/HealthApp.slnx index c6587c7..9193595 100644 --- a/HealthApp.slnx +++ b/HealthApp.slnx @@ -1 +1 @@ - + diff --git a/ImplementationPlan/acceptance-register.md b/ImplementationPlan/acceptance-register.md index a993a1c..c5773f1 100644 --- a/ImplementationPlan/acceptance-register.md +++ b/ImplementationPlan/acceptance-register.md @@ -1,152 +1,152 @@ -# Acceptance preservation register +# Acceptance preservation and verification register -Prepared 2026-10-14. All 146 criterion IDs/titles and required outcomes below are retained from the pinned target traceability document. Planned suite allocations refer to the original source and guide adaptation; they do not establish passing coverage. Preserve outline examples, refine exact methods and results during implementation, and add missing assertions without weakening existing ones. US-16 is separately governed by Q1 and the full criterion mapping in `ArchitectureProposal/us16-revision.md`. +All 146 original common/US-01–US-15 entries and outline outcomes are retained. Links identify concrete executed B test methods; theory examples expand into multiple TRX cases. Functional assertions were reviewed against the required outcomes. Native revised US-16 evidence is separately in architecture-conformance.md. Clinical interpretation validity is distinguished from preserved deterministic behaviour under approval Q3; no new clinical review is claimed. Final test run evidence is summarized in evidence/final-verification.json. -| Criterion / title | Required outcomes / outline cases | Planned source suites | Verification | +| Criterion / title | Required outcomes / outline cases | Executed B test methods | Verification | | --- | --- | --- | --- | -| 00-AC-01: Include both boundaries | both boundary observations contribute; observations outside the period do not contribute. Outline cases: operation: history, numerical insight, trend assessment, overview insight | ObservationHistoryTests; ContextFilteredHistoryTests; ContextSelectedInsightTests; HealthTrendTests; HealthOverviewTests | Not verified; exact methods/results pending | -| 00-AC-02: Equal bounds are valid | the period is accepted; only observations at that instant are selected; the operation applies its own data-sufficiency rules. Outline cases: operation: history, numerical insight, trend assessment, overview insight | ObservationHistoryTests; ContextFilteredHistoryTests; ContextSelectedInsightTests; HealthTrendTests; HealthOverviewTests | Not verified; exact methods/results pending | -| 00-AC-03: Reject reversed bounds | the request is rejected. Outline cases: operation: history, numerical insight, trend assessment, overview insight | ObservationHistoryTests; ContextFilteredHistoryTests; ContextSelectedInsightTests; HealthTrendTests; HealthOverviewTests | Not verified; exact methods/results pending | -| 01-AC-01: Create a patient with valid information | the patient profile is created successfully; a patient identifier is assigned; the identifier is associated with the authenticated account | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-02: A patient name is required | the patient profile is rejected | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-03: A date of birth is required | the patient profile is rejected | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-04: Reject a second profile | the request reports that a profile already exists; no second profile is created and the association is unchanged | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-05: Persistent account association | the same associated profile is returned | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-06: Retry after a successful creation response was lost | the result indicates that the profile already exists; no duplicate profile or replacement association is created | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-07: Concurrent initial creation | at most one profile is created and associated with the account; no request reports a second profile as created | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-08: Recovery after interrupted creation | the operation recovers to one accessible associated profile or reports that creation remains incomplete; it neither produces duplicate profiles nor reports an inaccessible profile as successfully created | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 01-AC-09: Unauthenticated initial creation | the request is rejected and no profile is created | CreatePatientTests; PatientAuthenticationTests | Not verified; exact methods/results pending | -| 02-AC-01: Retrieve an existing patient | the patient profile is returned; the returned patient identifier matches the requested patient; the patient's name is included; the patient's date of birth is included; the patient's contact information is included | CreatePatientTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 02-AC-02: Request a patient that does not exist | the request reports that the patient does not exist | CreatePatientTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 03-AC-01: Update an existing patient | the update succeeds; the patient identifier is unchanged; the patient profile contains contact information "new@example.test" | UpdatePatientTests | Not verified; exact methods/results pending | -| 03-AC-02: Update a patient that does not exist | the update is rejected; no new patient is created | UpdatePatientTests | Not verified; exact methods/results pending | -| 04-AC-01: Record a valid observation | the observation is accepted; an observation identifier is assigned; the observation is associated with the patient; the observation can be retrieved later | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-02: Record an observation without optional fields | the observation is accepted | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-03: Reject an observation containing a non-positive measured value | the observation is rejected. Outline cases: columns (systolic, diastolic, pulse); cases (0, 82, 68), (-1, 82, 68), (128, 0, 68), (128, -1, 68), (128, 82, 0), (128, 82, -1) | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-04: Reject an observation without a measurement timestamp | the observation is rejected | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-05: Record an observation for a patient that does not exist | the observation is rejected | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-06: Record setting and condition independently | observation creation succeeds | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-07: Record partial context | observation creation succeeds | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-08: Retain support for absent context | observation creation succeeds | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-09: Record departure from routine | observation creation succeeds | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-10: Reject unsupported category | the operation is rejected with an explanation of the invalid category | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-11: Retrieve previously saved context | the returned observation contains those saved details associated with that observation | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 04-AC-12: Reject another patient’s context submission | the operation is rejected | RecordObservationTests; RecordMeasurementContextTests | Not verified; exact methods/results pending | -| 05-AC-01: Retrieve an existing observation | the observation is returned; the systolic value is 128; the diastolic value is 82; the pulse value is 68 | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 05-AC-02: Retrieve an observation that does not exist | the request reports that the observation does not exist | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 05-AC-03: Return complete saved context | its saved context is returned with its numerical measurements and timestamp | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 05-AC-04: Return partial context | Clinic is returned as the setting; activity condition is represented as unknown | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 05-AC-05: Preserve historical free text | the original text is returned; no definite setting or activity condition is invented | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 05-AC-06: Protect context | access is rejected; its context is not disclosed | ViewObservationContextTests; PatientAuthenticationTests; ProfessionalAccessTests | Not verified; exact methods/results pending | -| 06-AC-01: Return the most recent observation | the observation measured at "2026-09-12T08:00:00" is returned | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-02: Patient has no observations | the result indicates that no observation is available | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-03: Return context of latest observation | the newer observation is returned with its after-activity context | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-04: Do not substitute a more complete observation | the latest observation is returned; its context is represented as unknown | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-05: Preserve timestamp tie selection | the second observation is returned with its own setting | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-06: No observations | the system reports that no observation is available | LatestObservationTests | Not verified; exact methods/results pending | -| 06-AC-07: Resolve a complete timestamp tie reproducibly | the same observation is returned under the documented final tie rule | LatestObservationTests | Not verified; exact methods/results pending | -| 07-AC-01: Retrieve observations within a period | exactly 1 observation is returned; the returned observation was measured at "2026-09-05T08:00:00" | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-02: Return observations in chronological order | the observations are returned in chronological order by measurement timestamp | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-03: No observations exist within the requested period | an empty observation collection is returned | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-04: Reject an invalid period | the request is rejected | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-05: Select home observations | only home observations within the period are returned with their context | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-06: Combine setting and activity | only home-resting observations are returned | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-07: Select unknown context | only observations with unknown setting are returned | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-08: No selection excludes nothing on context alone | all those observations are returned in ascending measurement-time order | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-09: No matching observations | an empty collection is returned | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-10: Reject unsupported selection | the request is rejected with an explanation | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 07-AC-11: Preserve patient and boundary rules | both boundary observations are returned; the outside-period and other-patient observations are excluded | ObservationHistoryTests; ContextFilteredHistoryTests | Not verified; exact methods/results pending | -| 08-AC-01: Correct an existing observation | the update succeeds; the observation identifier is unchanged; the observation contains systolic value 128 | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-02: Reject an update containing a non-positive measured value | the update is rejected. Outline cases: columns (systolic, diastolic, pulse); cases (0, 82, 68), (128, 0, 68), (128, 82, 0) | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-03: Update an observation that does not exist | the update is rejected | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-04: Add context to historical observation | the update succeeds | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-05: Correct one context value | the update succeeds | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-06: Clear optional context | the update succeeds | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-07: Retrieve partially corrected observation | Clinic is returned; the original numerical values, timestamp, activity condition, and note are returned unchanged | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-08: Reject invalid context correction | the update is rejected | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-09: Nonexistent observation | the update is rejected | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 08-AC-10: Unauthorised correction | the operation is rejected | UpdateObservationTests; PatchObservationTests | Not verified; exact methods/results pending | -| 09-AC-01: Delete an existing observation | the deletion succeeds; the observation can no longer be retrieved; the observation no longer appears in the patient's observation history | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 09-AC-02: Delete an observation that does not exist | the request reports that the observation does not exist | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 09-AC-03: Delete contextualised observation | deletion succeeds | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 09-AC-04: History excludes previously deleted observation | the deleted observation and its context are absent; the remaining matching observations are returned | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 09-AC-05: Assessment excludes deleted data | the deleted values and context do not contribute to the result | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 09-AC-06: Reject unauthorised deletion | the operation is rejected | DeleteObservationTests; DeleteContextualisedObservationTests | Not verified; exact methods/results pending | -| 10-AC-01: Calculate averages for a period | the average systolic value is 125; the average diastolic value is 82; the average pulse value is 65 | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-02: Calculate minimum and maximum blood-pressure values | the minimum systolic value is 118; the maximum systolic value is 130; the minimum diastolic value is 76; the maximum diastolic value is 84 | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-03: Insight uses only observations in the requested period | only observations within the requested period contribute to the calculated values | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-04: No observations exist in the requested period | the result indicates that insufficient observation data is available for calculation | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-05: Reject an invalid insight period | the request is rejected | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-06: Calculate from selected context only | average systolic pressure is 125.00; the result identifies Home, At rest, and two contributing observations | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-07: No filter preserves pooled calculation | all eligible observations contribute to the existing numerical calculations; the mixed or unknown context is made apparent | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-08: One selected observation | each mean equals that observation’s corresponding value; each blood-pressure minimum and maximum equals its corresponding value | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-09: No matching observations | the system reports that no insight can be calculated for the selection | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-10: Correction changes membership | that observation does not contribute to the home-only calculation | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-11: Reject unsupported selection | the request is rejected with an explanation | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-12: Round a halfway mean upwards | the average systolic value is 120.13 | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 10-AC-13: Round a repeating fractional mean | the average systolic value is 120.33 | HealthInsightTests; ContextSelectedInsightTests | Not verified; exact methods/results pending | -| 11-AC-01: Calculate a trend from observations | a trend result is returned; the trend is derived only from observations within the requested period | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-02: No observations exist for trend calculation | the result indicates that insufficient observation data is available for trend calculation | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-03: Reject an invalid trend period | the request is rejected | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-04: Assess a comparable selection | separate systolic, diastolic, and pulse assessments are returned; the result identifies the selection, contributing count, and recorded basis for comparability | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-05: Different conditions remain visible | the result identifies the differing conditions; explains limitations on interpreting their combined trajectory | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-06: Unknown details limit comparability | the explanation identifies the known similarities and missing details; does not certify that all measurement conditions were identical | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-07: Missing context preserves numerical information | supported numerical direction and variation are returned; the limitations on clinical interpretation and comparability are explained | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-08: Conflicting descriptions | the conflict is identified; an unsupported resting interpretation is not asserted | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-09: Compare labelled selections | each result identifies its own selection and contributing observations; a difference between settings alone is not labelled improvement or deterioration over time | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-10: Insufficient selected series | the result reports insufficient observations for temporal direction; does not use excluded observations to manufacture a trend | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-11: No temporal separation | temporal direction is reported as unavailable | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-12: No matching data | the result reports that no matching observations are available | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-13: Updated context is used | that observation no longer contributes to the result | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-14: Reject invalid selection | the request is rejected with an explanation | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-15: AC-11-A | the result presents each measurement separately; identifies its unit, observed level, direction, and variation | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-16: AC-11-B | only observations for that patient within the selected period contribute to the result | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-17: AC-11-C | the result identifies the corresponding direction; bases that assessment on measurements throughout the period | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-18: AC-11-D | the result describes the intermediate variation; does not describe the period as clinically stable merely because its endpoints are similar | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-19: AC-11-E | the explanation describes the reversal or mixed development; does not imply that all measurements follow one consistent direction | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-20: AC-11-F | the explanation identifies their position relative to the reference values; does not describe them as healthy solely because their variation is limited | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-21: AC-11-G | the explanation describes that development and its basis; distinguishes improvement from having reached an appropriate level | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-22: AC-11-H | the explanation describes the concern and its basis; does not treat a decrease as favourable solely because the values are falling | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-23: AC-11-I | the result explains the interpretation of each affected measurement; does not force them into a single favourable or concerning classification | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-24: AC-11-J | the result presents the supported numerical information; explains that the clinical interpretation is limited by missing context | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-25: AC-11-K | the result explicitly reports that direction cannot be determined; does not substitute an increasing, decreasing, or unchanged conclusion | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-26: AC-11-L | the result identifies the reference values used; does not present a general reference threshold as an individual treatment target | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-27: AC-11-M | the assessment remains unchanged | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-28: AC-11-N | the result reflects the current observations | HealthTrendTests | Not verified; exact methods/results pending | -| 11-AC-29: Supported reference comparison despite incomplete preparation details | the supported reference comparison is provided; the explanation identifies the remaining limits without rejecting all clinical interpretation | HealthTrendTests | Not verified; exact methods/results pending | -| 12-AC-01: View an overview for a patient with observations | the patient's profile is included; the latest blood-pressure observation is included; the calculated health insight is included | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-02: View an overview for a patient without observations | the patient's profile is included; no latest blood-pressure observation is returned; the overview indicates that no calculated health insight is available | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-03: Request an overview for a patient that does not exist | the request reports that the patient does not exist | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-04: Reject an invalid overview period | the request is rejected | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-05: Latest context and insight selection differ | the latest after-activity observation and its context are returned; the insight uses only matching home-resting observations; the result distinguishes their different bases | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-06: No matching insight observations | the profile and latest observation remain available; the absence of insight for the selection is explained | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-07: Unknown context remains unknown | its context is represented as unknown; no context is copied from other observations | HealthOverviewTests | Not verified; exact methods/results pending | -| 12-AC-08: Default overview preserves context limitations | the original pooled insight is returned; its mixed-context explanation is included | HealthOverviewTests | Not verified; exact methods/results pending | -| 13-AC-01: Successful authentication | the system recognises my account and Patient role; recognises its associated patient profile if one has been created | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-02: Access to my own information | access is permitted; the operation follows its existing acceptance criteria | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-03: Invalid credentials | authentication is rejected; the response does not reveal which part of the credentials was incorrect | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-04: Missing authentication | the request is rejected; no patient information is returned or changed | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-05: Invalid authentication information | the request is rejected; no patient information is returned or changed | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-06: Access to another patient’s information | access is rejected; none of that patient’s information is returned or changed | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-07: Own information does not yet exist | the system follows the existing behaviour for missing information; does not return another patient’s information | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-08: Login before profile creation | authentication succeeds and recognises my account and Patient role; I may create my initial profile under US-01; I gain no access to another patient’s information | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 13-AC-09: Expired authentication | the request is rejected; no patient information is returned or changed | PatientAuthenticationTests; AuthenticationIntegrationTests | Not verified; exact methods/results pending | -| 14-AC-01: Successful authentication | the system recognises my identity and healthcare professional role | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-02: View assigned patients | the system returns only patients assigned to me | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-03: View an assigned patient’s information | access is permitted; the requested information is returned according to the existing retrieval requirements | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-04: No assigned patients | the system indicates that no patients are assigned; does not return other patients | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-05: Patient information does not yet exist | the system follows the existing behaviour for missing information | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-06: Access to an unassigned patient | access is rejected; no information about that patient is returned | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-07: Attempt to change patient information | the operation is rejected; the patient information remains unchanged | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-08: Invalid credentials | authentication is rejected; the response does not reveal which part of the credentials was incorrect | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-09: Missing or invalid authentication | the request is rejected; no patient information is returned | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 14-AC-10: Patient account attempts professional access | access is rejected; my existing access to my own information is unaffected | ProfessionalAccessTests | Not verified; exact methods/results pending | -| 15-AC-01: Access guidance before first observation | preparation, measurement, and recording instructions are available; the source, applicability, and review date are identified | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-02: Home measurement guidance | the instructions cover rest, equipment and cuff, positioning, repeated readings, and recording conditions; any numeric instructions follow the identified Danish or European guidance | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-03: Unknown setting | its supported setting is identified; no measurement setting is saved or assumed on the user’s behalf | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-04: Different measurement conditions | the guidance distinguishes it from a resting measurement; explains recording the actual conditions without relabelling the result as resting | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-05: Pulse context | it explains recording the pulse value and relevant activity condition; does not describe the single pulse value as a rhythm assessment | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-06: Guidance does not certify compliance | no observation is saved or altered; following the procedure is not recorded automatically | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-07: Guidance is optional | creation succeeds | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-08: Guidance unavailable | its unavailability is explained; unsupported instructions are not presented as verified guidance | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | -| 15-AC-09: General guidance without login | the general guidance is available; no patient-specific information or assignment list is returned | MeasurementGuidanceTests; RecordObservationTests | Not verified; exact methods/results pending | +| 00-AC-01: Include both boundaries | both boundary observations contribute; observations outside the period do not contribute. Outline cases: operation: history, numerical insight, trend assessment, overview insight | [ContextFilteredHistoryTests.Filtered_history_preserves_patient_scope_inclusive_boundaries_and_equal_bounds](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L127); [ContextSelectedInsightTests.Filtered_insight_preserves_patient_scope_inclusive_bounds_and_equal_instants](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L159); [HealthTrendTests.Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L290); [HealthOverviewTests.Overview_preserves_profile_latest_context_and_selected_insight_with_different_bases](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L57) | Verified functional assertions; executed cases in final TRX | +| 00-AC-02: Equal bounds are valid | the period is accepted; only observations at that instant are selected; the operation applies its own data-sufficiency rules. Outline cases: operation: history, numerical insight, trend assessment, overview insight | [ContextFilteredHistoryTests.Filtered_history_preserves_patient_scope_inclusive_boundaries_and_equal_bounds](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L127); [ContextSelectedInsightTests.Filtered_insight_preserves_patient_scope_inclusive_bounds_and_equal_instants](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L159); [HealthTrendTests.Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L290); [HealthOverviewTests.Equal_offset_instants_are_valid_and_single_observation_insight_is_sufficient](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L143) | Verified functional assertions; executed cases in final TRX | +| 00-AC-03: Reject reversed bounds | the request is rejected. Outline cases: operation: history, numerical insight, trend assessment, overview insight | [ObservationHistoryTests.Invalid_or_missing_period_is_rejected_without_changing_observations](../tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs#L90); [HealthInsightTests.Invalid_or_missing_period_is_rejected](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L119); [HealthTrendTests.Invalid_period_or_selection_is_rejected_with_explanation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L385); [HealthOverviewTests.Invalid_period_or_context_is_rejected_with_details](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L188) | Verified functional assertions; executed cases in final TRX | +| 01-AC-01: Create a patient with valid information | the patient profile is created successfully; a patient identifier is assigned; the identifier is associated with the authenticated account | [CreatePatientTests.Valid_profile_is_assigned_an_identifier_and_can_be_retrieved_after_restart](../tests/HealthApp.AcceptanceTests/CreatePatientTests.cs#L16) | Verified functional assertions; executed cases in final TRX | +| 01-AC-02: A patient name is required | the patient profile is rejected | [CreatePatientTests.Missing_required_information_is_rejected_without_persisting](../tests/HealthApp.AcceptanceTests/CreatePatientTests.cs#L54) | Verified functional assertions; executed cases in final TRX | +| 01-AC-03: A date of birth is required | the patient profile is rejected | [CreatePatientTests.Missing_required_information_is_rejected_without_persisting](../tests/HealthApp.AcceptanceTests/CreatePatientTests.cs#L54) | Verified functional assertions; executed cases in final TRX | +| 01-AC-04: Reject a second profile | the request reports that a profile already exists; no second profile is created and the association is unchanged | [PatientAuthenticationTests.Profile_creation_retries_and_concurrency_preserve_one_persistent_association](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L143) | Verified functional assertions; executed cases in final TRX | +| 01-AC-05: Persistent account association | the same associated profile is returned | [PatientAuthenticationTests.Profile_creation_retries_and_concurrency_preserve_one_persistent_association](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L143) | Verified functional assertions; executed cases in final TRX | +| 01-AC-06: Retry after a successful creation response was lost | the result indicates that the profile already exists; no duplicate profile or replacement association is created | [ProfileLifecycleTests.Concurrent_creation_lost_response_and_restart_preserve_one_accessible_profile](../tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs#L14) | Verified functional assertions; executed cases in final TRX | +| 01-AC-07: Concurrent initial creation | at most one profile is created and associated with the account; no request reports a second profile as created | [PatientAuthenticationTests.Profile_creation_retries_and_concurrency_preserve_one_persistent_association](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L143) | Verified functional assertions; executed cases in final TRX | +| 01-AC-08: Recovery after interrupted creation | the operation recovers to one accessible associated profile or reports that creation remains incomplete; it neither produces duplicate profiles nor reports an inaccessible profile as successfully created | [PatientAuthenticationTests.Database_failure_rolls_back_profile_and_association_together](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L208); [PatientAuthenticationTests.Failed_creation_can_be_retried_without_an_orphan_profile](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L166) | Verified functional assertions; executed cases in final TRX | +| 01-AC-09: Unauthenticated initial creation | the request is rejected and no profile is created | [PatientAuthenticationTests.Missing_and_invalid_tokens_reject_every_existing_patient_operation](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L75) | Verified functional assertions; executed cases in final TRX | +| 02-AC-01: Retrieve an existing patient | the patient profile is returned; the returned patient identifier matches the requested patient; the patient's name is included; the patient's date of birth is included; the patient's contact information is included | [CreatePatientTests.Valid_profile_is_assigned_an_identifier_and_can_be_retrieved_after_restart](../tests/HealthApp.AcceptanceTests/CreatePatientTests.cs#L16) | Verified functional assertions; executed cases in final TRX | +| 02-AC-02: Request a patient that does not exist | the request reports that the patient does not exist | [CreatePatientTests.Unknown_identifier_returns_not_found](../tests/HealthApp.AcceptanceTests/CreatePatientTests.cs#L96) | Verified functional assertions; executed cases in final TRX | +| 03-AC-01: Update an existing patient | the update succeeds; the patient identifier is unchanged; the patient profile contains contact information "new@example.test" | [UpdatePatientTests.Updated_profile_preserves_identity_and_date_of_birth_and_survives_restart](../tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs#L13) | Verified functional assertions; executed cases in final TRX | +| 03-AC-02: Update a patient that does not exist | the update is rejected; no new patient is created | [UpdatePatientTests.Updating_a_missing_patient_is_rejected_without_creating_a_profile](../tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs#L39) | Verified functional assertions; executed cases in final TRX | +| 04-AC-01: Record a valid observation | the observation is accepted; an observation identifier is assigned; the observation is associated with the patient; the observation can be retrieved later | [RecordObservationTests.Valid_observation_is_assigned_an_identifier_associated_with_the_patient_and_retrievable_after_restart](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L28) | Verified functional assertions; executed cases in final TRX | +| 04-AC-02: Record an observation without optional fields | the observation is accepted | [RecordObservationTests.Optional_fields_can_be_omitted_and_identifiers_are_distinct](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L58) | Verified functional assertions; executed cases in final TRX | +| 04-AC-03: Reject an observation containing a non-positive measured value | the observation is rejected. Outline cases: columns (systolic, diastolic, pulse); cases (0, 82, 68), (-1, 82, 68), (128, 0, 68), (128, -1, 68), (128, 82, 0), (128, 82, -1) | [RecordObservationTests.Non_positive_values_are_rejected_without_saving](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L80) | Verified functional assertions; executed cases in final TRX | +| 04-AC-04: Reject an observation without a measurement timestamp | the observation is rejected | [RecordObservationTests.Missing_or_malformed_information_is_rejected_without_saving](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L104) | Verified functional assertions; executed cases in final TRX | +| 04-AC-05: Record an observation for a patient that does not exist | the observation is rejected | [RecordObservationTests.Missing_patient_is_rejected_without_saving](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L118) | Verified functional assertions; executed cases in final TRX | +| 04-AC-06: Record setting and condition independently | observation creation succeeds | [RecordMeasurementContextTests.Setting_and_activity_are_independent_and_departures_from_guidance_are_valid](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L80) | Verified functional assertions; executed cases in final TRX | +| 04-AC-07: Record partial context | observation creation succeeds | [RecordMeasurementContextTests.Partial_and_absent_context_remain_unknown_without_reinterpreting_legacy_text](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L101) | Verified functional assertions; executed cases in final TRX | +| 04-AC-08: Retain support for absent context | observation creation succeeds | [RecordMeasurementContextTests.Partial_and_absent_context_remain_unknown_without_reinterpreting_legacy_text](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L101) | Verified functional assertions; executed cases in final TRX | +| 04-AC-09: Record departure from routine | observation creation succeeds | [RecordMeasurementContextTests.Setting_and_activity_are_independent_and_departures_from_guidance_are_valid](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L80) | Verified functional assertions; executed cases in final TRX | +| 04-AC-10: Reject unsupported category | the operation is rejected with an explanation of the invalid category | [RecordMeasurementContextTests.Invalid_context_is_rejected_with_validation_details_without_saving](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L150) | Verified functional assertions; executed cases in final TRX | +| 04-AC-11: Retrieve previously saved context | the returned observation contains those saved details associated with that observation | [RecordMeasurementContextTests.Complete_context_is_saved_with_the_correct_values_and_retrievable_after_restart](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L40) | Verified functional assertions; executed cases in final TRX | +| 04-AC-12: Reject another patient’s context submission | the operation is rejected | [RecordMeasurementContextTests.Context_is_protected_against_other_patient_reads_and_submissions_and_professional_writes](../tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs#L165) | Verified functional assertions; executed cases in final TRX | +| 05-AC-01: Retrieve an existing observation | the observation is returned; the systolic value is 128; the diastolic value is 82; the pulse value is 68 | [ViewObservationContextTests.Complete_saved_context_is_returned_with_its_measurements_and_timestamp_after_restart](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L66) | Verified functional assertions; executed cases in final TRX | +| 05-AC-02: Retrieve an observation that does not exist | the request reports that the observation does not exist | [ViewObservationContextTests.Missing_observation_reports_not_found_without_disclosing_saved_context](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L122) | Verified functional assertions; executed cases in final TRX | +| 05-AC-03: Return complete saved context | its saved context is returned with its numerical measurements and timestamp | [ViewObservationContextTests.Complete_saved_context_is_returned_with_its_measurements_and_timestamp_after_restart](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L66) | Verified functional assertions; executed cases in final TRX | +| 05-AC-04: Return partial context | Clinic is returned as the setting; activity condition is represented as unknown | [ViewObservationContextTests.Partial_saved_context_distinguishes_known_setting_from_unknown_condition_and_details](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L97) | Verified functional assertions; executed cases in final TRX | +| 05-AC-05: Preserve historical free text | the original text is returned; no definite setting or activity condition is invented | [ViewObservationContextTests.Historical_free_text_is_returned_without_inventing_setting_or_activity](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L109) | Verified functional assertions; executed cases in final TRX | +| 05-AC-06: Protect context | access is rejected; its context is not disclosed | [ViewObservationContextTests.Unauthorised_callers_cannot_read_observation_context](../tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs#L132) | Verified functional assertions; executed cases in final TRX | +| 06-AC-01: Return the most recent observation | the observation measured at "2026-09-12T08:00:00" is returned | [LatestObservationTests.Latest_is_selected_by_measurement_time_for_the_requested_patient_after_restart](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L43) | Verified functional assertions; executed cases in final TRX | +| 06-AC-02: Patient has no observations | the result indicates that no observation is available | [LatestObservationTests.Patient_without_observations_returns_not_found_even_when_another_patient_has_observations](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L61) | Verified functional assertions; executed cases in final TRX | +| 06-AC-03: Return context of latest observation | the newer observation is returned with its after-activity context | [LatestObservationTests.Newer_after_activity_observation_is_returned_with_its_own_context](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L113) | Verified functional assertions; executed cases in final TRX | +| 06-AC-04: Do not substitute a more complete observation | the latest observation is returned; its context is represented as unknown | [LatestObservationTests.Missing_context_does_not_replace_latest_with_an_older_complete_observation](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L126) | Verified functional assertions; executed cases in final TRX | +| 06-AC-05: Preserve timestamp tie selection | the second observation is returned with its own setting | [LatestObservationTests.Measurement_timestamp_ties_use_original_recording_time_and_ignore_later_edits](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L148) | Verified functional assertions; executed cases in final TRX | +| 06-AC-06: No observations | the system reports that no observation is available | [LatestObservationTests.Patient_without_observations_returns_not_found_even_when_another_patient_has_observations](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L61) | Verified functional assertions; executed cases in final TRX | +| 06-AC-07: Resolve a complete timestamp tie reproducibly | the same observation is returned under the documented final tie rule | [LatestObservationTests.Complete_timestamp_ties_choose_greatest_identifier_reproducibly_across_restart](../tests/HealthApp.AcceptanceTests/LatestObservationTests.cs#L171) | Verified functional assertions; executed cases in final TRX | +| 07-AC-01: Retrieve observations within a period | exactly 1 observation is returned; the returned observation was measured at "2026-09-05T08:00:00" | [ObservationHistoryTests.Selected_period_returns_only_the_matching_observation_after_restart](../tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 07-AC-02: Return observations in chronological order | the observations are returned in chronological order by measurement timestamp | [ObservationHistoryTests.Results_are_chronological_and_include_both_period_boundaries](../tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs#L60) | Verified functional assertions; executed cases in final TRX | +| 07-AC-03: No observations exist within the requested period | an empty observation collection is returned | [ObservationHistoryTests.No_matching_observations_returns_an_empty_array](../tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs#L74) | Verified functional assertions; executed cases in final TRX | +| 07-AC-04: Reject an invalid period | the request is rejected | [ObservationHistoryTests.Invalid_or_missing_period_is_rejected_without_changing_observations](../tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs#L90) | Verified functional assertions; executed cases in final TRX | +| 07-AC-05: Select home observations | only home observations within the period are returned with their context | [ContextFilteredHistoryTests.Independent_and_combined_selections_return_matching_context_and_metadata](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L58) | Verified functional assertions; executed cases in final TRX | +| 07-AC-06: Combine setting and activity | only home-resting observations are returned | [ContextFilteredHistoryTests.Independent_and_combined_selections_return_matching_context_and_metadata](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L58) | Verified functional assertions; executed cases in final TRX | +| 07-AC-07: Select unknown context | only observations with unknown setting are returned | [ContextFilteredHistoryTests.Unknown_selections_match_unknown_categories_without_interpreting_legacy_text](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L83) | Verified functional assertions; executed cases in final TRX | +| 07-AC-08: No selection excludes nothing on context alone | all those observations are returned in ascending measurement-time order | [ContextFilteredHistoryTests.No_selection_retains_all_contexts_in_chronological_order_after_restart](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L100) | Verified functional assertions; executed cases in final TRX | +| 07-AC-09: No matching observations | an empty collection is returned | [ContextFilteredHistoryTests.Empty_filtered_history_is_an_empty_array_with_applied_selection_metadata](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L115) | Verified functional assertions; executed cases in final TRX | +| 07-AC-10: Reject unsupported selection | the request is rejected with an explanation | [ContextFilteredHistoryTests.Unsupported_selections_are_rejected_without_changing_observations](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L148) | Verified functional assertions; executed cases in final TRX | +| 07-AC-11: Preserve patient and boundary rules | both boundary observations are returned; the outside-period and other-patient observations are excluded | [ContextFilteredHistoryTests.Filtered_history_preserves_patient_scope_inclusive_boundaries_and_equal_bounds](../tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs#L127) | Verified functional assertions; executed cases in final TRX | +| 08-AC-01: Correct an existing observation | the update succeeds; the observation identifier is unchanged; the observation contains systolic value 128 | [UpdateObservationTests.Correction_preserves_other_information_and_is_visible_in_all_retrievals_after_restart](../tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs#L39) | Verified functional assertions; executed cases in final TRX | +| 08-AC-02: Reject an update containing a non-positive measured value | the update is rejected. Outline cases: columns (systolic, diastolic, pulse); cases (0, 82, 68), (128, 0, 68), (128, 82, 0) | [UpdateObservationTests.Non_positive_values_are_rejected_without_changing_observation](../tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs#L82) | Verified functional assertions; executed cases in final TRX | +| 08-AC-03: Update an observation that does not exist | the update is rejected | [UpdateObservationTests.Missing_observation_is_rejected_without_inserting_a_new_observation](../tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs#L114) | Verified functional assertions; executed cases in final TRX | +| 08-AC-04: Add context to historical observation | the update succeeds | [PatchObservationTests.Context_can_be_added_to_a_historical_observation_without_changing_its_measurements](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L55) | Verified functional assertions; executed cases in final TRX | +| 08-AC-05: Correct one context value | the update succeeds | [PatchObservationTests.Correcting_one_context_field_preserves_omitted_data_and_changes_selection_after_restart](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L65) | Verified functional assertions; executed cases in final TRX | +| 08-AC-06: Clear optional context | the update succeeds | [PatchObservationTests.Individual_optional_fields_can_be_corrected_or_cleared_without_erasing_other_context](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L85) | Verified functional assertions; executed cases in final TRX | +| 08-AC-07: Retrieve partially corrected observation | Clinic is returned; the original numerical values, timestamp, activity condition, and note are returned unchanged | [PatchObservationTests.Correcting_one_context_field_preserves_omitted_data_and_changes_selection_after_restart](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L65) | Verified functional assertions; executed cases in final TRX | +| 08-AC-08: Reject invalid context correction | the update is rejected | [PatchObservationTests.Invalid_patches_reject_the_whole_update_without_changes](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L170) | Verified functional assertions; executed cases in final TRX | +| 08-AC-09: Nonexistent observation | the update is rejected | [PatchObservationTests.Missing_observation_is_not_created_by_a_context_patch](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L201) | Verified functional assertions; executed cases in final TRX | +| 08-AC-10: Unauthorised correction | the operation is rejected | [PatchObservationTests.Other_patients_professionals_and_unauthenticated_clients_cannot_patch_context](../tests/HealthApp.AcceptanceTests/PatchObservationTests.cs#L212) | Verified functional assertions; executed cases in final TRX | +| 09-AC-01: Delete an existing observation | the deletion succeeds; the observation can no longer be retrieved; the observation no longer appears in the patient's observation history | [DeleteObservationTests.Deleted_observation_stays_absent_after_restart_and_other_observations_are_preserved](../tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 09-AC-02: Delete an observation that does not exist | the request reports that the observation does not exist | [DeleteObservationTests.Missing_observation_returns_not_found_without_changing_existing_data](../tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs#L85) | Verified functional assertions; executed cases in final TRX | +| 09-AC-03: Delete contextualised observation | deletion succeeds | [DeleteContextualisedObservationTests.Deleted_context_stays_absent_from_retrieval_filtered_history_and_latest_after_restart](../tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs#L59) | Verified functional assertions; executed cases in final TRX | +| 09-AC-04: History excludes previously deleted observation | the deleted observation and its context are absent; the remaining matching observations are returned | [DeleteContextualisedObservationTests.Deleted_context_stays_absent_from_retrieval_filtered_history_and_latest_after_restart](../tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs#L59) | Verified functional assertions; executed cases in final TRX | +| 09-AC-05: Assessment excludes deleted data | the deleted values and context do not contribute to the result | [DeleteContextualisedObservationTests.New_numerical_summary_excludes_deleted_values_and_retains_current_remaining_observations](../tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs#L82); [HealthTrendTests.Corrected_values_context_and_deletions_are_used_on_every_request_after_restart](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L352) | Verified functional assertions; executed cases in final TRX | +| 09-AC-06: Reject unauthorised deletion | the operation is rejected | [DeleteContextualisedObservationTests.Unauthorised_deletions_preserve_the_observation_and_all_context](../tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs#L120) | Verified functional assertions; executed cases in final TRX | +| 10-AC-01: Calculate averages for a period | the average systolic value is 125; the average diastolic value is 82; the average pulse value is 65 | [HealthInsightTests.Averages_use_only_the_requested_patient_and_period_after_restart](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L43) | Verified functional assertions; executed cases in final TRX | +| 10-AC-02: Calculate minimum and maximum blood-pressure values | the minimum systolic value is 118; the maximum systolic value is 130; the minimum diastolic value is 76; the maximum diastolic value is 84 | [HealthInsightTests.Minimum_and_maximum_values_are_calculated](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L62) | Verified functional assertions; executed cases in final TRX | +| 10-AC-03: Insight uses only observations in the requested period | only observations within the requested period contribute to the calculated values | [HealthInsightTests.Averages_use_only_the_requested_patient_and_period_after_restart](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L43) | Verified functional assertions; executed cases in final TRX | +| 10-AC-04: No observations exist in the requested period | the result indicates that insufficient observation data is available for calculation | [HealthInsightTests.No_matching_observations_reports_insufficient_data](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L101) | Verified functional assertions; executed cases in final TRX | +| 10-AC-05: Reject an invalid insight period | the request is rejected | [HealthInsightTests.Invalid_or_missing_period_is_rejected](../tests/HealthApp.AcceptanceTests/HealthInsightTests.cs#L119) | Verified functional assertions; executed cases in final TRX | +| 10-AC-06: Calculate from selected context only | average systolic pressure is 125.00; the result identifies Home, At rest, and two contributing observations | [ContextSelectedInsightTests.Independent_and_combined_selections_use_only_matching_observations_and_report_their_basis](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L51) | Verified functional assertions; executed cases in final TRX | +| 10-AC-07: No filter preserves pooled calculation | all eligible observations contribute to the existing numerical calculations; the mixed or unknown context is made apparent | [ContextSelectedInsightTests.Unfiltered_insight_includes_unknown_context_and_explains_mixed_and_missing_conditions](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L76) | Verified functional assertions; executed cases in final TRX | +| 10-AC-08: One selected observation | each mean equals that observation’s corresponding value; each blood-pressure minimum and maximum equals its corresponding value | [ContextSelectedInsightTests.Unknown_selection_is_explicit_and_legacy_narrative_does_not_create_known_membership](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L97) | Verified functional assertions; executed cases in final TRX | +| 10-AC-09: No matching observations | the system reports that no insight can be calculated for the selection | [ContextSelectedInsightTests.Corrections_clearing_and_deletion_change_membership_and_fresh_summary_results_after_restart](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L134) | Verified functional assertions; executed cases in final TRX | +| 10-AC-10: Correction changes membership | that observation does not contribute to the home-only calculation | [ContextSelectedInsightTests.Corrections_clearing_and_deletion_change_membership_and_fresh_summary_results_after_restart](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L134) | Verified functional assertions; executed cases in final TRX | +| 10-AC-11: Reject unsupported selection | the request is rejected with an explanation | [ContextSelectedInsightTests.Unsupported_selection_is_rejected_with_validation_details](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L178) | Verified functional assertions; executed cases in final TRX | +| 10-AC-12: Round a halfway mean upwards | the average systolic value is 120.13 | [ContextSelectedInsightTests.Means_round_only_the_final_value_to_two_decimals_with_half_up_rounding](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L118) | Verified functional assertions; executed cases in final TRX | +| 10-AC-13: Round a repeating fractional mean | the average systolic value is 120.33 | [ContextSelectedInsightTests.Means_round_only_the_final_value_to_two_decimals_with_half_up_rounding](../tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs#L118) | Verified functional assertions; executed cases in final TRX | +| 11-AC-01: Calculate a trend from observations | a trend result is returned; the trend is derived only from observations within the requested period | [HealthTrendTests.Full_period_direction_and_separate_units_and_levels](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L27); [HealthTrendTests.Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L290) | Verified functional assertions; executed cases in final TRX | +| 11-AC-02: No observations exist for trend calculation | the result indicates that insufficient observation data is available for trend calculation | [HealthTrendTests.Empty_and_single_series_report_each_unavailable_part](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L223) | Verified functional assertions; executed cases in final TRX | +| 11-AC-03: Reject an invalid trend period | the request is rejected | [HealthTrendTests.Invalid_period_or_selection_is_rejected_with_explanation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L385) | Verified functional assertions; executed cases in final TRX | +| 11-AC-04: Assess a comparable selection | separate systolic, diastolic, and pulse assessments are returned; the result identifies the selection, contributing count, and recorded basis for comparability | [HealthTrendTests.Full_period_direction_and_separate_units_and_levels](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L27) | Verified functional assertions; executed cases in final TRX | +| 11-AC-05: Different conditions remain visible | the result identifies the differing conditions; explains limitations on interpreting their combined trajectory | [HealthTrendTests.Different_conditions_and_preparation_are_visible_and_limit_combined_trajectory](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L187) | Verified functional assertions; executed cases in final TRX | +| 11-AC-06: Unknown details limit comparability | the explanation identifies the known similarities and missing details; does not certify that all measurement conditions were identical | [HealthTrendTests.Known_categories_with_missing_preparation_support_limited_reference_comparison](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L150) | Verified functional assertions; executed cases in final TRX | +| 11-AC-07: Missing context preserves numerical information | supported numerical direction and variation are returned; the limitations on clinical interpretation and comparability are explained | [HealthTrendTests.Missing_context_preserves_numerical_direction_but_not_resting_interpretation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L137) | Verified functional assertions; executed cases in final TRX | +| 11-AC-08: Conflicting descriptions | the conflict is identified; an unsupported resting interpretation is not asserted | [HealthTrendTests.Conflicting_rest_narrative_withholds_resting_interpretation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L176) | Verified functional assertions; executed cases in final TRX | +| 11-AC-09: Compare labelled selections | each result identifies its own selection and contributing observations; a difference between settings alone is not labelled improvement or deterioration over time | [HealthTrendTests.Labelled_home_and_clinic_selections_and_independent_dimensions_use_only_matches](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L312) | Verified functional assertions; executed cases in final TRX | +| 11-AC-10: Insufficient selected series | the result reports insufficient observations for temporal direction; does not use excluded observations to manufacture a trend | [HealthTrendTests.Unknown_empty_and_one_selected_observation_do_not_borrow_excluded_data](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L335) | Verified functional assertions; executed cases in final TRX | +| 11-AC-11: No temporal separation | temporal direction is reported as unavailable | [HealthTrendTests.Timestamp_ties_do_not_manufacture_direction_or_hide_descriptive_range](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L211) | Verified functional assertions; executed cases in final TRX | +| 11-AC-12: No matching data | the result reports that no matching observations are available | [HealthTrendTests.Unknown_empty_and_one_selected_observation_do_not_borrow_excluded_data](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L335) | Verified functional assertions; executed cases in final TRX | +| 11-AC-13: Updated context is used | that observation no longer contributes to the result | [HealthTrendTests.Corrected_values_context_and_deletions_are_used_on_every_request_after_restart](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L352) | Verified functional assertions; executed cases in final TRX | +| 11-AC-14: Reject invalid selection | the request is rejected with an explanation | [HealthTrendTests.Invalid_period_or_selection_is_rejected_with_explanation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L385) | Verified functional assertions; executed cases in final TRX | +| 11-AC-15: AC-11-A | the result presents each measurement separately; identifies its unit, observed level, direction, and variation | [HealthTrendTests.Full_period_direction_and_separate_units_and_levels](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L27) | Verified functional assertions; executed cases in final TRX | +| 11-AC-16: AC-11-B | only observations for that patient within the selected period contribute to the result | [HealthTrendTests.Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L290) | Verified functional assertions; executed cases in final TRX | +| 11-AC-17: AC-11-C | the result identifies the corresponding direction; bases that assessment on measurements throughout the period | [HealthTrendTests.Full_period_direction_and_separate_units_and_levels](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L27) | Verified functional assertions; executed cases in final TRX | +| 11-AC-18: AC-11-D | the result describes the intermediate variation; does not describe the period as clinically stable merely because its endpoints are similar | [HealthTrendTests.Equal_endpoints_do_not_hide_intermediate_excursion_or_reversal](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 11-AC-19: AC-11-E | the explanation describes the reversal or mixed development; does not imply that all measurements follow one consistent direction | [HealthTrendTests.Overall_decrease_can_coexist_with_reversals_and_large_variation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L58) | Verified functional assertions; executed cases in final TRX | +| 11-AC-20: AC-11-F | the explanation identifies their position relative to the reference values; does not describe them as healthy solely because their variation is limited | [HealthTrendTests.Low_variation_outside_reference_is_not_healthy](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L69) | Verified functional assertions; executed cases in final TRX | +| 11-AC-21: AC-11-G | the explanation describes that development and its basis; distinguishes improvement from having reached an appropriate level | [HealthTrendTests.Favourable_pressure_decrease_can_still_be_high_while_falling_pulse_is_concerning](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L79); [HealthTrendTests.Moving_low_pulse_up_or_high_pulse_down_is_not_automatically_concerning](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L92) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 11-AC-22: AC-11-H | the explanation describes the concern and its basis; does not treat a decrease as favourable solely because the values are falling | [HealthTrendTests.Favourable_pressure_decrease_can_still_be_high_while_falling_pulse_is_concerning](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L79) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 11-AC-23: AC-11-I | the result explains the interpretation of each affected measurement; does not force them into a single favourable or concerning classification | [HealthTrendTests.Favourable_pressure_decrease_can_still_be_high_while_falling_pulse_is_concerning](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L79) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 11-AC-24: AC-11-J | the result presents the supported numerical information; explains that the clinical interpretation is limited by missing context | [HealthTrendTests.Missing_context_preserves_numerical_direction_but_not_resting_interpretation](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L137) | Verified functional assertions; executed cases in final TRX | +| 11-AC-25: AC-11-K | the result explicitly reports that direction cannot be determined; does not substitute an increasing, decreasing, or unchanged conclusion | [HealthTrendTests.Empty_and_single_series_report_each_unavailable_part](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L223) | Verified functional assertions; executed cases in final TRX | +| 11-AC-26: AC-11-L | the result identifies the reference values used; does not present a general reference threshold as an individual treatment target | [HealthTrendTests.References_are_setting_specific_sourced_and_not_treatment_targets](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L113) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 11-AC-27: AC-11-M | the assessment remains unchanged | [HealthTrendTests.Retrieval_and_identifier_order_do_not_change_results_including_ties](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L237) | Verified functional assertions; executed cases in final TRX | +| 11-AC-28: AC-11-N | the result reflects the current observations | [HealthTrendTests.Corrected_values_context_and_deletions_are_used_on_every_request_after_restart](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L352) | Verified functional assertions; executed cases in final TRX | +| 11-AC-29: Supported reference comparison despite incomplete preparation details | the supported reference comparison is provided; the explanation identifies the remaining limits without rejecting all clinical interpretation | [HealthTrendTests.Known_categories_with_missing_preparation_support_limited_reference_comparison](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L150); [HealthTrendTests.Missing_optional_circumstances_do_not_block_supported_comparison](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L164) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 12-AC-01: View an overview for a patient with observations | the patient's profile is included; the latest blood-pressure observation is included; the calculated health insight is included | [HealthOverviewTests.Overview_preserves_profile_latest_context_and_selected_insight_with_different_bases](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L57) | Verified functional assertions; executed cases in final TRX | +| 12-AC-02: View an overview for a patient without observations | the patient's profile is included; no latest blood-pressure observation is returned; the overview indicates that no calculated health insight is available | [HealthOverviewTests.No_observations_returns_profile_and_explicit_insight_absence](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L96) | Verified functional assertions; executed cases in final TRX | +| 12-AC-03: Request an overview for a patient that does not exist | the request reports that the patient does not exist | [HealthOverviewTests.Assigned_missing_patient_reports_absence_without_exposing_other_patients](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L197) | Verified functional assertions; executed cases in final TRX | +| 12-AC-04: Reject an invalid overview period | the request is rejected | [HealthOverviewTests.Invalid_period_or_context_is_rejected_with_details](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L188) | Verified functional assertions; executed cases in final TRX | +| 12-AC-05: Latest context and insight selection differ | the latest after-activity observation and its context are returned; the insight uses only matching home-resting observations; the result distinguishes their different bases | [HealthOverviewTests.Overview_preserves_profile_latest_context_and_selected_insight_with_different_bases](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L57) | Verified functional assertions; executed cases in final TRX | +| 12-AC-06: No matching insight observations | the profile and latest observation remain available; the absence of insight for the selection is explained | [HealthOverviewTests.Empty_selected_insight_preserves_profile_latest_and_applied_selection](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L110) | Verified functional assertions; executed cases in final TRX | +| 12-AC-07: Unknown context remains unknown | its context is represented as unknown; no context is copied from other observations | [HealthOverviewTests.Unfiltered_pooled_insight_preserves_mixed_and_unknown_context_explanations](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L124) | Verified functional assertions; executed cases in final TRX | +| 12-AC-08: Default overview preserves context limitations | the original pooled insight is returned; its mixed-context explanation is included | [HealthOverviewTests.Unfiltered_pooled_insight_preserves_mixed_and_unknown_context_explanations](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L124) | Verified functional assertions; executed cases in final TRX | +| 13-AC-01: Successful authentication | the system recognises my account and Patient role; recognises its associated patient profile if one has been created | [PatientAuthenticationTests.Login_without_profile_returns_normalized_identity_and_no_patient_data](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L37) | Verified functional assertions; executed cases in final TRX | +| 13-AC-02: Access to my own information | access is permitted; the operation follows its existing acceptance criteria | [PatientAuthenticationTests.Own_observations_and_insights_are_available_but_another_patients_reads_and_writes_are_rejected](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L92) | Verified functional assertions; executed cases in final TRX | +| 13-AC-03: Invalid credentials | authentication is rejected; the response does not reveal which part of the credentials was incorrect | [PatientAuthenticationTests.Invalid_account_and_invalid_password_have_same_rejection](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L54) | Verified functional assertions; executed cases in final TRX | +| 13-AC-04: Missing authentication | the request is rejected; no patient information is returned or changed | [PatientAuthenticationTests.Missing_and_invalid_tokens_reject_every_existing_patient_operation](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L75) | Verified functional assertions; executed cases in final TRX | +| 13-AC-05: Invalid authentication information | the request is rejected; no patient information is returned or changed | [PatientAuthenticationTests.Missing_and_invalid_tokens_reject_every_existing_patient_operation](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L75) | Verified functional assertions; executed cases in final TRX | +| 13-AC-06: Access to another patient’s information | access is rejected; none of that patient’s information is returned or changed | [PatientAuthenticationTests.Own_observations_and_insights_are_available_but_another_patients_reads_and_writes_are_rejected](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L92) | Verified functional assertions; executed cases in final TRX | +| 13-AC-07: Own information does not yet exist | the system follows the existing behaviour for missing information; does not return another patient’s information | [PatientAuthenticationTests.Login_without_profile_returns_normalized_identity_and_no_patient_data](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L37) | Verified functional assertions; executed cases in final TRX | +| 13-AC-08: Login before profile creation | authentication succeeds and recognises my account and Patient role; I may create my initial profile under US-01; I gain no access to another patient’s information | [PatientAuthenticationTests.Login_without_profile_returns_normalized_identity_and_no_patient_data](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L37) | Verified functional assertions; executed cases in final TRX | +| 13-AC-09: Expired authentication | the request is rejected; no patient information is returned or changed | [PatientAuthenticationTests.Expired_token_is_rejected_and_login_produces_a_fresh_token](../tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs#L181) | Verified functional assertions; executed cases in final TRX | +| 14-AC-01: Successful authentication | the system recognises my identity and healthcare professional role | [ProfessionalAccessTests.Login_recognizes_professional_identity_and_does_not_put_assignments_in_the_token_response](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L59) | Verified functional assertions; executed cases in final TRX | +| 14-AC-02: View assigned patients | the system returns only patients assigned to me | [ProfessionalAccessTests.Professionals_list_only_their_own_assignments_and_can_share_patients](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L72) | Verified functional assertions; executed cases in final TRX | +| 14-AC-03: View an assigned patient’s information | access is permitted; the requested information is returned according to the existing retrieval requirements | [ProfessionalAccessTests.Assigned_profiles_observations_context_history_latest_and_insights_are_readable](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L99); [HealthOverviewTests.Overview_requires_owner_or_assigned_professional_and_blocks_direct_bypass](../tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs#L210); [HealthTrendTests.Trend_access_requires_authentication_ownership_or_professional_assignment](../tests/HealthApp.AcceptanceTests/HealthTrendTests.cs#L394) | Verified functional assertions; executed cases in final TRX | +| 14-AC-04: No assigned patients | the system indicates that no patients are assigned; does not return other patients | [ProfessionalAccessTests.Professionals_list_only_their_own_assignments_and_can_share_patients](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L72) | Verified functional assertions; executed cases in final TRX | +| 14-AC-05: Patient information does not yet exist | the system follows the existing behaviour for missing information | [ProfessionalAccessTests.Missing_information_for_assigned_patients_follows_existing_retrieval_behaviour](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L143) | Verified functional assertions; executed cases in final TRX | +| 14-AC-06: Access to an unassigned patient | access is rejected; no information about that patient is returned | [ProfessionalAccessTests.Unassigned_patients_and_observations_are_rejected_even_with_a_supplied_assigned_patient_id](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L122) | Verified functional assertions; executed cases in final TRX | +| 14-AC-07: Attempt to change patient information | the operation is rejected; the patient information remains unchanged | [ProfessionalAccessTests.Professionals_cannot_create_update_or_delete_any_patient_information](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L166) | Verified functional assertions; executed cases in final TRX | +| 14-AC-08: Invalid credentials | authentication is rejected; the response does not reveal which part of the credentials was incorrect | [ProfessionalAccessTests.Incorrect_professional_secret_and_unknown_account_have_identical_login_rejections](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L225) | Verified functional assertions; executed cases in final TRX | +| 14-AC-09: Missing or invalid authentication | the request is rejected; no patient information is returned | [ProfessionalAccessTests.Missing_invalid_and_expired_tokens_do_not_disclose_assignments_or_patient_data](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L201) | Verified functional assertions; executed cases in final TRX | +| 14-AC-10: Patient account attempts professional access | access is rejected; my existing access to my own information is unaffected | [ProfessionalAccessTests.Patient_cannot_list_professional_assignments_and_retains_own_access](../tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs#L235) | Verified functional assertions; executed cases in final TRX | +| 15-AC-01: Access guidance before first observation | preparation, measurement, and recording instructions are available; the source, applicability, and review date are identified | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 15-AC-02: Home measurement guidance | the instructions cover rest, equipment and cuff, positioning, repeated readings, and recording conditions; any numeric instructions follow the identified Danish or European guidance | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45) | Partially verified: preserved outputs/provenance pass; independent clinical support not verified (Q3) | +| 15-AC-03: Unknown setting | its supported setting is identified; no measurement setting is saved or assumed on the user’s behalf | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 15-AC-04: Different measurement conditions | the guidance distinguishes it from a resting measurement; explains recording the actual conditions without relabelling the result as resting | [MeasurementGuidanceTests.Activity_is_not_relabelled_as_rest_or_certified](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L80) | Verified functional assertions; executed cases in final TRX | +| 15-AC-05: Pulse context | it explains recording the pulse value and relevant activity condition; does not describe the single pulse value as a rhythm assessment | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45) | Verified functional assertions; executed cases in final TRX | +| 15-AC-06: Guidance does not certify compliance | no observation is saved or altered; following the procedure is not recorded automatically | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45); [ConformanceTests.Final_solution_has_one_web_host_and_no_reference_project_or_internal_business_http](../tests/HealthApp.AcceptanceTests/ConformanceTests.cs#L25) | Verified functional assertions; executed cases in final TRX | +| 15-AC-07: Guidance is optional | creation succeeds | [RecordObservationTests.Valid_observation_is_assigned_an_identifier_associated_with_the_patient_and_retrievable_after_restart](../tests/HealthApp.AcceptanceTests/RecordObservationTests.cs#L28) | Verified functional assertions; executed cases in final TRX | +| 15-AC-08: Guidance unavailable | its unavailability is explained; unsupported instructions are not presented as verified guidance | [MeasurementGuidanceTests.Unsupported_guidance_is_explicitly_unavailable_without_unverified_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L96) | Verified functional assertions; executed cases in final TRX | +| 15-AC-09: General guidance without login | the general guidance is available; no patient-specific information or assignment list is returned | [MeasurementGuidanceTests.Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions](../tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs#L45) | Verified functional assertions; executed cases in final TRX | diff --git a/ImplementationPlan/approval-baseline.json b/ImplementationPlan/approval-baseline.json new file mode 100644 index 0000000..d167a38 --- /dev/null +++ b/ImplementationPlan/approval-baseline.json @@ -0,0 +1,5 @@ +{ + "approvalCommit": "20ab461c0194b3098504eabc96e9852a61356953", + "file": "Docs/ApprovalRequirements/architecture-b-implementation-approval.md", + "sha256": "b07f4eeea182047a71562140f44086cd43625fbca64e437d322f0eefbd5243de" +} diff --git a/ImplementationPlan/architecture-conformance.md b/ImplementationPlan/architecture-conformance.md index 2ccb78b..f430524 100644 --- a/ImplementationPlan/architecture-conformance.md +++ b/ImplementationPlan/architecture-conformance.md @@ -1,18 +1,38 @@ -# Architecture conformance register +# Architecture B conformance evidence -Prepared 2026-10-14. **Implementation not started; all implementation evidence is not verified.** Allocation is a plan, not conformance proof. Authoritative target: `ArchitectureProposal/software-architecture.md` at `3426236c6cfcece36e94642ae84d1843288f86d5`. +Approved target revision `3426236c6cfcece36e94642ae84d1843288f86d5`; reference `2117236366130775214d9fd2611984d4348f2b79`. Approval Q1–Q5 governs supersessions and limits. No unapproved architectural deviation was introduced. -| Target | Required implementation evidence | Status | +| Target | Implemented evidence | Verification | | --- | --- | --- | -| ADR-01 / components | One process/listener; module facades/private repositories; acyclic dependency checks; no internal HTTP/callbacks | Not verified | -| ADR-02 / ownership | One DB, Profile/Observation schemas/history/owners, restricted FK, constraints/index, DML-only runtime grants | Not verified | -| ADR-03 / creation sequence | Unique non-null account association, trusted identity, race/rollback/restart/lost-response tests, commit-before-success | Not verified | -| ADR-04 / access | Framework tokens/expiry/persistent keys; actual-owner/assignment policy; no bypass routes/service keys; secret/TLS protections | Not verified | -| ADR-05 / read sequence | Repeatable-read from authorization through capture; coherent overview; release before computation/transfer; current next-request reads; no result store/cache | Not verified | -| ADR-06 / Analytics/Guidance | Preserved documented mathematics, separated clinical policy/catalog, claim-specific review/provenance, numerical sufficiency and context/narrative limits | Not verified | -| ADR-07 / context | Flattened owned fields, Unknown/AND/clear/omission/text invariants; locked atomic writes with owner recheck | Not verified | -| ADR-08 / deployment/install sequence | Single app unit and identity; local/remote DB; generated settings/roles/certificates; transient installer; real PID/HTTPS/workflow/restart proof | Not verified | -| §8 operational boundary | Safe status mapping, no false absence, no-store, sanitized logs, deadline/rollback/cancellation, bounded admission/pool | Not verified | -| §9 readiness/remote placement | Usable DB/content/key readiness, public guidance on DB outage, verified DB TLS/name, no unnecessary local DB install | Not verified | +| ADR-01 / logical components | One Web SDK host; five module libraries; immutable Contracts; private persistence; no business HTTP clients/callbacks. Final solution excludes pinned reference | Verified: ConformanceTests, Release build/publish, single native app unit/PID | +| ADR-02 / data ownership | `profile.patient`, `observations.observation`; per-schema migration version; two NOLOGIN schema owners; restricted patient FK; positive/category/rest/time/account constraints; patient/time/original/UUID index; DML runtime role | Verified: migrations twice, FK/check rejection, runtime DDL denial, actual installer role/readiness check. Schemas remain logical ownership, not compromise isolation | +| ADR-03 / creation sequence | Trusted account, atomic single-row durable association, unique non-null account, conflict recovery and `/me` | Verified: original lifecycle assertions, simultaneous creation, trigger rollback, retry/lost response, restart/access | +| ADR-04 / access boundary | Framework opaque tickets with issue/expiry, 30-minute default, persistent scoped keys; normalized identities/policies; actual owner and assignments before validation/serialization; internal routes absent; no service-key trust | Verified: full patient/professional suites, expired/tampered/spoofed identity, provider replacement, real HTTPS/native restart | +| ADR-05 / read sequence | Shared repeatable-read from access lookup through immutable capture; Overview captures profile/latest/selected series, selects series once; releases before mathematical evaluation/transfer; no result cache/store | Verified: controlled concurrent commit test proves old coherent snapshot/new next request and released transaction | +| ADR-06 / Analytics/Guidance | Original Summary/Trend formulas and clinical branching retained; numerical/clinical policies separated; versioned Guidance reference/claim provenance; full-period/tie/sufficiency rules and disclosed narrative limits | Verified functional calculations/classifications/provenance. Independent clinical validity remains not verified, explicitly preserved under Q3 | +| ADR-07 / context lifecycle | Flattened observation-owned fields; independent AND/Unknown selections; original prose; omission/set/clear and whole-context clear; owner-scoped locked mutation/delete | Verified: original context/patch/delete suites plus controlled concurrent disjoint patches and schema default assertions | +| ADR-08 / native deployment | Fresh independently provisioned database; generated credentials/config/certificates/keys; transient provisioner; one dedicated systemd app; local or hostname-verified TLS DB | Verified actual Debian 12 systemd local/remote installation in isolated Linux environments; other families intended with command-contract tests, native execution not verified | +| §8 failures/resources | Bounded pooled connections and independent assessment admission; cancellation/deadline/rollback; no-store; sanitized logging; failure/absence distinctions; full untruncated history | Verified: deadline leaves state unchanged, 503/Retry-After budget and guidance independence, DB failures never become empty results; synchronous numerical methods retain boundary cancellation checks | +| §9 readiness/security | Protected config/private key/key ring; authenticated liveness/readiness; verified DB CA/hostname; no unnecessary local DB in remote mode; no overwrite | Verified: native certificate workflows, wrong hostname rejection, file-mode/overwrite checks and operational tests. Automatic certificate renewal/HA/production recovery remain outside scope | -Approved deviations: none. Pending incompatibility approvals: Q1 in [open-questions.md](open-questions.md). Any new necessary deviation requires explanation and approval before implementation. +## Revised US-16, approved Q1/Q5 + +Original clauses remain unchanged in Docs and original architecture tests remain in Reference. The approved proposal revision supplies the replacement acceptance meaning. + +| Criterion | B evidence / status | +| --- | --- | +| AC-16-A | Complete app selected as the deployment unit; feature-service selection intentionally superseded. Native app install verified | +| AC-16-B | Modules one app process; PostgreSQL separately managed. App stop leaves DB ready, verified | +| AC-16-C | Complete one-app deployment, one HTTPS edge, typed internal calls. Native workflow verified | +| AC-16-D | Protected app/module configuration and independently configured DB endpoint, generated automatically; local/remote verified | +| AC-16-E | Same app supports separate verified-TLS PostgreSQL host; no feature-service distribution. Separate-host-namespace remote workflow and hostname rejection verified | +| AC-16-F | App and DB have independent lifecycles; features start/stop together. PID/restart/DB-during-stop verified | +| AC-16-G | One DB with distinct schema/migration ownership and DML role; no derived-result persistence. Grants/constraints/readiness verified | +| AC-16-H | Same module/communication/persistence responsibilities for both placements. Both native placements verified | +| AC-16-I | Actual app PID, trusted HTTPS, configured DB, representative synthetic operations, independent stop/restart and new PID verified | + +Generated-password/roles, protected secret storage, certificate/trust/replacement, distribution dependency detection, migration, systemd enable/start, failure-stage diagnostics and overwrite protection are implemented. APT/DNF/pacman remote-mode tests prove local PostgreSQL commands are excluded; actual Debian remote installation confirms absence. Existing rules are retained when a scoped local SCRAM entry is added for the new B DB/role. + +## Evidence limits + +Native environments are disposable Debian 12 systemd instances sharing Manjaro kernel 7.1.13-2-MANJARO, not bare-metal/VM or measurement environments. .NET 10.0.13 / local PG 15.19 and remote PG 18.6 were recorded. Fedora/RHEL, Ubuntu, Debian 13 and Arch/Manjaro native installation remain intended/unverified despite adapter command tests. Clinical references/classifications are preserved with uncertainty/provenance, not newly clinically certified. Arbitrary narrative/negation is not understood beyond the unchanged detector and disclosed limits. Large full-history materialization and whole-process/DB-role failure/compromise scope remain approved tradeoffs, without capacity or HA claims. No live A import occurred; no energy improvement is claimed. diff --git a/ImplementationPlan/documentation-inventory.md b/ImplementationPlan/documentation-inventory.md index 05a820a..134f0f2 100644 --- a/ImplementationPlan/documentation-inventory.md +++ b/ImplementationPlan/documentation-inventory.md @@ -89,3 +89,7 @@ Captured 2026-10-14. `Docs/Requirements` governs functionality; `ArchitecturePro ## Diagram inspection All editable Draw.io files were parsed; target labels and relationships were inspected, including all four sequence pages. No GUI rendering or round-trip validation was performed in this preparation. Target diagrams describe modules, immutable values, one database with restricted FK, two deployment placements and authorized shared snapshots; no internal HTTP or separately installable feature services. Historical JPEGs were inventoried rather than treated as current structure. + +## Added authoritative approval + +`Docs/ApprovalRequirements/architecture-b-implementation-approval.md` was supplied by the owner at commit `20ab461c0194b3098504eabc96e9852a61356953`, read completely, and preserved. Its separate SHA-256 record is approval-baseline.json. It approves Q1–Q5, explicitly modifies Linux portability, requires unchanged clinical outputs, excludes live A data access/import, and authorizes incremental implementation. It supersedes the earlier pending-approval statuses, not the preserved input documents. diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53.trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53.trx new file mode 100644 index 0000000..585acd2 --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53.trx @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.04] Discovering: HealthApp.DeploymentTests +[xUnit.net 00:00:00.08] Discovered: HealthApp.DeploymentTests +[xUnit.net 00:00:00.09] Starting: HealthApp.DeploymentTests +[xUnit.net 00:00:00.58] Finished: HealthApp.DeploymentTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53[1].trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53[1].trx new file mode 100644 index 0000000..663a93c --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_12_53_53[1].trx @@ -0,0 +1,2841 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.05] Discovering: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.11] Discovered: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.15] Starting: HealthApp.AcceptanceTests +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a271550d-04be-43fb-b6a5-90a1e9f69500} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {260e1269-3105-4939-8207-344b66bf4d37} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {e5f23f90-9a9f-4ecb-a155-bb2c19768e4c} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Production +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {d1ae720a-2271-4e30-b0fe-000ef83ff27d} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a6cd0450-95e6-48a4-a79f-c0b7fab6f8cb} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {21f56e55-b543-40a8-984b-add972641fbe} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {c68704c0-b487-4142-a61c-2244fa9eac32} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {002b61d7-0ff9-47b2-9a49-75f1456dbd00} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {6c505df1-3a56-4eb7-b3b5-0d981e8ed968} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {e1610d9b-e917-412a-9b83-4cc6ad6f70ce} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {eeb46a36-fb30-42e7-a2d3-08e21312eb73} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {3261ef61-7ea8-43dd-8ff4-8ee40c2a8695} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {c6535e11-3d81-4461-8f1d-7ae4c72105c4} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f4e01cc5-b14a-47bb-943d-89ee47abcefa} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44597 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42409 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39521 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {d10be9d0-ffc6-48ce-93f5-271f15a54d26} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38961 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {cbbcd0db-a319-47b7-9e53-8b1f962ac889} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {132ddb6e-315e-4a0a-a9c2-c3e7e1df9371} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {fdf6e91b-f470-4a08-94b5-abd5093e7778} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46283 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45585 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {b52e7cbe-4ad6-417e-809e-467bd5cecb5a} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {27adf672-0692-4174-a6b8-fdd00e7033ab} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {98fa6f30-5e06-4954-97c2-e0982dd69dfb} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34007 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f04feda8-fcca-4cc6-8897-1e8073c9a304} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {7322a5ec-700d-4f94-a604-9da688187ead} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42971 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43063 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {bead7b9e-4577-4570-994a-c84be5e98b8a} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35067 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40823 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43869 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {2829edfc-41dd-4ba4-94d6-8b03f93f1b7b} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {ac2312e8-6482-49b1-9152-ecdcd927d531} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {325e7180-9ec5-46f8-8791-c11bfe165b67} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {e70ee02d-7e56-4e47-b875-34c2f5b4c089} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {b68b5bb0-2ad5-401f-858d-1cd5906e7b92} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {ce9cd292-77e8-4e59-b7c2-ab9a83bff33b} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {4f5bd90d-ba05-4935-8164-5cbfbb4b8eda} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {9f9847b2-ee3f-45ea-ab81-763d29e66f63} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {bd107ca9-daf4-48d7-bb90-de04cbf212c0} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {205bb6a8-dac1-402f-ba97-9c86d196ea7a} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42695 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35643 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42705 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35705 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42371 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:32875 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33585 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44299 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44719 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41795 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34169 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43049 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42609 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46343 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39607 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41385 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46483 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34713 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33543 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36895 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33889 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42239 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39773 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44807 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38133 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36561 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35049 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44971 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40721 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42349 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35537 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45335 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37103 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46059 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37239 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34165 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9S5OF4LK9:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40391 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41497 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46583 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34633 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34823 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46869 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39549 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Update failed with 504; correlation 0HNP9S5OF4LKA:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] + An unhandled exception has occurred while executing the request. + Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. + ---> Npgsql.PostgresException (0x80004005): P0001: test write failure + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + Exception data: + Severity: ERROR + SqlState: P0001 + MessageText: test write failure + Where: PL/pgSQL function fail_profile_test() line 3 at RAISE + File: pl_exec.c + Line: 3909 + Routine: exec_stmt_raise + --- End of inner exception stack trace --- + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at HealthApp.Profile.ProfileFacade.CreateAsync(String trustedAccountId, CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/Modules/Profile/ProfileFacade.cs:line 22 + at HealthApp.Controllers.PatientController.Create(CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Controllers/PatientController.cs:line 16 + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 52 + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 60 + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at HealthApp.Program.<>c__DisplayClass0_0.<<Main>b__5>d.MoveNext() in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Program.cs:line 63 + --- End of stack trace from previous location --- + at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35535 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35821 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9S5OF4LKJ:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35733 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36607 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40867 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34861 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36469 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Trend failed with 503; correlation 0HNP9S5OF4LKM:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42375 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43067 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Create failed with 503; correlation 0HNP9S5OF4LKN:00000001 +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Record failed with 503; correlation 0HNP9S5OF4LKO:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40281 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38361 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40763 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Insight failed with 503; correlation 0HNP9S5OF4LKR:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41847 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46705 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9S5OF4LKS:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35907 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45891 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44689 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40093 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45931 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45733 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41239 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37085 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37241 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41913 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36867 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41549 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43461 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46155 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {843f5e6e-3894-4e99-8502-eab6c7518cf3} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36315 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41317 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43957 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36419 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35649 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37213 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35219 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37441 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9S5OF4LLI:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35149 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35391 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +[xUnit.net 00:00:05.42] Finished: HealthApp.AcceptanceTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15.trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15.trx new file mode 100644 index 0000000..418ec2a --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15.trx @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.04] Discovering: HealthApp.DeploymentTests +[xUnit.net 00:00:00.07] Discovered: HealthApp.DeploymentTests +[xUnit.net 00:00:00.09] Starting: HealthApp.DeploymentTests +[xUnit.net 00:00:00.54] Finished: HealthApp.DeploymentTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15[1].trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15[1].trx new file mode 100644 index 0000000..2617d2c --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_13_27_15[1].trx @@ -0,0 +1,2841 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.06] Discovering: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.12] Discovered: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.16] Starting: HealthApp.AcceptanceTests +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {89c4e045-3b41-4d36-ac88-d25726e684aa} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {64d3eaa8-0cb7-4035-8973-a6e11f660d13} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a84ad967-edc3-44d5-97d2-8e556c03d892} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Production +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {4698e7bb-658f-41cb-bd48-1258c537a0ca} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {150242e7-9c81-44f4-b5cc-6f9c6912f606} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {29975798-8738-422d-85cf-6749532713fe} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {81a66aca-a8f6-4e1e-be9e-fb9342638fb3} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {8efa003b-8b8f-4f01-b574-76d407915a92} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a60f8453-a8c6-4290-a3b0-77ab339da4ad} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {766f9378-3706-445f-be62-31386c5b43aa} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {24bcc8ff-5066-4eb5-870a-55635e8d8c38} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {20abcc4d-15a1-44c2-9314-b016ffa2db8c} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {09b4f397-29d6-4785-b4e9-7036e523436e} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {efd033dc-d45b-4f3d-a3c9-3e0325deadfe} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {b86ab411-a86a-42b2-87f9-e9638c81d0b0} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46139 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35105 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42483 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45873 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a2499471-2b4a-48b2-8a36-5d680f3cecc0} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35651 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {da9b0241-895b-4f95-a205-ff1ebcbb1e63} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {57bca0ab-be0f-4bef-895c-8b603a472c70} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33699 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37533 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {06734a2f-c59a-4f47-b1b1-2c05b50c7c43} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38763 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {c64e6123-2c21-43f9-ad0f-45a1007130b3} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36911 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {6dff92c0-4e10-48b2-8cfd-439e8808eb22} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {84c9de86-51f1-4f24-b377-f9c0f7ab1026} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {fe9fbdab-d9f8-49b9-919b-df0d870bff81} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36971 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46141 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40535 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {8aee790d-21f4-4749-89a9-fc512179b837} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {47bfd042-e2a3-4830-a423-44132fbd5711} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45543 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37437 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {1b7ae89b-80f7-42c1-9e46-23a780843092} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {18da1331-caee-464e-93c5-e8d791354c17} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {10a7baf3-817e-4af9-a708-c902703c7be9} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34709 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35663 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {5124f33f-9c79-4cf6-8e07-c25c6dcf51d5} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a9ff33ac-2a1f-43ea-92e5-79912a08aab0} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45811 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43141 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a4ac5c16-fa94-4d2b-91a9-a76107139e6a} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38939 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {422afe07-a592-49a0-97df-8c4ef7a9af08} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {fd3aab9f-0db4-48a8-9ead-5c2fbab54787} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f01a9c83-e24c-413e-acc4-bf549a02d1d9} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45529 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40227 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43281 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40553 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35391 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34591 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42661 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36661 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35419 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41747 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43669 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42827 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43365 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38615 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35203 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34645 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36145 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40873 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38565 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44803 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36571 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45361 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40189 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39313 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41873 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38273 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38887 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45941 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9SOCTQ0BA:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43419 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38207 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34971 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Update failed with 504; correlation 0HNP9SOCTQ0B8:00000001 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38553 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40573 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37189 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37385 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44619 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36899 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34849 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42615 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] + An unhandled exception has occurred while executing the request. + Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. + ---> Npgsql.PostgresException (0x80004005): P0001: test write failure + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + Exception data: + Severity: ERROR + SqlState: P0001 + MessageText: test write failure + Where: PL/pgSQL function fail_profile_test() line 3 at RAISE + File: pl_exec.c + Line: 3909 + Routine: exec_stmt_raise + --- End of inner exception stack trace --- + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at HealthApp.Profile.ProfileFacade.CreateAsync(String trustedAccountId, CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/Modules/Profile/ProfileFacade.cs:line 23 + at HealthApp.Controllers.PatientController.Create(CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Controllers/PatientController.cs:line 17 + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 53 + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 61 + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at HealthApp.Program.<>c__DisplayClass0_0.<<Main>b__5>d.MoveNext() in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Program.cs:line 68 + --- End of stack trace from previous location --- + at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9SOCTQ0BL:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43955 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44059 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38165 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42707 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37693 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Create failed with 503; correlation 0HNP9SOCTQ0BP:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36925 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Trend failed with 503; correlation 0HNP9SOCTQ0BQ:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37105 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38873 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9SOCTQ0BS:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42289 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35155 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Record failed with 503; correlation 0HNP9SOCTQ0BU:00000001 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42635 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42045 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Insight failed with 503; correlation 0HNP9SOCTQ0C0:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34911 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42623 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41821 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45931 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39243 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39687 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45655 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41533 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39905 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34985 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45895 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38275 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40131 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34645 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34665 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {3a1333b8-e9c5-4135-8ed4-9c2084a8dab7} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40323 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42549 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36121 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42465 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45939 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35749 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9SOCTQ0CK:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38037 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33387 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +[xUnit.net 00:00:04.56] Finished: HealthApp.AcceptanceTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02.trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02.trx new file mode 100644 index 0000000..6258f23 --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02.trx @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.04] Discovering: HealthApp.DeploymentTests +[xUnit.net 00:00:00.06] Discovered: HealthApp.DeploymentTests +[xUnit.net 00:00:00.07] Starting: HealthApp.DeploymentTests +[xUnit.net 00:00:00.44] Finished: HealthApp.DeploymentTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02[1].trx b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02[1].trx new file mode 100644 index 0000000..d983dd2 --- /dev/null +++ b/ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02[1].trx @@ -0,0 +1,2841 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) +[xUnit.net 00:00:00.05] Discovering: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.10] Discovered: HealthApp.AcceptanceTests +[xUnit.net 00:00:00.13] Starting: HealthApp.AcceptanceTests +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {3af29593-6ab3-4de4-88e6-0fad93cb4e66} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {134896c3-4a6e-4ec7-b5c3-b27686d68a74} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {271499f5-9ddf-47b3-aa66-7b54eda0395b} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Production +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {5b593d5a-c5bb-46d9-90f8-2912fd3aed3a} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {9dd92a93-9f89-4c4e-8d0f-366d1a372574} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f1a26b74-097d-4c62-b4cb-0f0c4c9ca68b} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {544ca0ab-41c7-4817-a235-84bb4416c148} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {1e861c8a-11c6-44db-9e17-4bd9c10bb058} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {32d603b0-62d2-4771-b3c0-0e644e8b4d84} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f3f4548d-e7f1-4bcf-93f3-4f12797d1fe3} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {6e10c50a-f090-40fb-a771-982d7656f473} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {7bad8b6d-735a-497a-b145-4dec4b36dc3b} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {d1261743-e02a-4e95-af13-02fe9e8d5eee} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {b5a578a6-0b61-44d8-aa74-75dc8eb62bc6} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {90d9ff38-3776-4b83-a28d-5a4527d3fae2} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {0f0e859a-e50c-46bf-b72c-69063d2e9379} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {d590a9c5-a523-4601-b088-c687c1cf5dd3} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a033ccf6-6ba4-4f9c-ad4d-59fc46e80df1} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41187 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34267 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44239 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42699 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37219 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43757 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41809 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {8a198fee-83de-4ac4-97ae-3e56273b8642} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41905 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {6a40c9f9-b669-4c11-a560-bb923e00fe60} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {0af6885e-c24e-493c-94ac-bf8aef219c1e} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41651 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {8b605dd7-fc8e-4c82-b532-37d539eb4ec0} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a01dca9d-68a3-4088-a97f-ee4698b69554} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36459 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a08a72da-1e3b-4571-8514-0c9360caa1cf} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {6931a6aa-e704-4731-a5fb-2cdb4c689139} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34099 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39871 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38033 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {9f283fb5-c4de-4c0e-9006-4fda092f6607} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33361 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {05888143-2141-4bec-ad7a-9aa9d5767a95} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {752abe41-3a36-4ae1-94e6-e44c68d2b0ba} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {bedefc36-f9e2-4530-bdff-930b0cbbb623} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {9d4c5317-ee11-4422-b38a-e2774149c9b2} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {a70fe8da-f878-476b-8c64-a0d8797fb91b} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {e41acea2-c52b-4527-8e9f-c6c33b0ccc19} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f559255d-e500-44ed-a688-11519b6cdf78} may be persisted to storage in unencrypted form. +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {f5ac842c-e205-4ce1-a001-3fe6fb196789} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34415 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37897 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40139 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36165 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39799 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46367 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43197 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46565 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46207 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34759 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45479 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41465 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46537 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45933 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37735 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40815 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45295 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33941 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44147 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35641 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41959 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34639 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34363 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34147 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44985 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34329 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37041 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41595 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45583 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46201 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9VQKEU9QH:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44163 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46777 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37655 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37911 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45913 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42569 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36109 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35029 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36407 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39361 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] + An unhandled exception has occurred while executing the request. + Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. + ---> Npgsql.PostgresException (0x80004005): P0001: test write failure + at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) + at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) + at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + Exception data: + Severity: ERROR + SqlState: P0001 + MessageText: test write failure + Where: PL/pgSQL function fail_profile_test() line 3 at RAISE + File: pl_exec.c + Line: 3909 + Routine: exec_stmt_raise + --- End of inner exception stack trace --- + at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) + at HealthApp.Profile.ProfileFacade.CreateAsync(String trustedAccountId, CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/Modules/Profile/ProfileFacade.cs:line 23 + at HealthApp.Controllers.PatientController.Create(CreatePatientRequest r, CancellationToken ct) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Controllers/PatientController.cs:line 17 + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 53 + at HealthApp.Security.RequestBoundaryMiddleware.InvokeAsync(HttpContext ctx) in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Security/RequestBoundaryMiddleware.cs:line 61 + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at HealthApp.Program.<>c__DisplayClass0_0.<<Main>b__5>d.MoveNext() in /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp/Program.cs:line 68 + --- End of stack trace from previous location --- + at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38747 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42565 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9VQKEU9QS:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43727 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Trend failed with 503; correlation 0HNP9VQKEU9QU:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Update failed with 504; correlation 0HNP9VQKEU9QR:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:46537 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40353 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Record failed with 503; correlation 0HNP9VQKEU9R0:00000001 +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35223 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42595 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Create failed with 503; correlation 0HNP9VQKEU9R2:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40325 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37907 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36433 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45759 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43125 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41263 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:44517 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45819 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Insight failed with 503; correlation 0HNP9VQKEU9R9:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41449 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42013 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34611 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40293 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9VQKEU9RC:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38723 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39157 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:45629 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41747 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34219 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:34701 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36615 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43013 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37821 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:36693 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:43829 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:38387 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] + No XML encryptor configured. Key {919e8bda-e8a5-49d7-a38a-181361ac29d5} may be persisted to storage in unencrypted form. +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39305 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:37487 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:40643 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:41683 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:42033 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:39439 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +warn: HealthApp.Security.RequestBoundaryMiddleware[0] + Operation Get failed with 503; correlation 0HNP9VQKEU9RT:00000001 +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:35861 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +info: Microsoft.Hosting.Lifetime[14] + Now listening on: http://127.0.0.1:33371 +info: Microsoft.Hosting.Lifetime[0] + Application started. Press Ctrl+C to shut down. +info: Microsoft.Hosting.Lifetime[0] + Hosting environment: Development +info: Microsoft.Hosting.Lifetime[0] + Content root path: /home/steffen/Nextcloud/Documents/Master Thesis/HealthAppRepositoryB/src/HealthApp +info: Microsoft.Hosting.Lifetime[0] + Application is shutting down... +[xUnit.net 00:00:04.86] Finished: HealthApp.AcceptanceTests + + + + \ No newline at end of file diff --git a/ImplementationPlan/evidence/final-verification.json b/ImplementationPlan/evidence/final-verification.json new file mode 100644 index 0000000..1f9cec2 --- /dev/null +++ b/ImplementationPlan/evidence/final-verification.json @@ -0,0 +1,250 @@ +{ + "date": "2026-10-14", + "sourceRevision": "2117236366130775214d9fd2611984d4348f2b79", + "targetRevision": "3426236c6cfcece36e94642ae84d1843288f86d5", + "approvalRevision": "20ab461c0194b3098504eabc96e9852a61356953", + "implementedCodeRevision": "recorded after code checkpoint commit", + "baselineTests": { + "passed": 299, + "failed": 0, + "skipped": 0 + }, + "finalBuild": { + "configuration": "Release", + "warnings": 0, + "errors": 0 + }, + "finalTests": [ + { + "file": "ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02.trx", + "counters": { + "total": "7", + "executed": "7", + "passed": "7", + "failed": "0", + "error": "0", + "timeout": "0", + "aborted": "0", + "inconclusive": "0", + "passedButRunAborted": "0", + "notRunnable": "0", + "notExecuted": "0", + "disconnected": "0", + "warning": "0", + "completed": "0", + "inProgress": "0", + "pending": "0" + } + }, + { + "file": "ImplementationPlan/evidence/b-trx/_Sil3ntDragon_2026-10-14_16_23_02[1].trx", + "counters": { + "total": "276", + "executed": "276", + "passed": "276", + "failed": "0", + "error": "0", + "timeout": "0", + "aborted": "0", + "inconclusive": "0", + "passedButRunAborted": "0", + "notRunnable": "0", + "notExecuted": "0", + "disconnected": "0", + "warning": "0", + "completed": "0", + "inProgress": "0", + "pending": "0" + } + } + ], + "finalTotalPassed": 283, + "acceptanceEntries": { + "mapped": 146, + "functionalVerified": 140, + "clinicalPartiallyVerified": 6 + }, + "nativeLocal": { + "environment": "PRETTY_NAME=\"Debian GNU/Linux 12 (bookworm)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"12\"\nVERSION=\"12 (bookworm)\"\nVERSION_CODENAME=bookworm\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "runtime": "Microsoft.AspNetCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]\nMicrosoft.NETCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]\n", + "applicationPID": "3282", + "databaseStatus": "/var/run/postgresql:5432 - accepting connections", + "result": "passed", + "overwriteRejected": true, + "runtimeConfigMode": "640 root healthapp-b", + "isolation": "Disposable privileged systemd Linux container; native installer/unit/services executed; not physical-host or measurement evidence" + }, + "nativeRemote": { + "environment": "PRETTY_NAME=\"Debian GNU/Linux 12 (bookworm)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"12\"\nVERSION=\"12 (bookworm)\"\nVERSION_CODENAME=bookworm\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "runtime": "Microsoft.AspNetCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]\nMicrosoft.NETCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]\n", + "database": "PostgreSQL 18.6 separate container/host namespace; TLS certificate SAN b-database", + "sslMode": "VerifyFull", + "wrongHostnameRejected": true, + "localPostgresInstalled": false, + "result": "passed", + "runtimeConfigMode": "640 root healthapp-b", + "isolation": "Separate disposable systemd app and TLS DB containers; no Architecture A database access; not measurement-host evidence" + }, + "preservation": { + "inputHashesMatch": true, + "instructionHashesMatch": true, + "referenceFilesMatch": 142, + "originalWorkingTreeClean": true, + "architectureADataAccessed": false + }, + "sourceFileSha256": { + "src/HealthApp/Controllers/AuthenticationController.cs": "2f1c58f0c91dd9b3600f8ff6b38f029b55963a0fe8b8cb10aee590afbfe7d191", + "src/HealthApp/Controllers/HealthOverviewController.cs": "f57c824acf2d40ebea350d4f841cbb20fa423fb4b94a73e5faf688f8e84c4a40", + "src/HealthApp/Controllers/InsightsController.cs": "2938aefa87b21c2bb49ab98420654e2452149339154c5df439b000b5706f0fdb", + "src/HealthApp/Controllers/MeasurementGuidanceController.cs": "05cb4eab5b1c5f6fccd3fbc9a3012a7c359a7c2f8912d745a2afed0c21f00923", + "src/HealthApp/Controllers/ObservationController.cs": "f473c8ea4a83f70ee9acde12335ab6ede1ce5b81407959da2f9c5be349242cc6", + "src/HealthApp/Controllers/PatientController.cs": "c411429e4a4f0ccd915ab3c464f3e969f635f165d2ee6ec9941cfa9dda1e31f4", + "src/HealthApp/Controllers/ProfessionalController.cs": "2b73ec65320436d5b898b13a462fe24eb6adb1e25b3233b294aa748b03155fad", + "src/HealthApp/HealthApp.csproj": "4ecc63649e1732047ad6231cc9e9bf60ba7612093bf54b62019aa01ffd7158df", + "src/HealthApp/Program.cs": "4ca7c9432644e8e13db2a64c4de930bc919421dab86c16c4000d3fa606e20d45", + "src/HealthApp/Security/AccessPolicy.cs": "f9572d457ce960ac958cc14f912d947ce6f182fbcf679a03e822164cf9215e22", + "src/HealthApp/Security/ProfessionalAssignments.cs": "4afa06b7498e0e9c8028c7858cddca0b29caed6b60b7aea3db4e50ee911efa53", + "src/HealthApp/Security/PrototypeAccounts.cs": "ebeb71b3955db41e05389cdad20a6dfda2ac394ab5d1d77164987e7a71028622", + "src/HealthApp/Security/RequestBoundaryMiddleware.cs": "21ad8bab3d282dae34ca466a2efad25d88a89a4425c12eb9b0a72009e09fee7c", + "src/HealthApp.Contracts/AnalyticsFacades.cs": "c18e5b06eed9433f68dc4b05d84542d08001385e56e24745424f3a463c48f483", + "src/HealthApp.Contracts/AuthorizedPatientContext.cs": "76730b1f40f2a47d4354f9882f6e07bd05b0fa293af375db1763b308d7de8010", + "src/HealthApp.Contracts/ClinicalRuleProvenance.cs": "788de4b769cd03288c03c693f1870c377974b1a1c64f6cfd047e88e8036404f5", + "src/HealthApp.Contracts/ContextSelection.cs": "6368c56eeb81a38c47e61fb75f4316d51d92f3796779673413447267cf21f067", + "src/HealthApp.Contracts/CreatePatientRequest.cs": "8189ef656a915e678ef5fbb6eb3d7270b086cbc66f04d893c6dba6b692cf4d43", + "src/HealthApp.Contracts/HealthApp.Contracts.csproj": "b7412db9b99568e8c78143b2ef1aca5af0b1686d98d2c7fd1ff8b7b2564b8a9d", + "src/HealthApp.Contracts/HealthInsight.cs": "131b66c4b8b80222b9b081dd5add45e1849000127151ca7feb15a7f1805a25c5", + "src/HealthApp.Contracts/HealthOverviewDto.cs": "0b8fab13249ab8588fe441ac010a10a9dac794de1135f6226ad9435b67622303", + "src/HealthApp.Contracts/MeasurementContext.cs": "02a6ba328661ffb271891808a353d9d87791dabd0f8e56eb9445f7420cb334b0", + "src/HealthApp.Contracts/MeasurementContextPatch.cs": "1aff952166ad851d6a538d35442242ba5e2b5e6bad215b9975624b0b46e03b5b", + "src/HealthApp.Contracts/ObservationDto.cs": "cf71b5ff3e7fef9cdcec0d76422c7ad1ab68f3d8821e82f2ccb902ded06b17e0", + "src/HealthApp.Contracts/ObservationFacades.cs": "2dac8fcc37f55556ccc9272275454e498755bbbdfb799dcfda60f640dc82ff25", + "src/HealthApp.Contracts/PatchObservationRequest.cs": "5f212133cbd6b4b8408bcc57255c6439d7b272c82768902b985c088f9a8344e1", + "src/HealthApp.Contracts/PatientDto.cs": "391a3cb88505aee002b001ff8bba534d508626d9038cd9600ae088bd2f62e178", + "src/HealthApp.Contracts/RecordObservationRequest.cs": "85008ac86b29ec4d7b24abff8b8f15adad4e3b24d6a92023789a969bc49ecc37", + "src/HealthApp.Contracts/TrendAssessment.cs": "5525c317690091ffd62292a64b5efaa269f3a53276353ab7e0d99374d782888f", + "src/HealthApp.Contracts/UpdateObservationRequest.cs": "f873acbc47ae7660aed06b83552a28ee4c38f805451cadfebf0d2b91de73bfbd", + "src/HealthApp.Contracts/UpdatePatientRequest.cs": "a6ac1c72ecac6290f22fd065a91c6adc795c4d6f1e33d6d27be41a0ff0cee713", + "src/HealthApp.Infrastructure/HealthApp.Infrastructure.csproj": "0928f24c1d6ba2a34c882e089de26f55f35858f7edf15afacf30a416afeb70da", + "src/HealthApp.Infrastructure/RequestTransaction.cs": "e6a85512c1bdfe7fc5381f954cbe8b6740501207e6ad24ba705db766faca7994", + "src/Modules/Analytics/Analytics.csproj": "6b98f81ea2730f93d778d9e544faf85a4219dc596cb30caaa13253acb9217d5e", + "src/Modules/Analytics/AnalyticsFacade.cs": "45f75df083cf0bbf9d75d45b297a8ff218a0de71c6e78def833b658ba4f67e57", + "src/Modules/Analytics/AssemblyInfo.cs": "ebce47e2dbe8b618bf608f974211697db2f9ed4cdb74d2fefaeb9342f19d2978", + "src/Modules/Analytics/ClinicalPolicy.cs": "0579e379d9a314edfdab4bdeac6ebe230401046f835100052d9c574fda3cf040", + "src/Modules/Analytics/SummaryPolicy.cs": "b6720517c4487022bb90ea35ac3c5c393e6925812722e06ab1d2af58d0fc2562", + "src/Modules/Analytics/TrendPolicy.cs": "b38fffa1e9410c961d9f033f499f957ec35b8c873aad693b0e4a93991ba39e5f", + "src/Modules/Guidance/Guidance.csproj": "861ea2e0a59fcdb91ca297e2743c569b8154898a3f21fda9c764debc63fcfa41", + "src/Modules/Guidance/GuidanceQueries.cs": "de16f581d9924a7aaf39761158dfde7ccc95070eeb3861ebcc63d0c952a8bb17", + "src/Modules/Guidance/ReviewedReferenceCatalog.cs": "d8527b459c7ad0f3856afb91cb25587299927c8e4bdcbcb0b14679a0d93794e9", + "src/Modules/Observations/AssemblyInfo.cs": "ebce47e2dbe8b618bf608f974211697db2f9ed4cdb74d2fefaeb9342f19d2978", + "src/Modules/Observations/Domain/BloodPressureObservation.cs": "5147ce1785f754359a6b23529ca02db40266768ae1c4d4ba86fd47dde0fea8da", + "src/Modules/Observations/Migrations/001-observations.sql": "f0b77fe9d3e374557cc2c1edca7dcfdb388a8fa9454dbe69e50a1e6ce4651817", + "src/Modules/Observations/ObservationFacade.cs": "3adfb1de8f9ba8d0b8bc562cf9b766f1ef270039a341f9e7cafc3208f1edeb85", + "src/Modules/Observations/Observations.csproj": "6b98f81ea2730f93d778d9e544faf85a4219dc596cb30caaa13253acb9217d5e", + "src/Modules/Observations/Persistence/ObservationDbContext.cs": "a3d01ed387b343767121c2a8b911fe2dbfd4da5ad1cde0692b585c901fc81155", + "src/Modules/Overview/Overview.csproj": "861ea2e0a59fcdb91ca297e2743c569b8154898a3f21fda9c764debc63fcfa41", + "src/Modules/Overview/OverviewFacade.cs": "69925884c4d8e487408b446496e3e243032e51e27704981ea89ac821731bcbb2", + "src/Modules/Profile/AssemblyInfo.cs": "ebce47e2dbe8b618bf608f974211697db2f9ed4cdb74d2fefaeb9342f19d2978", + "src/Modules/Profile/Domain/Patient.cs": "0aceabc7e269ff3f00a617987790cd71ae5ac7716751fc6a82224fe1ddef737d", + "src/Modules/Profile/Migrations/001-profile.sql": "fc2cac4c965d2a1e28f3a837bbce78b889ac65d56468e52524cb14b672662660", + "src/Modules/Profile/Persistence/PatientDbContext.cs": "5919d5faa0f223650d4ec16a6c3c5a54458cfdf70e2b4a7efa2d6cc21c76a690", + "src/Modules/Profile/Profile.csproj": "6b98f81ea2730f93d778d9e544faf85a4219dc596cb30caaa13253acb9217d5e", + "src/Modules/Profile/ProfileFacade.cs": "c3d46a921f1861abbc77f60cef1f34cda7e82fe83ef64ff8c628859ebe5330c3", + "src/TRENDS.md": "7b987403073ad4d4894287c7cac7fc542d6251e7241445d559e9c24ec27cf809", + "deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj": "23ee60031a40d85fdfd7d9af08b316012daf399f9f5788c7bd6a9078c12a32bc", + "deploy/HealthApp.Provisioning/Installation.cs": "14e0f6fc539f1796cde395cdca112d36062810e54e638e20681f4eaaf3f76a34", + "deploy/HealthApp.Provisioning/Program.cs": "1f7c6493b4916d3887a1b6f59625685c5e6904def311a0a98c3112791d3b40a9", + "deploy/INSTALLATION.md": "43e381629f4591c49853da91e8c43454b9068836c637a9c2652022b3d4c71391", + "deploy/appsettings.example.json": "63352e440f873cbe2414f459eaed39ede2f6343ef694643671a660993af5c815", + "deploy/build-release.sh": "62ce01b4cf1dbf97db2346a24617e219f7c2803afb2e3ce6a03509acfab1b117", + "deploy/installer/bootstrap.sh": "ff77323066e0e08bb1aeb059da69a8da1aa9414d5eeb93db37fd3f195c8656a1", + "deploy/installer/install.sh": "d1ecf7f7aba14744422891ebd622a0bd6462e8f067851ee599e5ac824d0b56df", + "deploy/systemd/healthapp-b.service": "41dcdfa953d35710367fe84c3c43cba2bf72ced681c989eede9de12fe4b18adc", + "tests/HealthApp.AcceptanceTests/AuthenticationIntegrationTests.cs": "e7af7779d24981f86d82c1fb7fa2bc3c9cc78d0c36a48cb9e67e3f691d1bbe44", + "tests/HealthApp.AcceptanceTests/ConformanceTests.cs": "3823f83f25e1cca1f06c27485e166504fe443c1feb17b0655a5b7cbf65c5f699", + "tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs": "3eadcb8473e0cd1f0df6a367dc490798ac551bb2ffa4af82b53c9981624c8db9", + "tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs": "ff67d93991202661155b1676ee19b3258cd15c510aaddd940f81ee2e3c8a9229", + "tests/HealthApp.AcceptanceTests/CreatePatientTests.cs": "8fffa446a01959731289799fa1e14ffb25248915089ad1b3b9f25fb687fded52", + "tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs": "1c3bbfab934d41428001b6d1d181cf7f08c90eb99ebcc9933ba48c334299c0d7", + "tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs": "a3eaaf6bf14fe18e07f6e75fc0b414d906b37d1ba636e231d8218a58027b38fe", + "tests/HealthApp.AcceptanceTests/FoundationTests.cs": "71df3c6ef3bdc165a717d0e4cd0af024dfe4e55b5adb5eeda1fc41c24725d897", + "tests/HealthApp.AcceptanceTests/GlobalUsings.cs": "48b09638b804452944adcd5e70c9381670b6af24fdc681b7532624e6dfdc15b5", + "tests/HealthApp.AcceptanceTests/HealthApp.AcceptanceTests.csproj": "15c8581595bb7c477c528f7b2a6c7671491a11f526e260c78efbbe3eb5dbc20f", + "tests/HealthApp.AcceptanceTests/HealthInsightTests.cs": "aa1f3ec51f1072b6c165517b9510149666449c494ea8527b66fc95e047be7815", + "tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs": "df772f0d79b8ec7331b113d1d43b15e23e137dfa05c138bbbbe97f69d48e87b9", + "tests/HealthApp.AcceptanceTests/HealthTrendTests.cs": "cb9f62039ff099551e20ae75969a9eb5d7c4f96a9d702033e319c719ce982e09", + "tests/HealthApp.AcceptanceTests/LatestObservationTests.cs": "9d815836f94d74a85c6764d23a4f7ef7b840290af18be88918bd39ac01223c7e", + "tests/HealthApp.AcceptanceTests/MeasurementContextMigrationTests.cs": "d401a2c9ace967412cc55b3f482333e6d521739b59cf1f8efba8273a11209be9", + "tests/HealthApp.AcceptanceTests/MeasurementGuidanceTests.cs": "80e527e632891f63e54288ba1d420beec7f2cdff08e03f0558cb76f5687bd2b2", + "tests/HealthApp.AcceptanceTests/ObservationApiFixture.cs": "c61f837d0a930027bede1e67d4792d9e7d7e408466e18fab8a7b726175685ca4", + "tests/HealthApp.AcceptanceTests/ObservationConcurrencyTests.cs": "09d516babae8ef2685babb1a5f16019d033ac1dcdfebc7c12f4d6201bc622f62", + "tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs": "73e11a578e9a9e34489cdf38840692e239c5013e0903f14852524236828e3d70", + "tests/HealthApp.AcceptanceTests/OperationalTests.cs": "799e0c1c1b18d51efac2e6ff16c0ee68b10594dfeb1dd5376e4f1481d481aff7", + "tests/HealthApp.AcceptanceTests/PatchObservationTests.cs": "a4096b2d3c5046b948e96dc79e40c302c46c8e64704e2f77069fb8ea984e6d48", + "tests/HealthApp.AcceptanceTests/PatientApiFixture.cs": "665d2b1955dd3c03a5d11330bd9dafae3942cfde1f4e9d413c5dbd4b970b3e2d", + "tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs": "b6130edc59e800312b9a8e4a2f3b084c36fe4230b36a9e8ee9159791c1ecdf30", + "tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs": "9fbeff0cc2a02cbb2587f9f9bec08dc6e623b3d59a833f8be7d5e7823807d743", + "tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs": "3f00b214300a44930ba5707b52cdd7f2f335b155cf131ccb65ef2b4baa4ad647", + "tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs": "bde451e9aee2a9097f0bd41622f967e2b8fccc3db5809c29d261995114931165", + "tests/HealthApp.AcceptanceTests/RecordObservationTests.cs": "1cd5f551712a4f592dadbe2cbf772c9f1fdb7953d938971771af74c0760be90f", + "tests/HealthApp.AcceptanceTests/SnapshotTests.cs": "287e96f3ec808dbc9831a17243660fd611251521939a2f1f42d46f076810db1c", + "tests/HealthApp.AcceptanceTests/Support/AuthenticatedTestClient.cs": "be81a81d5264ac8b06ec4ccf66b8d9653c3249c0f5db2abd894e035c6a0d4c97", + "tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs": "7ff2a356e9ac385237a9043d56659ba3ae819c6710e1aaa4f5945a243ac1a736", + "tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs": "a5f3765146a0a28fbb26ee08caceec7722358dec01659399736b227653fdab10", + "tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs": "e356b4b34c078edf3902cb38796ac4ac6597eca026a423b16e7e754bfaf5e104", + "tests/HealthApp.DeploymentTests/HealthApp.DeploymentTests.csproj": "4f5ff1a801773f09dc10a37e1a4ef55096ec2a5c3823976a08643bf5a7ed5330", + "tests/HealthApp.DeploymentTests/ProvisioningTests.cs": "ebc5d2247693863f05122bb15255d82bdcc56267cd4573b6c0c5cc766831eef8", + "tools/comparison/dataset.json": "240b2d19292dcc6178a94e7c60bb4e0a6f3df9441abf147ea10308b19fcf5686", + "tools/comparison/initialize.py": "b45ba8defb1cf1ddeb290b34c123fbf30a37db8b2180c9b0f7877ca99c76faf4", + "tools/native-install-test/Dockerfile": "1420907951a8b74dca7fb55483d9f9a554d84e203f6f7f3c565580e0e4aba952", + "tools/native-install-test/README.md": "7e3f15bfb3873924818f6e503aca2be3eea68e2230c15fb55ac3ae655840a080", + "tools/native-install-test/local.py": "326ba644a9867226f7111fce7ea07475a8871a74fe96bb67a89b1f74f72f3cf1", + "tools/native-install-test/remote.py": "d56114b60eb4f62558ee82f65c49246240861631de0f8cedce714db7726e24f1", + "tools/run-disposable-tests.py": "7b43367af34772e1bd2c8ea6d86bf434822547d7e5e7af591d7465072165fe51" + }, + "publishedBundleSha256": { + "INSTALLATION.md": "43e381629f4591c49853da91e8c43454b9068836c637a9c2652022b3d4c71391", + "app/Analytics.dll": "9ba3dcc112fecf1ff8a87d4aa0e48d9815811f8d5fa562119743fa96c4b1c144", + "app/Analytics.pdb": "9ae30993b4df39772fc069dc6347d7b4ab06e7e4e7bdb4ce7473976bd4828986", + "app/Guidance.dll": "adbe0085ee522d9aaf3a507c3151a4dfdd567818489884f4cb206afdf63b8cca", + "app/Guidance.pdb": "15f79f862123d686c0df0ef836a3ddd02de8bbbff30f5f47f810bca98a959949", + "app/HealthApp": "dc854c961a474ae8e6d00a2953f23952c34359b0ec2a3b1b7cebc833b29df1f0", + "app/HealthApp.Contracts.dll": "c653b5650c4b5785a8c0d4bfeefd7964f0e7543d0d0fbbb737e16757455159ea", + "app/HealthApp.Contracts.pdb": "09a4ae52a7c220e653c010c57bed4fbbb749f9d1ee56fd6c9df40c8ea24ad5b2", + "app/HealthApp.Infrastructure.dll": "df72ab62d595aef3ef28fbe0a65810980ce10ed26b4e731e66a98ab4ff63c918", + "app/HealthApp.Infrastructure.pdb": "782286cb66b8650e64c1f2674636df5858038eb95ae866d8e716436e53e69a16", + "app/HealthApp.deps.json": "4374d4c98e7f7676910f95268c2092c45af2759fcb68063f00c3f618c33aa97d", + "app/HealthApp.dll": "a81dab8f6ab9e692af7bd1773604672da5cad93f817e65e76c29901efc0239a8", + "app/HealthApp.pdb": "0182041f06a453e72fdf8dfad475606a0acd5b54b7041985981363ed22ddab07", + "app/HealthApp.runtimeconfig.json": "eff38a9750f7cca2407b1d639a963d56ffea92088e6da971bbbfa74e3dcd7224", + "app/HealthApp.staticwebassets.endpoints.json": "c1686417e8d5c31bba969f12b6f3d2b35e6609adb5ca42f212261a3a02771aac", + "app/Microsoft.EntityFrameworkCore.Abstractions.dll": "74bc17c936d66ea090b6a5b4cc4307d2154c9692e57edd4c55d68dd4a99c11b6", + "app/Microsoft.EntityFrameworkCore.Relational.dll": "a1e4f36208650b15b75a4b01a5821d61d5be417ac2e86ec3c65e2560a87e0d7d", + "app/Microsoft.EntityFrameworkCore.dll": "f5b1703d608e241314952b2ede8dcdd1b8d8adda8c91a13cb7e6b1007414cef4", + "app/Npgsql.EntityFrameworkCore.PostgreSQL.dll": "94fcf66e8e953fdb02c40c72ca89821dd5eed5324d4c0f12a7219ea8cd3d5a5e", + "app/Npgsql.dll": "e2bcafe1660fe4543fe9dfcabed972ec8d32259e5ea8009462ce1de23c7034c2", + "app/Observations.dll": "66fb464bbb8a881aad7305a5d0f386e6a033de58c2e53bc32cce3634f279d62b", + "app/Observations.pdb": "2a43670ee91c8f441d5cd08e53a687bfad648f6f78bec6e51df2babaac274f83", + "app/Overview.dll": "a4cad3efd6a06234869b315c3dbe18000b286318b602f50f573c710a2a2250a1", + "app/Overview.pdb": "74480ee95fdc9e7196097f88392f1d4f0338523483fd1bb3acd04c4a14445764", + "app/Profile.dll": "420c55582b28ba3e9af272db40901844c8022beccf66fa7fc64ea527918c8d7d", + "app/Profile.pdb": "b1db8ff0bab13b4ed7dcfca3867604f8eb42bd9981934b85766271abbf05ea24", + "app/web.config": "aab3b9908e70dcec7c084d99e2a03759183731a781f17f7c8d0971ea1fa27f76", + "bootstrap.sh": "ff77323066e0e08bb1aeb059da69a8da1aa9414d5eeb93db37fd3f195c8656a1", + "healthapp-b.service": "41dcdfa953d35710367fe84c3c43cba2bf72ced681c989eede9de12fe4b18adc", + "install.sh": "d1ecf7f7aba14744422891ebd622a0bd6462e8f067851ee599e5ac824d0b56df", + "migrations/Observations/001-observations.sql": "f0b77fe9d3e374557cc2c1edca7dcfdb388a8fa9454dbe69e50a1e6ce4651817", + "migrations/Profile/001-profile.sql": "fc2cac4c965d2a1e28f3a837bbce78b889ac65d56468e52524cb14b672662660", + "provisioner/HealthApp.Provisioning": "b14ae66e100af269d58de56f715576969f47b1bc800162f10b8be7ee60f9cdfe", + "provisioner/HealthApp.Provisioning.deps.json": "a9d67943244c2cfb7c597e2f9c9ad403d3950c12ecd80194d501af2382b25479", + "provisioner/HealthApp.Provisioning.dll": "bb45d13e9264b859605c72d354b2da87655f73ed032b0bd42442d059a4757700", + "provisioner/HealthApp.Provisioning.pdb": "cb0170760d28f2332e37ac72cb91fdef70f32566354a1f43904d7b60f9e5ed81", + "provisioner/HealthApp.Provisioning.runtimeconfig.json": "f8bd1713a3691d58eb332a71675f129385b91e852b66e7b6761cae1f34d4efd2", + "provisioner/Npgsql.dll": "e2bcafe1660fe4543fe9dfcabed972ec8d32259e5ea8009462ce1de23c7034c2" + }, + "limits": [ + "Other intended distributions not natively verified", + "Independent clinical validity not established; outputs preserved under Q3", + "Native Linux environments isolated/containerized, not measurement-host evidence", + "No A import or energy measurement" + ] +} diff --git a/ImplementationPlan/evidence/native-debian12-remote-summary.json b/ImplementationPlan/evidence/native-debian12-remote-summary.json new file mode 100644 index 0000000..995ae5a --- /dev/null +++ b/ImplementationPlan/evidence/native-debian12-remote-summary.json @@ -0,0 +1,11 @@ +{ + "environment": "PRETTY_NAME=\"Debian GNU/Linux 12 (bookworm)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"12\"\nVERSION=\"12 (bookworm)\"\nVERSION_CODENAME=bookworm\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "runtime": "Microsoft.AspNetCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]\nMicrosoft.NETCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]\n", + "database": "PostgreSQL 18.6 separate container/host namespace; TLS certificate SAN b-database", + "sslMode": "VerifyFull", + "wrongHostnameRejected": true, + "localPostgresInstalled": false, + "result": "passed", + "runtimeConfigMode": "640 root healthapp-b", + "isolation": "Separate disposable systemd app and TLS DB containers; no Architecture A database access; not measurement-host evidence" +} diff --git a/ImplementationPlan/evidence/native-debian12-summary.json b/ImplementationPlan/evidence/native-debian12-summary.json new file mode 100644 index 0000000..4ba78d0 --- /dev/null +++ b/ImplementationPlan/evidence/native-debian12-summary.json @@ -0,0 +1,10 @@ +{ + "environment": "PRETTY_NAME=\"Debian GNU/Linux 12 (bookworm)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"12\"\nVERSION=\"12 (bookworm)\"\nVERSION_CODENAME=bookworm\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "runtime": "Microsoft.AspNetCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]\nMicrosoft.NETCore.App 10.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]\n", + "applicationPID": "3282", + "databaseStatus": "/var/run/postgresql:5432 - accepting connections", + "result": "passed", + "overwriteRejected": true, + "runtimeConfigMode": "640 root healthapp-b", + "isolation": "Disposable privileged systemd Linux container; native installer/unit/services executed; not physical-host or measurement evidence" +} diff --git a/ImplementationPlan/functional-equivalence.md b/ImplementationPlan/functional-equivalence.md index e5bd860..4f02f01 100644 --- a/ImplementationPlan/functional-equivalence.md +++ b/ImplementationPlan/functional-equivalence.md @@ -1,6 +1,6 @@ # Functional preservation and verification plan -Prepared 2026-10-14. **Architecture A baseline: 299 automated cases passed in the B-local reference. Architecture B behaviour remains not verified until its adapted tests run.** This establishes reference evidence, not clinical validation. This register is a preservation plan. [Acceptance register](acceptance-register.md) carries all 146 common/US-01–US-15 criterion IDs/outcomes from the target traceability table; outline cases are retained. During implementation map each entry to exact executable test methods, expanded examples and results. +Prepared 2026-10-14. **Architecture A baseline: 299 automated cases passed. Architecture B final solution: 283 cases passed, no failures/skips, plus actual native local/remote installation evidence.** This establishes reference evidence, not clinical validation. This register records the implemented preservation and its verification limits. [Acceptance register](acceptance-register.md) carries all 146 common/US-01–US-15 criterion IDs/outcomes from the target traceability table; outline cases are retained. Each entry now links concrete executed methods; theory expansions are recorded in TRX. | Requirement | Original suites / evidence | Preserve and verify | | --- | --- | --- | @@ -39,3 +39,9 @@ Run isolated baseline reference tests first after SDK/DB provisioning, then affe Clinical reference/content review is separate from numerical/API tests; a passing string assertion does not prove clinical support. Existing sources/review dates are provenance, not a new review performed here. Finite conflict detection does not prove arbitrary text comprehension. Seek approval before necessary clinical classification changes. No source behavioural mismatch is silently accepted over authoritative requirements. Final outcome classifications: **verified** (executed supporting checks and criterion assertions), **partially verified** (some evidence but explicit gaps, such as native/clinical review), **not verified** (unexecuted/no adequate evidence). No current test-pass, deployment-pass, strict-equivalence or energy-efficiency claim. + +## Final outcomes + +Release build/publish passed without warnings/errors. Functional/conformance suite: 276 passed; provisioning/adapter suite: 7 passed. Original source assertions remain, with architecture-dependent fixture/status replacements precisely recorded in test-adaptations.md. Both native Debian 12 local and verified-TLS remote placements passed representative workflows and independent app restart. Final command/artifact/hash evidence is in evidence/final-verification.json. + +All 146 common/US-01–US-15 entries have concrete method mappings: 140 verified functional entries and 6 partially verified entries whose deterministic outputs/provenance pass but independent clinical support is not established. This distinction implements Q3; no clinical classification was silently disabled or changed. General narrative understanding, universal platform support, production/clinical certification, live historical import and strict byte-for-byte response equivalence are not claimed. Revised US-16 is verified at its approved app/database granularity on the identified native environment. diff --git a/ImplementationPlan/implementation-log.md b/ImplementationPlan/implementation-log.md index 38b13d9..5b2ba74 100644 --- a/ImplementationPlan/implementation-log.md +++ b/ImplementationPlan/implementation-log.md @@ -47,3 +47,13 @@ Overview composes typed Profile, Observation and Analytics queries; profile/late ### Stage 6 checkpoint — passed Bounded pooled DB source, configurable health/assessment admission and deadlines, cancellation/rollback, release-before-result filter, sanitized dependency errors/no-store, authenticated liveness/readiness and fail-closed remote VerifyFull requirement. Deterministic locked-write deadline leaves profile unchanged; exhausted assessment budget returns 503+Retry-After while public guidance works; DB outage readiness is 503 while guidance/login remain usable. Restored original replacement-handler same-normalized-identity own/other assertions using real B profiles rather than obsolete HTTP stub. Fresh-schema context-default test retains all original value/text/Unknown assertions, with explicit synthetic associated patient for FK and no live migration. Module conformance checks pass. 276/276 tests passed; zero warnings/errors. Stage 5 commit `cc7f871`. Native deployment verification remains pending. + +### Stage 7 — portable installer checkpoint + +Independent release app/provisioner/schema scripts and native systemd unit. APT/DNF/pacman adapters, local/remote persistence separation, generated protected accounts/certificates/config/keys, separate NOLOGIN migration owners and DML runtime role, explicit native lifecycle verification and no-overwrite. Tested actual Debian 12 systemd local and separate verified-TLS PostgreSQL deployment, wrong-host rejection and absence of local PostgreSQL in remote mode. Runtime 10.0.13, local PG 15.19 / remote PG 18.6; test container environments are not measurement/physical-host evidence. 283 solution tests pass (276 functional/conformance; 7 provisioning/adapter), zero warnings/errors. Final audit strengthens database constraints, records ticket issue instant, scoped local SCRAM authentication and source/content provenance; final verification follows. Stage 6 commit `f451b55`. + +### Stage 8 — concluding verification + +Final Release build: zero warnings/errors; final solution suites: 283 passed, 0 failed/skipped. Independent final release published to `/tmp/healthapp-b-final-release`. Both actual native Debian 12 local/remote installations passed with final scoped SCRAM provisioning, protected runtime config mode `640 root healthapp-b`, app/DB independent stop/restart, no-overwrite rejection, VerifyFull/wrong hostname rejection and no local PostgreSQL in remote mode. Native evidence summaries and reproducible test harnesses retained. + +All 146 acceptance entries link concrete executable methods; clinical support is explicitly partial for six entries while deterministic output/provenance assertions pass. No unapproved architecture, numerical or clinical-output deviation. No A data access/import. Read-only input/instruction SHA-256 checks passed, all 142 pinned reference files equal original source, original Git HEAD/status unchanged. Formatting applied only to newly implemented B projects; originals preserved. Added exact single-observation extrema assertions, without relaxing originals. Final package/source/test evidence recorded in final-verification.json; source code revision recorded after commit. diff --git a/ImplementationPlan/implementation-plan.md b/ImplementationPlan/implementation-plan.md index 747576b..b513627 100644 --- a/ImplementationPlan/implementation-plan.md +++ b/ImplementationPlan/implementation-plan.md @@ -37,7 +37,7 @@ The original solution has five `net10.0` ASP.NET Core applications, a transient | Context | EF owned value already flattened into observation row | Reuse fields, unknown/null/omission semantics; no separate context entity or inference | | Writes | EF patch loads/saves row without explicit row locking; deletes by observation ID | Transaction with actual-owner recheck and row lock; validate proposed changes atomically; preserve concurrent disjoint patches | | Reads | Independently timed ownership and source reads; overview sequential HTTP composition | Shared repeatable-read snapshot from ownership lookup through capture; release before calculation and transmission | -| Ordering/time | Latest measurement/creation/UUID; history measurement/UUID; UTC clock encoding in timestamp without timezone | Preserve UTC encoding/wire behaviour; verify PostgreSQL unsigned UUID-byte ordering explicitly, rather than substitute .NET Guid ordering | +| Ordering/time | Latest measurement/creation/UUID; history measurement/UUID; UTC clock encoding in timestamp without timezone | Preserve UTC encoding/wire behaviour; verify PostgreSQL unsigned UUID-byte ordering explicitly, rather than sort raw platform-endian GUID bytes | | Analytics | Fresh summaries/trends; compiled combined numerical/context/clinical implementation | Reuse numerical formulas; separate SummaryPolicy, TrendPolicy, ClinicalPolicy and reference catalog; no result store/cache | | Guidance | Static home guidance in gateway controller; clinic/other explained unavailable | Move existing content to versioned Guidance-owned bundle/catalog; preserve applicability and public availability during DB outages | | Resources/failures | No shared bounded request policy; upstream HTTP failures 502/504 | Shared bounded pool, configurable admission/deadline/cancellation; 503 dependency/overload, 504 deadline, 500 unexpected failure | @@ -89,7 +89,7 @@ Clinical catalog extraction must preserve existing source URLs/review metadata a Fresh installation: one dedicated PostgreSQL database; `profile.patient` and `observations.observation` (physical name aligned with proposal). Preserve public identifiers and values regardless of table rename. Account association unique, non-null and immutable via module commands. Restricted patient FK; flattened context; positive numerical/category/rest checks and required timestamps. Profile owner creates only Profile objects; Observation owner creates only Observation objects, with the narrowly necessary REFERENCES grant. Runtime role has needed SELECT/INSERT/UPDATE and Observation DELETE, schema USAGE, no DDL/admin/role membership. Module migration histories stay owned separately. No generated insight/trend/overview tables. Runtime never invokes migrations. -Keep legacy UTC-clock timestamp encoding if needed for byte-compatible public timestamps; normalize all input instants consistently. Document UUID network-byte tie order and test IDs whose .NET Guid comparison order differs. Retain existing decimal means and optional rest-duration unit (minutes). +Keep legacy UTC-clock timestamp encoding if needed for byte-compatible public timestamps; normalize all input instants consistently. Document UUID network-byte tie order and test fixed UUIDs that distinguish network-byte ordering from little-endian byte-array sorting. Retain existing decimal means and optional rest-duration unit (minutes). Approved Q4 scope is independently provisioned fresh B databases and equivalent reproducible synthetic datasets, **no import or live migration required or authorized**. A future migration procedure remains documentation only. No source database access or source repository mutation is authorized. If import is required, add an offline administrative import step from administrator-provided snapshots, with separate approval of dataset and account mappings. Preflight missing/duplicate accounts, orphan observations, unsupported categories/non-positive values and timestamp interpretation; reject ambiguous input without silently discarding/reassigning data. Preserve IDs, account IDs, original/update/measurement instants, raw values, complete/partial/unknown context, text/notes and predefined assignments. Validate counts and fields against snapshots. Retain source snapshots and take backups; never run an automatic destructive conversion in place. @@ -138,3 +138,7 @@ Main risks: combined process/role blast radius; shared connection/EF transaction Mitigation is explicit ownership and transaction tests, unchanged functional assertion intent, import preflight/no live conversion, preserved formulas/content provenance, focused review before any changed classification, native verification and candid limits. No workload/HA/backup SLA is invented. No energy-efficiency benefit is claimed. Approval received: Q1 revised US-16/dependency errors; Q2 preserved instruction files; Q3 unchanged mathematics, thresholds and clinical outputs with uncertainty disclosure; Q4 fresh provisioning only; Q5 portable distribution-aware Linux installer and actual native verification. See [approval register](open-questions.md). Further approval is required only for material actions outside these boundaries. + +## Execution outcome — 2026-10-14 + +Approved stages 0–8 implemented and engineering verification completed. Baseline 299/299 tests; B 283/283 tests; Release build/publish clean; actual native Debian 12 systemd local/remote installation and independent restart passed. All 146 acceptance entries mapped to concrete executed methods; six retain explicitly partial independent clinical support under Q3. Other intended distributions have adapter tests but no native execution claim. No unapproved deviation, A database access/import, source/input/instruction mutation, or energy-efficiency claim. See final-verification.json and the conformance/equivalence registers for exact evidence and limits. diff --git a/ImplementationPlan/measurement-context.md b/ImplementationPlan/measurement-context.md new file mode 100644 index 0000000..e33b352 --- /dev/null +++ b/ImplementationPlan/measurement-context.md @@ -0,0 +1,14 @@ +# Verification environments versus measurement environment + +No energy measurements were performed. Test/deployment execution establishes engineering evidence only. + +| Run | Recorded environment | +| --- | --- | +| Architecture A pinned baseline | B-local reference, SDK 10.0.100 / runtime 10.0.0, fresh disposable PostgreSQL 18.6, Manjaro x86_64 host | +| Architecture B automated suites | Same SDK/runtime and disposable PostgreSQL 18.6; original story fixtures adapted to one application/schema topology | +| Local native B installation | Debian 12 bookworm userspace with actual systemd, shared Manjaro kernel 7.1.13-2-MANJARO, .NET/ASP.NET 10.0.13 installed from feed, PostgreSQL 15.19 installed locally; isolated privileged Linux test container, no host data mounts | +| Remote native B installation | Separate Debian 12 systemd app environment and PostgreSQL 18.6 instance, verified TLS/hostname, .NET/ASP.NET 10.0.13; local PostgreSQL absent; wrong hostname rejected | + +Native test environments are not physical-host or measurement-host evidence. A and B energy comparison must separately control hosting/kernel/runtime/database versions, equivalent data, workload/selection/account-role mix, assignments, HTTPS and token lifetime/login frequency, concurrency, active/idle periods and background processes. Runtime/DB differences above are disclosed and cannot be treated as a controlled energy comparison. + +`tools/comparison/dataset.json` provides equivalent deterministic logical profile/measurement/context inputs. `initialize.py` initializes only fresh independently provisioned comparison instances through verified HTTPS and records dataset hash/assigned IDs. It is not an importer, was not run against Architecture A, and refuses an existing output manifest. Generated UUIDs and original recording times differ; measurement instants are distinct so those differences do not determine latest/trend outcomes in this dataset. Complete timestamp-tie behaviour is tested separately with fixed IDs/times. Larger workloads and assignment fixtures require explicit reproducible experiment setup. Secrets/keys never enter manifests. diff --git a/ImplementationPlan/open-questions.md b/ImplementationPlan/open-questions.md index 6b661e4..5cf3e9c 100644 --- a/ImplementationPlan/open-questions.md +++ b/ImplementationPlan/open-questions.md @@ -10,4 +10,4 @@ Approved with conditions 2026-10-14. Authority: [full approval](../Docs/Approval | Q4 | Independently provision fresh B DB, schemas/roles/credentials/config automatically. No A database access, import or live migration. Equivalent reproducible logical datasets for comparisons | Approved | | Q5 | Portable systemd Linux installer with documented distribution-specific dependencies; local and verified-TLS/hostname remote PostgreSQL; no unnecessary local DB in remote mode. At least one actual identified native installation; intended versus verified support distinguished | Approved with modification | -No unresolved architectural decision currently blocks Stage 0. Execution prerequisites (SDK 10, isolated PostgreSQL and native systemd administrative environment) are being established. No universal Linux, clinical-validation, production-readiness or energy-saving claims are authorized. Further approval only for material architectural/functional/clinical deviations, algorithm replacements or live migrations. +No unresolved architectural decision currently blocks Stage 0. Execution prerequisites are established: SDK 10.0.100, fresh disposable PostgreSQL, and isolated Debian 12 native systemd local/remote verification environments. Other native distribution executions and independent clinical validity remain evidence limits, not unresolved architecture choices. No universal Linux, clinical-validation, production-readiness or energy-saving claims are authorized. Further approval only for material architectural/functional/clinical deviations, algorithm replacements or live migrations. diff --git a/README.md b/README.md index 144ea9b..dc8dd66 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,38 @@ -# HealthAppRepositoryB +# Health App Architecture B -## Project Purpose +Architecture B implements the approved modular monolith: one ASP.NET Core HTTPS application, typed Profile/Observations/Analytics/Overview/Guidance modules, and one PostgreSQL database with owned schemas. API/access enforces normalized patient/professional identity and actual resource ownership. Numerical calculations, clinical content and public REST/JSON semantics are preserved from the pinned Architecture A reference, with the approved US-16 and dependency-failure revisions. -HealthAppRepositoryB is part of a Master's thesis in IT investigating the use of Large Language Models (LLMs) for software architecture design and energy efficiency. +Approval and implementation evidence are in [ImplementationPlan](ImplementationPlan/implementation-plan.md); the authoritative target remains [ArchitectureProposal](ArchitectureProposal/software-architecture.md). [Approval decisions](Docs/ApprovalRequirements/architecture-b-implementation-approval.md) include portable Linux installation. Input requirements/diagrams and the original repository remain unchanged. No frontend, identity server, background worker, broker or clinical-result store was introduced. -The research question is: +## Build and test -> To what extent can Large Language Models be used to identify and suggest changes to an existing software architecture that result in measurable improvements in the energy efficiency of the implemented system? +Use the .NET 10 SDK selected by `global.json`: -## Project Objective +```bash +dotnet restore HealthApp.slnx +dotnet build HealthApp.slnx -c Release +TEST_POSTGRES_CONNECTION='Host=127.0.0.1;Database=postgres;Username=TEST_ADMIN;Password=YOUR_TEST_PASSWORD' \ + dotnet test HealthApp.slnx -c Release +``` -The purpose of this repository is to develop a software architecture for the Health App based on its documented functional requirements, domain concepts, and relevant constraints. +Optional automatic disposable-server harness: `HEALTHAPP_DOTNET=/path/to/dotnet python3 tools/run-disposable-tests.py` (requires administrative Docker access for test infrastructure only). -An LLM-based architecture agent is tasked with evaluating architectural alternatives and designing an architecture that satisfies the application's requirements while considering energy efficiency as an important design objective. +Use only a disposable test PostgreSQL server with create/drop database and role permissions. Fixtures create isolated databases and DML-only runtime roles, apply module schema scripts twice, exercise real Kestrel HTTP, and remove their own resources. Do not point tests at Architecture A or production databases. Framework/provider/EF/xUnit versions remain pinned; no algorithm replacement or technology migration is included. -The resulting architecture may resemble or differ from the original Health App architecture. Architectural decisions must be justified by their suitability rather than by novelty. +The unchanged executable source/test baseline lives under [Reference/ArchitectureA](Reference/README.md), copied from `2117236366130775214d9fd2611984d4348f2b79`. It is excluded from the final B solution and preserves original architecture-specific tests. Never build/test in `../HealthAppRepository/`. -## Research Context +## Deploy and run -This repository represents the architecture-design work associated with the thesis. +```bash +bash deploy/build-release.sh --output NEW_RELEASE_DIRECTORY +# In the new bundle on a supported systemd Linux host: +sudo bash install.sh --host YOUR_DNS_OR_IP +``` -The original Health App serves as the reference system. The proposed architecture will be evaluated for its feasibility and potential energy-related consequences, with the intention of supporting a later empirical comparison. +The installer supplies dependencies, fresh database/roles/schemas, protected secrets/configuration, generated or supplied HTTPS certificate, persistent token keys, migrations and `healthapp-b.service`. It verifies representative operations and application stop/restart without stopping PostgreSQL. Remote database mode requires verified TLS/hostname and installs no local PostgreSQL. See [installation guide](deploy/INSTALLATION.md). -Energy-efficiency benefits suggested during architecture design are hypotheses, not established measurements. +For an already provisioned B development database, supply external accounts/assignments, connection, key directory and HTTPS settings through `HEALTHAPP_CONFIGURATION_FILE=/absolute/protected/appsettings.json` or normal .NET configuration. [Configuration example](deploy/appsettings.example.json) is illustrative, not a prepared credential file. Production rejects plain HTTP. Use `dotnet run --project src/HealthApp -c Release`; the app never applies migrations itself. -## Repository Structure +[Trend methods](src/TRENDS.md) describe unchanged formulas, timestamp ties, full-period direction/variation and clinical limits. [Conformance](ImplementationPlan/architecture-conformance.md), [functional verification](ImplementationPlan/functional-equivalence.md) and [test adaptations](ImplementationPlan/test-adaptations.md) distinguish executed evidence from limitations. Native Debian 12 systemd local/remote installation was exercised in isolated Linux environments; other distribution adapters are intended support with explicit prerequisites. -- `AGENT.md` — Instructions and constraints for the architecture-design agent. -- `Docs/` — Functional requirements, domain information, existing design documentation, and relevant constraints. -- `ArchitectureProposal/` — Architecture specifications, editable Draw.io diagrams, architectural decisions, requirements traceability, and supporting documentation produced by the agent. - -## Scope - -The architecture-design work focuses on software architecture and system-level decisions, including component boundaries, communication, data management, persistence, deployment, and architectural patterns. - -Code-level optimization, algorithm replacement, and LLM training or inference energy consumption are outside the research scope. - -The architecture-design agent does not implement application code. Its responsibility is to produce a coherent, justified, and sufficiently detailed software architecture. - -## Research Status - -**Current phase:** Architecture design. - -The repository preserves the documentation and agent instructions used as input to the architectural design process. +This repository remains part of the thesis research. Installation/testing is not an energy experiment or clinical certification. [Measurement context](ImplementationPlan/measurement-context.md) records environment differences and equivalent reproducible synthetic dataset setup. Clinical classifications are preserved for comparison; uncertain provenance is documented without asserting new clinical validity. diff --git a/deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj b/deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj new file mode 100644 index 0000000..a423338 --- /dev/null +++ b/deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj @@ -0,0 +1 @@ +net10.0Exeenableenable diff --git a/deploy/HealthApp.Provisioning/Installation.cs b/deploy/HealthApp.Provisioning/Installation.cs new file mode 100644 index 0000000..af39ef4 --- /dev/null +++ b/deploy/HealthApp.Provisioning/Installation.cs @@ -0,0 +1,145 @@ +using System.Diagnostics; +using System.Net; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Net.Security; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Text.Json; +using System.Text.RegularExpressions; +using Microsoft.AspNetCore.Identity; +using Npgsql; +namespace HealthApp.Provisioning; + +public sealed record Account(string AccountId, string Role, string Password); +public sealed record InstallationPlan(string Database, string RuntimeRole, string RuntimePassword, string ProfileOwner, string ObservationOwner, string Host, int Port, string CertificatePassword, List Accounts, Dictionary Settings); +public static class Installation +{ + private static readonly JsonSerializerOptions Json = new() { WriteIndented = true, PropertyNameCaseInsensitive = true }; + private static string Secret() => Convert.ToHexString(RandomNumberGenerator.GetBytes(32)); + private static string PathAt(string root, string path) => Path.Combine(root, path); + private static void PrivateFile(string path, string text) { File.WriteAllText(path, text); if (OperatingSystem.IsLinux()) File.SetUnixFileMode(path, UnixFileMode.UserRead | UnixFileMode.UserWrite); } + private static InstallationPlan Load(string directory) => JsonSerializer.Deserialize(File.ReadAllText(Path.Combine(directory, "installation.json")), Json) ?? throw new InvalidOperationException(); + public static void Prepare(string directory, string host, int port, string root, string? certificate, string? passwordFile, string? caFile) + { + if (Directory.Exists(directory) || File.Exists(directory)) throw new InvalidOperationException("refuse overwrite"); + if (Uri.CheckHostName(host) == UriHostNameType.Unknown || host.Contains('%') || port is < 1024 or > 65535) throw new ArgumentException(); + var id = Guid.NewGuid().ToString("N")[..12]; var prefix = "healthapp_b_" + id; + var accounts = new List { new("prototype-patient", "Patient", Secret()), new("prototype-professional", "HealthcareProfessional", Secret()), new("installation-check", "Patient", Secret()) }; + var settings = new Dictionary { ["urls"] = "https://0.0.0.0:" + port, ["Authentication:KeyDirectory"] = PathAt(root, "var/lib/healthapp-b/keys"), ["Authentication:TokenLifetimeMinutes"] = "30", ["Kestrel:Certificates:Default:Path"] = PathAt(root, "etc/healthapp-b/application.pfx"), ["Resources:MaxPoolSize"] = "32", ["Resources:MaxConcurrentRequests"] = "32", ["Resources:MaxConcurrentAssessments"] = "4", ["Resources:RequestDeadlineSeconds"] = "30" }; + var plan = new InstallationPlan(prefix, prefix + "_runtime", Secret(), prefix + "_profile", prefix + "_observations", host, port, Secret(), accounts, settings); + settings["Kestrel:Certificates:Default:Password"] = plan.CertificatePassword; + for (var i = 0; i < accounts.Count; i++) + { var a = accounts[i]; settings[$"Authentication:Accounts:{i}:AccountId"] = a.AccountId; settings[$"Authentication:Accounts:{i}:Role"] = a.Role; settings[$"Authentication:Accounts:{i}:PasswordHash"] = new PasswordHasher().HashPassword(a, a.Password); } + Directory.CreateDirectory(directory); if (OperatingSystem.IsLinux()) File.SetUnixFileMode(directory, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); + if (certificate is not null) + { + if (passwordFile is null || caFile is null) throw new ArgumentException(); + using var supplied = X509CertificateLoader.LoadPkcs12FromFile(certificate, File.ReadAllText(passwordFile).Trim()); if (!supplied.HasPrivateKey) throw new InvalidOperationException(); + File.WriteAllBytes(Path.Combine(directory, "application.pfx"), supplied.Export(X509ContentType.Pfx, plan.CertificatePassword)); File.Copy(caFile, Path.Combine(directory, "healthapp-ca.crt")); + } + else + { + // Same framework certificate primitives and prototype trust model as pinned installer. + using var caKey = RSA.Create(3072); var caRequest = new CertificateRequest("CN=HealthApp B prototype " + id, caKey, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + caRequest.CertificateExtensions.Add(new X509BasicConstraintsExtension(true, false, 0, true)); caRequest.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.CrlSign, true)); caRequest.CertificateExtensions.Add(new X509SubjectKeyIdentifierExtension(caRequest.PublicKey, false)); + using var ca = caRequest.CreateSelfSigned(DateTimeOffset.UtcNow.AddMinutes(-5), DateTimeOffset.UtcNow.AddYears(2)); + using var key = RSA.Create(3072); var request = new CertificateRequest("CN=" + host, key, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + request.CertificateExtensions.Add(new X509BasicConstraintsExtension(false, false, 0, true)); request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.KeyEncipherment, true)); request.CertificateExtensions.Add(new X509EnhancedKeyUsageExtension(new OidCollection { new("1.3.6.1.5.5.7.3.1") }, true)); + var san = new SubjectAlternativeNameBuilder(); if (IPAddress.TryParse(host, out var ip)) san.AddIpAddress(ip); else san.AddDnsName(host); request.CertificateExtensions.Add(san.Build()); + using var leaf = request.Create(ca, DateTimeOffset.UtcNow.AddMinutes(-5), DateTimeOffset.UtcNow.AddYears(1), RandomNumberGenerator.GetBytes(16)); using var withKey = leaf.CopyWithPrivateKey(key); + File.WriteAllBytes(Path.Combine(directory, "application.pfx"), withKey.Export(X509ContentType.Pfx, plan.CertificatePassword)); File.WriteAllText(Path.Combine(directory, "healthapp-ca.crt"), ca.ExportCertificatePem()); + } + PrivateFile(Path.Combine(directory, "installation.json"), JsonSerializer.Serialize(plan, Json)); PrivateFile(Path.Combine(directory, "accounts.json"), JsonSerializer.Serialize(accounts, Json)); + if (OperatingSystem.IsLinux()) File.SetUnixFileMode(Path.Combine(directory, "application.pfx"), UnixFileMode.UserRead | UnixFileMode.UserWrite); + } + public static async Task DatabaseAsync(string directory, string migrations, string? adminFile) + { + var p = Load(directory); foreach (var identifier in new[] { p.Database, p.RuntimeRole, p.ProfileOwner, p.ObservationOwner }) if (!Regex.IsMatch(identifier, "^[a-z][a-z0-9_]{1,62}$")) throw new ArgumentException(); + if (!Regex.IsMatch(p.RuntimePassword, "^[A-F0-9]{64}$")) throw new ArgumentException(); + string? admin = adminFile is null ? null : File.ReadAllText(adminFile).Trim(); + if (admin is not null) + { + var remote = new NpgsqlConnectionStringBuilder(admin); if (remote.SslMode != SslMode.VerifyFull) throw new InvalidOperationException("Remote admin requires VerifyFull."); + var db = new NpgsqlConnectionStringBuilder(admin) { Database = p.Database, Username = p.RuntimeRole, Password = p.RuntimePassword, Pooling = true, IncludeErrorDetail = false }; + p.Settings["ConnectionStrings:HealthDatabase"] = db.ConnectionString; p.Settings["Database:Remote"] = "true"; + } + else p.Settings["ConnectionStrings:HealthDatabase"] = new NpgsqlConnectionStringBuilder { Host = "127.0.0.1", Database = p.Database, Username = p.RuntimeRole, Password = p.RuntimePassword, Pooling = true, SslMode = SslMode.Disable, IncludeErrorDetail = false }.ConnectionString; + async Task Sql(string sql, string? database = null) + { + if (admin is not null) + { + var options = new NpgsqlConnectionStringBuilder(admin) { Pooling = false, IncludeErrorDetail = false }; if (database is not null) options.Database = database; + await using var connection = new NpgsqlConnection(options.ConnectionString); await connection.OpenAsync(); await using var command = new NpgsqlCommand(sql, connection); return (await command.ExecuteScalarAsync())?.ToString() ?? ""; + } + var start = new ProcessStartInfo("runuser") { UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true }; + foreach (var arg in new[] { "-u", "postgres", "--", "psql", "--no-psqlrc", "--set=ON_ERROR_STOP=1", "--tuples-only", "--no-align", "--dbname", database ?? "postgres" }) start.ArgumentList.Add(arg); + using var process = Process.Start(start) ?? throw new InvalidOperationException(); var output = process.StandardOutput.ReadToEndAsync(); var error = process.StandardError.ReadToEndAsync(); await process.StandardInput.WriteAsync(sql); process.StandardInput.Close(); using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(60)); await process.WaitForExitAsync(deadline.Token); await error; if (process.ExitCode != 0) throw new InvalidOperationException("administration failed"); return (await output).Trim(); + } + if (await Sql($"SELECT EXISTS(SELECT FROM pg_database WHERE datname='{p.Database}');") is "t" or "True") throw new InvalidOperationException("existing database retained"); + await Sql($"SET password_encryption='scram-sha-256'; CREATE ROLE {p.RuntimeRole} LOGIN PASSWORD '{p.RuntimePassword}' NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION; CREATE ROLE {p.ProfileOwner} NOLOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE; CREATE ROLE {p.ObservationOwner} NOLOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;"); + await Sql($"CREATE DATABASE {p.Database};"); + await Sql($"REVOKE ALL ON DATABASE {p.Database} FROM PUBLIC; GRANT CONNECT ON DATABASE {p.Database} TO {p.RuntimeRole};", p.Database); + await Sql($"REVOKE ALL ON SCHEMA public FROM PUBLIC; CREATE SCHEMA profile AUTHORIZATION {p.ProfileOwner}; CREATE SCHEMA observations AUTHORIZATION {p.ObservationOwner};", p.Database); + foreach (var module in new[] { ("Profile", p.ProfileOwner), ("Observations", p.ObservationOwner) }) + { + if (module.Item1 == "Observations") await Sql($"GRANT USAGE ON SCHEMA profile TO {p.ObservationOwner}; GRANT REFERENCES ON profile.patient TO {p.ObservationOwner};", p.Database); + foreach (var script in Directory.GetFiles(Path.Combine(migrations, module.Item1), "*.sql").Order()) + await Sql($"BEGIN; SET LOCAL ROLE {module.Item2};\n" + Regex.Replace(await File.ReadAllTextAsync(script), @"^CREATE SCHEMA IF NOT EXISTS \w+;\s*", "") + "\nCOMMIT;", p.Database); + } + await Sql($"GRANT USAGE ON SCHEMA profile,observations TO {p.RuntimeRole}; GRANT SELECT,INSERT,UPDATE ON profile.patient TO {p.RuntimeRole}; GRANT SELECT,INSERT,UPDATE,DELETE ON observations.observation TO {p.RuntimeRole}; GRANT SELECT ON profile.schema_version,observations.schema_version TO {p.RuntimeRole};", p.Database); + if (admin is null) + { + // RHEL/Fedora may default to ident. Add only the new B database/role rule; + // retain every existing rule and a protected backup, rather than weaken host-wide auth. + var hbaPath = (await Sql("SHOW hba_file;")).Trim(); + var original = await File.ReadAllTextAsync(hbaPath); + PrivateFile(Path.Combine(directory, "pg_hba.before.conf"), original); + var rule = $"host {p.Database} {p.RuntimeRole} 127.0.0.1/32 scram-sha-256\n"; + await File.WriteAllTextAsync(hbaPath, rule + original); + await Sql("SELECT pg_reload_conf();"); + } + PrivateFile(Path.Combine(directory, "installation.json"), JsonSerializer.Serialize(p, Json)); + await using var runtime = new NpgsqlConnection(p.Settings["ConnectionStrings:HealthDatabase"]); await runtime.OpenAsync(); + await using var check = new NpgsqlCommand("SELECT current_user,has_schema_privilege(current_user,'profile','CREATE') OR has_schema_privilege(current_user,'observations','CREATE')", runtime); await using var reader = await check.ExecuteReaderAsync(); await reader.ReadAsync(); if (reader.GetString(0) != p.RuntimeRole || reader.GetBoolean(1)) throw new InvalidOperationException("runtime privilege verification failed"); + } + public static void Configure(string directory, string root) + { + var plan = Load(directory); var config = PathAt(root, "etc/healthapp-b"); if (Directory.Exists(config) || File.Exists(config)) throw new InvalidOperationException("configuration exists"); Directory.CreateDirectory(config); + File.Copy(Path.Combine(directory, "application.pfx"), Path.Combine(config, "application.pfx")); File.Copy(Path.Combine(directory, "healthapp-ca.crt"), Path.Combine(config, "healthapp-ca.crt")); + var connection = new NpgsqlConnectionStringBuilder(plan.Settings["ConnectionStrings:HealthDatabase"]); + if (!string.IsNullOrWhiteSpace(connection.RootCertificate)) + { var destination = Path.Combine(config, "database-ca.crt"); File.Copy(connection.RootCertificate, destination); connection.RootCertificate = destination; plan.Settings["ConnectionStrings:HealthDatabase"] = connection.ConnectionString; } + PrivateFile(Path.Combine(config, "appsettings.json"), JsonSerializer.Serialize(plan.Settings, Json)); + PrivateFile(Path.Combine(directory, "installation.json"), JsonSerializer.Serialize(plan, Json)); + var keys = PathAt(root, "var/lib/healthapp-b/keys"); Directory.CreateDirectory(keys); + if (OperatingSystem.IsLinux()) { File.SetUnixFileMode(config, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); File.SetUnixFileMode(keys, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); File.SetUnixFileMode(Path.Combine(config, "application.pfx"), UnixFileMode.UserRead | UnixFileMode.UserWrite); } + } + public static async Task VerifyDatabaseAsync(string directory) + { + var plan = Load(directory); await using var connection = new NpgsqlConnection(plan.Settings["ConnectionStrings:HealthDatabase"]); await connection.OpenAsync(); + await using var command = new NpgsqlCommand("SELECT (SELECT max(version) FROM profile.schema_version)=1 AND (SELECT max(version) FROM observations.schema_version)=1", connection); + if (await command.ExecuteScalarAsync() is not true) throw new InvalidOperationException("schema readiness failed"); + } + public static async Task VerifyAsync(string directory) + { + var plan = Load(directory); using var root = X509CertificateLoader.LoadCertificateFromFile(Path.Combine(directory, "healthapp-ca.crt")); + using var handler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = (_, cert, peerChain, errors) => + { + if (cert is null || (errors & (SslPolicyErrors.RemoteCertificateNameMismatch | SslPolicyErrors.RemoteCertificateNotAvailable)) != 0) return false; + using var chain = new X509Chain(); chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust; chain.ChainPolicy.CustomTrustStore.Add(root); chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; if (peerChain is not null) foreach (var element in peerChain.ChainElements) chain.ChainPolicy.ExtraStore.Add(element.Certificate); return chain.Build(cert); + } + }; + using var client = new HttpClient(handler) { BaseAddress = new UriBuilder("https", plan.Host, plan.Port).Uri, Timeout = TimeSpan.FromSeconds(15) }; + var account = plan.Accounts.Single(a => a.AccountId == "installation-check"); using var login = await client.PostAsJsonAsync("api/authentication/login", new { accountId = account.AccountId, password = account.Password }); login.EnsureSuccessStatusCode(); using var ticket = JsonDocument.Parse(await login.Content.ReadAsStringAsync()); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ticket.RootElement.GetProperty("accessToken").GetString()); + using var ready = await client.GetAsync("health/ready"); ready.EnsureSuccessStatusCode(); + using var profile = await client.PostAsJsonAsync("api/patients", new { name = "Synthetic installation check", dateOfBirth = "1980-01-01" }); + if (profile.StatusCode is not (HttpStatusCode.Created or HttpStatusCode.Conflict)) throw new InvalidOperationException(); + using var me = await client.GetAsync("api/patients/me"); me.EnsureSuccessStatusCode(); using var p = JsonDocument.Parse(await me.Content.ReadAsStringAsync()); var id = p.RootElement.GetProperty("patientId").GetGuid(); + if (profile.StatusCode == HttpStatusCode.Created) { using var observation = await client.PostAsJsonAsync($"api/patients/{id}/observations", new { measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68, measurementContext = new { setting = "Home", activityCondition = "AtRest" } }); observation.EnsureSuccessStatusCode(); } + foreach (var path in new[] { "observations/latest", "observations?from=2026-09-01&to=2026-09-30", "insights?from=2026-09-01&to=2026-09-30", "overview?from=2026-09-01&to=2026-09-30" }) { using var result = await client.GetAsync($"api/patients/{id}/{path}"); result.EnsureSuccessStatusCode(); } + await using var connection = new NpgsqlConnection(plan.Settings["ConnectionStrings:HealthDatabase"]); await connection.OpenAsync(); + } +} diff --git a/deploy/HealthApp.Provisioning/Program.cs b/deploy/HealthApp.Provisioning/Program.cs new file mode 100644 index 0000000..61a1d19 --- /dev/null +++ b/deploy/HealthApp.Provisioning/Program.cs @@ -0,0 +1,33 @@ +using System.Text.Json; +namespace HealthApp.Provisioning; + +public static class Program +{ + public static async Task Main(string[] args) + { + var stage = "arguments"; + try + { + if (args.Length == 0) throw new ArgumentException(); + var options = new Dictionary(StringComparer.Ordinal); + for (var i = 1; i < args.Length; i += 2) { if (i + 1 >= args.Length || !args[i].StartsWith("--") || !options.TryAdd(args[i][2..], args[i + 1])) throw new ArgumentException(); } + string Required(string key) => options.GetValueOrDefault(key) ?? throw new ArgumentException(); + stage = args[0]; var plan = Required("plan"); + switch (stage) + { + case "prepare": Installation.Prepare(plan, Required("host"), int.Parse(options.GetValueOrDefault("port", "5443")), Required("root"), options.GetValueOrDefault("certificate"), options.GetValueOrDefault("certificate-password-file"), options.GetValueOrDefault("ca")); break; + case "database": await Installation.DatabaseAsync(plan, Required("migrations"), options.GetValueOrDefault("admin-file")); break; + case "configure": Installation.Configure(plan, Required("root")); break; + case "verify-database": await Installation.VerifyDatabaseAsync(plan); break; + case "verify": await Installation.VerifyAsync(plan); break; + default: throw new ArgumentException(); + } + Console.WriteLine("Completed " + stage + "."); return 0; + } + catch (Exception e) + { + // Never print SQL, password/token values, health payloads or exception text. + Console.Error.WriteLine("Provisioning failed at " + stage + " (" + e.GetType().Name + "). Existing data and diagnostics retained."); return 1; + } + } +} diff --git a/deploy/INSTALLATION.md b/deploy/INSTALLATION.md new file mode 100644 index 0000000..0e906e8 --- /dev/null +++ b/deploy/INSTALLATION.md @@ -0,0 +1,33 @@ +# Architecture B native Linux installation + +Build with the .NET 10 SDK: `HEALTHAPP_DOTNET=/path/to/dotnet bash deploy/build-release.sh --output NEW_DIRECTORY`. The bundle is independently deployable: one app, transient provisioner, module-owned migrations, dependency adapters and one systemd unit. No source checkout, container engine or other Health App services are required on the target. + +Normal local installation, from the bundle: `sudo bash install.sh --host DNS_OR_IP`. It supplies missing dependencies, a fresh database, separate NOLOGIN schema owners and a restricted DML login role, generated account/database secrets, HTTPS certificate, protected configuration/key ring, migrations and a native application service. No manual database, password or certificate creation is required. Synthetic installer checks remain as clearly named prototype records; generated professional has no assignments. Assigned reads require predefined configuration, not an assignment-management API. + +Existing `/opt/healthapp-b`, `/etc/healthapp-b`, `/var/lib/healthapp-b`, installation state or unit prevents installation before overwriting anything. Partial failures retain protected material and report the stage; there is no transactional installer rollback or automatic resume. Architecture A paths/databases are not modified. No production-data import is included. + +## Distribution support + +The installer is distribution-aware, not Ubuntu-only. Intended systemd x86_64 targets: Debian 12/13, Ubuntu 24.04, Fedora 43/44, RHEL-family systems with compatible native feeds, and current Arch/Manjaro. Actual package/runtime availability and systemd must pass preflight. Rolling-distribution dependency installation performs a full package update to avoid partial upgrades. Derivative version numbers are not silently substituted into unrelated upstream feeds. No universal Linux support is claimed. + +APT uses native feeds, with identified Microsoft Debian or official Ubuntu .NET backports where necessary; DNF uses configured distribution feeds; pacman uses native repositories. PostgreSQL initialization/startup follows each family. In remote mode none of these adapters installs or starts local PostgreSQL. + +Package choices follow [Microsoft Debian](https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian), [Ubuntu](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install), [Fedora](https://learn.microsoft.com/en-us/dotnet/core/install/linux-fedora), and [Arch ASP.NET package](https://archlinux.org/packages/extra/x86_64/aspnet-runtime/) documentation. Supported in design does not mean installation has been executed on every family. Verified: Debian 12 bookworm systemd local installation (PostgreSQL 15.19) and remote installation (PostgreSQL 18.6 with VerifyFull), .NET/ASP.NET 10.0.13. These are actual native services inside isolated Linux test environments sharing the Manjaro kernel; bare-metal/VM and other distributions are not independently verified. The implementation evidence register records this boundary. + +## Remote PostgreSQL + +Provide administrator-controlled reachable PostgreSQL, certificate/CA trust and restrictive network access. Put its administrative connection in an owner-only file (mode 600/400), including `SslMode=VerifyFull` and `RootCertificate=/path/to/trusted-db-ca.crt` when a private CA is used. Use a DNS name matching the DB certificate (or matching IP SAN), not an unverified alias. Credentials never go on a command line. + +Run `sudo bash install.sh --mode remote --host APP_DNS --postgres-admin-file /secure/admin.connection`. The tool creates a new B database/roles/schemas remotely. Runtime config inherits verified encryption/hostname checks, replaces administrative identity with the generated restricted role, and copies an explicit DB CA into installed protected configuration. No local PostgreSQL dependency is installed. The database administrator supplies the existing remote host/administrative access; application database/user/secret setup is automated. + +## Native runtime and trust + +`healthapp-b.service` runs as `healthapp-b`, listens on one HTTPS endpoint (default 5443), and loads `/etc/healthapp-b/appsettings.json`. Its private key/config are root-owned and readable only by the service group. Token keys persist under `/var/lib/healthapp-b/keys` (service-owned mode 700). Migration identities are not runtime credentials. The runtime cannot create/drop schemas/tables or administer PostgreSQL. Local provisioning generates SCRAM credentials and adds a loopback authentication rule scoped only to the new B database/role, retaining existing rules and a protected backup. This handles distributions whose PostgreSQL defaults use ident authentication without weakening host-wide access. + +The verifier validates certificate chain and hostname using the generated/supplied trust root. Export `/etc/healthapp-b/healthapp-ca.crt` to establish client trust separately; never disable certificate validation. Supplied certificate options: `--certificate PFX --certificate-password-file OWNER_ONLY_FILE --ca ROOT_CA_PEM`. Certificate replacement is an administrative operation: preserve backups, change PFX/password configuration with restrictive permissions, restart and verify trusted HTTPS. Prototype leaf validity is one year; CA two years; automatic renewal is outside scope. + +The installer checks PID/HTTPS/configured DB/representative login/profile/observation/history/insight/overview, stops the app while PostgreSQL stays ready, restarts with a new PID and repeats verification. Liveness and readiness require a valid bearer ticket and disclose no patient information. Readiness checks keys, reference content and both migration versions; guidance/login can operate during DB-only outages. + +`--dotnet /absolute/runtime/path` may reuse an existing .NET 10 ASP.NET runtime. Use a system-readable path outside `/tmp` and protected home directories because the service uses PrivateTmp and ProtectHome. Logs omit credentials/tokens/health payloads and identifying route values. Configuration controls pool size, request/assessment concurrency, deadline, accounts, assignments and token lifetime. Defaults are deployment starting values, not measured capacity or energy claims. + +Before future upgrades: back up the B database, protected configuration and token keys; retain source/target revisions; stop or explicitly coordinate app access while privileged module migrations run; verify integrity and HTTPS/workflows before switching. No backup SLA, HA, live A import, automatic rollback or production/clinical certification is promised. Measurement host/data/workload equivalence must be controlled separately from installation evidence. diff --git a/deploy/appsettings.example.json b/deploy/appsettings.example.json new file mode 100644 index 0000000..4fad16e --- /dev/null +++ b/deploy/appsettings.example.json @@ -0,0 +1,7 @@ +{ + "ConnectionStrings": {"HealthDatabase": "Host=127.0.0.1;Database=YOUR_FRESH_B_DB;Username=YOUR_RUNTIME_ROLE;Password=LOAD_EXTERNALLY"}, + "Authentication": {"KeyDirectory": "/var/lib/healthapp-b/keys", "TokenLifetimeMinutes": 30, "Accounts": []}, + "Access": {"ProfessionalAssignments": {}}, + "Resources": {"MaxPoolSize": 32, "MaxConcurrentRequests": 32, "MaxConcurrentAssessments": 4, "RequestDeadlineSeconds": 30}, + "Database": {"Remote": false} +} diff --git a/deploy/build-release.sh b/deploy/build-release.sh new file mode 100644 index 0000000..ad74280 --- /dev/null +++ b/deploy/build-release.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail +output='' +while (($#)); do case "$1" in --output) output=$2; shift 2;; *) echo 'Usage: build-release.sh --output NEW_DIRECTORY' >&2; exit 2;; esac; done +[[ -n "$output" && ! -e "$output" ]] || { echo 'A new output directory is required.' >&2; exit 2; } +repository=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +runtime=${HEALTHAPP_DOTNET:-dotnet} +output=$(realpath -m "$output") +mkdir -p "$output/app" "$output/provisioner" "$output/migrations" +"$runtime" publish "$repository/src/HealthApp/HealthApp.csproj" -c Release -o "$output/app" --nologo +"$runtime" publish "$repository/deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj" -c Release -o "$output/provisioner" --nologo +for module in Profile Observations; do mkdir -p "$output/migrations/$module"; cp "$repository/src/Modules/$module/Migrations/"*.sql "$output/migrations/$module/"; done +cp "$repository/deploy/installer/"*.sh "$output/" +cp "$repository/deploy/systemd/healthapp-b.service" "$output/" +cp "$repository/deploy/INSTALLATION.md" "$output/" +echo 'Release bundle prepared; no generated installation secrets included.' diff --git a/deploy/installer/bootstrap.sh b/deploy/installer/bootstrap.sh new file mode 100644 index 0000000..8d0f27b --- /dev/null +++ b/deploy/installer/bootstrap.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# Distribution package adapters; normal installation uses signed native package feeds. +has_runtime() { [[ -x "$dotnet" ]] && "$dotnet" --list-runtimes | rg_runtime; } +rg_runtime() { grep -q 'Microsoft.AspNetCore.App 10\.'; } +ensure_dependencies() { + local family='' + source "${HEALTHAPP_OS_RELEASE:-/etc/os-release}" + case " $ID ${ID_LIKE:-} " in + *' debian '*|*' ubuntu '*) family=apt;; + *' fedora '*|*' rhel '*) family=dnf;; + *' arch '*|*' manjaro '*) family=pacman;; + *) fail 'No supported dependency adapter for this systemd distribution.';; + esac + stage='distribution dependencies' + case "$family" in + apt) + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl + if ! has_runtime; then + if ! apt-cache policy aspnetcore-runtime-10.0 | grep -Eq 'Candidate: [0-9]'; then + if [[ "$ID" == debian && "$VERSION_ID" =~ ^(12|13)$ ]]; then + local feed; feed=$(mktemp -d) + curl --fail --silent --show-error --location "https://packages.microsoft.com/config/debian/$VERSION_ID/packages-microsoft-prod.deb" -o "$feed/feed.deb" + dpkg -i "$feed/feed.deb"; apt-get update + elif [[ "$ID" == ubuntu && "$VERSION_ID" == 24.04 ]]; then + DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common + add-apt-repository -y ppa:dotnet/backports; apt-get update + else fail 'No identified .NET 10 feed; derivative versions are not mapped to an unrelated upstream.'; fi + fi + DEBIAN_FRONTEND=noninteractive apt-get install -y aspnetcore-runtime-10.0 + fi + if [[ "$mode" == local ]]; then DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql; systemctl enable --now postgresql; fi + ;; + dnf) + dnf install -y ca-certificates curl + has_runtime || dnf install -y aspnetcore-runtime-10.0 + if [[ "$mode" == local ]]; then + dnf install -y postgresql-server postgresql + [[ -f /var/lib/pgsql/data/PG_VERSION ]] || postgresql-setup --initdb + systemctl enable --now postgresql + fi + ;; + pacman) + # Avoid partial rolling-distribution upgrades when installing dependencies. + pacman -Syu --noconfirm --needed ca-certificates curl + has_runtime || pacman -S --noconfirm --needed aspnet-runtime + if [[ "$mode" == local ]]; then + pacman -S --noconfirm --needed postgresql + if [[ ! -f /var/lib/postgres/data/PG_VERSION ]]; then + install -d -o postgres -g postgres -m 700 /var/lib/postgres/data + runuser -u postgres -- initdb -D /var/lib/postgres/data --auth-local=peer --auth-host=scram-sha-256 + fi + systemctl enable --now postgresql + fi + ;; + esac + has_runtime || fail '.NET 10 ASP.NET Core runtime is unavailable after dependency provisioning.' + if [[ "$mode" == local ]]; then + stage='local PostgreSQL readiness' + local ready=false attempt + for attempt in {1..30}; do if pg_isready -q -h 127.0.0.1 -p 5432; then ready=true; break; fi; sleep 1; done + [[ "$ready" == true ]] || fail 'Local PostgreSQL is not ready on port 5432.' + fi +} diff --git a/deploy/installer/install.sh b/deploy/installer/install.sh new file mode 100644 index 0000000..14d25f6 --- /dev/null +++ b/deploy/installer/install.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -euo pipefail +umask 077 +stage=preflight +fail() { echo "Installation failed at $stage: $1 Existing installation material retained." >&2; exit 1; } +trap 'fail "Command failed; consult protected stage diagnostics."' ERR +bundle=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +mode=local host=localhost port=5443 admin_file='' certificate='' certificate_password_file='' ca='' +dotnet=${HEALTHAPP_DOTNET:-/usr/bin/dotnet} +while (($#)); do + case "$1" in + --mode) mode=$2; shift 2;; --host) host=$2; shift 2;; --port) port=$2; shift 2;; + --postgres-admin-file) admin_file=$2; shift 2;; --dotnet) dotnet=$2; shift 2;; + --certificate) certificate=$2; shift 2;; --certificate-password-file) certificate_password_file=$2; shift 2;; --ca) ca=$2; shift 2;; + *) fail 'Unknown installation option.';; + esac +done +[[ $EUID -eq 0 ]] || fail 'Administrative/root access is required.' +[[ "$mode" == local || "$mode" == remote ]] || fail 'Select local or remote database mode.' +[[ -d /run/systemd/system ]] || fail 'A running systemd host is required.' +[[ -f "$bundle/app/HealthApp.dll" && -f "$bundle/provisioner/HealthApp.Provisioning.dll" ]] || fail 'Release payload missing.' +for path in /opt/healthapp-b /etc/healthapp-b /var/lib/healthapp-b /var/lib/healthapp-b-installation /etc/systemd/system/healthapp-b.service; do [[ ! -e "$path" ]] || fail 'Existing target path would be overwritten.'; done +if [[ "$mode" == remote ]]; then [[ -n "$admin_file" && -f "$admin_file" ]] || fail 'Remote mode needs a protected administrative connection file with VerifyFull and trusted CA.'; fi +if [[ -n "$admin_file" ]]; then [[ $(stat -c '%a' "$admin_file") == 600 || $(stat -c '%a' "$admin_file") == 400 ]] || fail 'Administrative connection file must be owner-only.'; fi +install -d -m 700 /var/lib/healthapp-b-installation +exec > >(tee -a /var/lib/healthapp-b-installation/install.log) 2>&1 +source "$bundle/bootstrap.sh" +ensure_dependencies +stage='protected preparation' +install -d -m 700 /var/lib/healthapp-b-installation +plan=/var/lib/healthapp-b-installation/deployment +prepare=(prepare --plan "$plan" --host "$host" --port "$port" --root /) +if [[ -n "$certificate" ]]; then prepare+=(--certificate "$certificate" --certificate-password-file "$certificate_password_file" --ca "$ca"); fi +"$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" "${prepare[@]}" +stage='database roles schemas and migration' +database=(database --plan "$plan" --migrations "$bundle/migrations") +if [[ "$mode" == remote ]]; then database+=(--admin-file "$admin_file"); fi +"$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" "${database[@]}" +stage='application configuration and identity' +id -u healthapp-b >/dev/null 2>&1 || useradd --system --user-group --home-dir /var/lib/healthapp-b --shell /usr/sbin/nologin healthapp-b +install -d -m 755 /opt/healthapp-b +cp -a "$bundle/app/." /opt/healthapp-b/ +"$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" configure --plan "$plan" --root / +chown -R root:healthapp-b /etc/healthapp-b +chmod 750 /etc/healthapp-b +chmod 640 /etc/healthapp-b/appsettings.json /etc/healthapp-b/application.pfx +chmod 644 /etc/healthapp-b/*.crt +chown -R healthapp-b:healthapp-b /var/lib/healthapp-b +chmod 700 /var/lib/healthapp-b /var/lib/healthapp-b/keys +stage='native systemd registration' +[[ "$dotnet" =~ ^/[a-zA-Z0-9_./-]+$ ]] || fail 'The runtime must have a safe absolute executable path.' +sed "s|@DOTNET@|$dotnet|g" "$bundle/healthapp-b.service" > /etc/systemd/system/healthapp-b.service +chmod 644 /etc/systemd/system/healthapp-b.service +systemctl daemon-reload +systemctl enable --now healthapp-b.service +stage='HTTPS database and representative workflow verification' +ready=false +for attempt in {1..30}; do if "$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" verify --plan "$plan"; then ready=true; break; fi; sleep 1; done +[[ "$ready" == true ]] || fail 'Representative verification did not complete.' +stage='independent stop restart verification' +before_pid=$(systemctl show healthapp-b.service --property MainPID --value) +[[ "$before_pid" =~ ^[1-9][0-9]*$ ]] || fail 'Application PID is missing.' +if [[ "$mode" == local ]]; then pg_isready -q -h 127.0.0.1 -p 5432 || fail 'Database was unavailable before application stop.'; fi +systemctl stop healthapp-b.service +"$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" verify-database --plan "$plan" +if [[ "$mode" == local ]]; then pg_isready -q -h 127.0.0.1 -p 5432 || fail 'Application stop affected PostgreSQL.'; fi +systemctl start healthapp-b.service +ready=false +for attempt in {1..30}; do if "$dotnet" "$bundle/provisioner/HealthApp.Provisioning.dll" verify --plan "$plan"; then ready=true; break; fi; sleep 1; done +[[ "$ready" == true ]] || fail 'Workflow did not recover after restart.' +after_pid=$(systemctl show healthapp-b.service --property MainPID --value) +[[ "$after_pid" =~ ^[1-9][0-9]*$ && "$after_pid" != "$before_pid" ]] || fail 'Restarted application PID not verified.' +stage=complete +printf 'Architecture B installed and verified: one HTTPS application, independent PostgreSQL lifecycle.\n' +printf 'Protected generated account material: /var/lib/healthapp-b-installation/deployment/accounts.json\n' +printf 'Export /etc/healthapp-b/healthapp-ca.crt to establish client trust.\n' diff --git a/deploy/systemd/healthapp-b.service b/deploy/systemd/healthapp-b.service new file mode 100644 index 0000000..748a765 --- /dev/null +++ b/deploy/systemd/healthapp-b.service @@ -0,0 +1,28 @@ +[Unit] +Description=Health App Architecture B +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=healthapp-b +Group=healthapp-b +WorkingDirectory=/opt/healthapp-b +Environment=ASPNETCORE_ENVIRONMENT=Production +Environment=HEALTHAPP_CONFIGURATION_FILE=/etc/healthapp-b/appsettings.json +ExecStart=@DOTNET@ /opt/healthapp-b/HealthApp.dll +Restart=on-failure +RestartSec=3 +KillSignal=SIGINT +TimeoutStopSec=30 +UMask=0077 +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/lib/healthapp-b +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/src/HealthApp.Contracts/AnalyticsFacades.cs b/src/HealthApp.Contracts/AnalyticsFacades.cs index d2ac1a2..a768aad 100644 --- a/src/HealthApp.Contracts/AnalyticsFacades.cs +++ b/src/HealthApp.Contracts/AnalyticsFacades.cs @@ -1,12 +1,13 @@ namespace HealthApp.Contracts; + public interface ReferenceCatalog { - ClinicalReference Pulse(); - ClinicalReference Pressure(string metric,string setting); - string Version {get;} + ClinicalReference Pulse(); + ClinicalReference Pressure(string metric, string setting); + string Version { get; } } public interface AnalyticsQueries { - Task InsightAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct); - Task TrendAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct); + Task InsightAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct); + Task TrendAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct); } diff --git a/src/HealthApp.Contracts/AuthorizedPatientContext.cs b/src/HealthApp.Contracts/AuthorizedPatientContext.cs index 8c44d35..a53cab3 100644 --- a/src/HealthApp.Contracts/AuthorizedPatientContext.cs +++ b/src/HealthApp.Contracts/AuthorizedPatientContext.cs @@ -1,22 +1,22 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("HealthApp")] +[assembly: InternalsVisibleTo("HealthApp")] namespace HealthApp.Contracts; // Only the API/access assembly issues this request-local capability after policy checks. public sealed class AuthorizedPatientContext { - internal AuthorizedPatientContext(Guid patientId, bool canWrite){PatientId=patientId;CanWrite=canWrite;} - public Guid PatientId {get;} - public bool CanWrite {get;} - public void RequireWrite(){if(!CanWrite)throw new UnauthorizedAccessException("Read-only scope.");} + internal AuthorizedPatientContext(Guid patientId, bool canWrite) { PatientId = patientId; CanWrite = canWrite; } + public Guid PatientId { get; } + public bool CanWrite { get; } + public void RequireWrite() { if (!CanWrite) throw new UnauthorizedAccessException("Read-only scope."); } } public interface ProfileQueries { - Task ResolveAccountAsync(string accountId,CancellationToken ct); - Task GetAsync(AuthorizedPatientContext scope,CancellationToken ct); + Task ResolveAccountAsync(string accountId, CancellationToken ct); + Task GetAsync(AuthorizedPatientContext scope, CancellationToken ct); } public interface ProfileCommands { - Task CreateAsync(string trustedAccountId,CreatePatientRequest request,CancellationToken ct); - Task UpdateAsync(AuthorizedPatientContext scope,UpdatePatientRequest request,CancellationToken ct); + Task CreateAsync(string trustedAccountId, CreatePatientRequest request, CancellationToken ct); + Task UpdateAsync(AuthorizedPatientContext scope, UpdatePatientRequest request, CancellationToken ct); } public sealed class ProfileAlreadyExistsException : Exception; diff --git a/src/HealthApp.Contracts/ClinicalRuleProvenance.cs b/src/HealthApp.Contracts/ClinicalRuleProvenance.cs new file mode 100644 index 0000000..dc70b70 --- /dev/null +++ b/src/HealthApp.Contracts/ClinicalRuleProvenance.cs @@ -0,0 +1,5 @@ +namespace HealthApp.Contracts; + +// Bundle metadata, not an additional patient response or a clinical decision algorithm. +public sealed record ClinicalRuleProvenance(string Metric, string Claim, + string Prerequisites, string AllowedInference, string ReviewState); diff --git a/src/HealthApp.Contracts/HealthOverviewDto.cs b/src/HealthApp.Contracts/HealthOverviewDto.cs index 1ac7249..1061d7d 100644 --- a/src/HealthApp.Contracts/HealthOverviewDto.cs +++ b/src/HealthApp.Contracts/HealthOverviewDto.cs @@ -1,6 +1,7 @@ namespace HealthApp.Contracts; -public sealed record HealthOverviewDto(PatientDto Patient,ObservationDto? LatestObservation,HealthInsight? Insight,DateTime PeriodStart,DateTime PeriodEnd,ContextSelection InsightSelection,int InsightContributingCount,string LatestObservationBasis,string InsightExplanation); + +public sealed record HealthOverviewDto(PatientDto Patient, ObservationDto? LatestObservation, HealthInsight? Insight, DateTime PeriodStart, DateTime PeriodEnd, ContextSelection InsightSelection, int InsightContributingCount, string LatestObservationBasis, string InsightExplanation); public interface OverviewQueries { - Task GetAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct); + Task GetAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct); } diff --git a/src/HealthApp.Contracts/ObservationFacades.cs b/src/HealthApp.Contracts/ObservationFacades.cs index f498129..2c5c22a 100644 --- a/src/HealthApp.Contracts/ObservationFacades.cs +++ b/src/HealthApp.Contracts/ObservationFacades.cs @@ -1,19 +1,20 @@ namespace HealthApp.Contracts; + public interface ObservationQueries { - Task ResolveOwnerAsync(Guid observationId,CancellationToken ct); - Task GetAsync(AuthorizedPatientContext scope,Guid id,CancellationToken ct); - Task LatestAsync(AuthorizedPatientContext scope,CancellationToken ct); - Task> SelectedAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct); + Task ResolveOwnerAsync(Guid observationId, CancellationToken ct); + Task GetAsync(AuthorizedPatientContext scope, Guid id, CancellationToken ct); + Task LatestAsync(AuthorizedPatientContext scope, CancellationToken ct); + Task> SelectedAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct); } public interface ObservationCommands { - Task RecordAsync(AuthorizedPatientContext scope,RecordObservationRequest request,CancellationToken ct); - Task PatchAsync(AuthorizedPatientContext scope,Guid id,PatchObservationRequest request,CancellationToken ct); - Task DeleteAsync(AuthorizedPatientContext scope,Guid id,CancellationToken ct); + Task RecordAsync(AuthorizedPatientContext scope, RecordObservationRequest request, CancellationToken ct); + Task PatchAsync(AuthorizedPatientContext scope, Guid id, PatchObservationRequest request, CancellationToken ct); + Task DeleteAsync(AuthorizedPatientContext scope, Guid id, CancellationToken ct); } public static class MeasurementPeriod { - public static DateTime Normalize(DateTime t)=>DateTime.SpecifyKind(t.Kind==DateTimeKind.Unspecified?t:t.ToUniversalTime(),DateTimeKind.Unspecified); - public static void Validate(DateTime from,DateTime to){if(Normalize(to) DateTime.SpecifyKind(t.Kind == DateTimeKind.Unspecified ? t : t.ToUniversalTime(), DateTimeKind.Unspecified); + public static void Validate(DateTime from, DateTime to) { if (Normalize(to) < Normalize(from)) throw new ArgumentException("The end time must not be earlier than the start time."); } } diff --git a/src/HealthApp.Infrastructure/RequestTransaction.cs b/src/HealthApp.Infrastructure/RequestTransaction.cs index 2f108e9..32be8bd 100644 --- a/src/HealthApp.Infrastructure/RequestTransaction.cs +++ b/src/HealthApp.Infrastructure/RequestTransaction.cs @@ -5,30 +5,30 @@ namespace HealthApp.Infrastructure; // Coordinates mechanics only; it has no health table/query or access-policy knowledge. public sealed class RequestTransaction(NpgsqlDataSource source) : IAsyncDisposable { - public NpgsqlConnection? Connection {get;private set;} - public NpgsqlTransaction? Transaction {get;private set;} - public bool Active=>Transaction is not null; - public async Task BeginAsync(bool write,CancellationToken ct) - { - if(Active)return; - Connection=await source.OpenConnectionAsync(ct); - Transaction=await Connection.BeginTransactionAsync(write?IsolationLevel.ReadCommitted:IsolationLevel.RepeatableRead,ct); - } - public async Task EnlistAsync(DbContext context,CancellationToken ct) - { - if(Transaction is null || Connection is null)throw new InvalidOperationException("No request transaction."); - if(context.Database.GetDbConnection()!=Connection)context.Database.SetDbConnection(Connection,false); - await context.Database.UseTransactionAsync(Transaction,ct); - } - public async Task FinishAsync(CancellationToken ct) - { - if(Transaction is null)return; - await Transaction.CommitAsync(ct);await Transaction.DisposeAsync();Transaction=null; - await Connection!.DisposeAsync();Connection=null; - } - public async ValueTask DisposeAsync() - { - if(Transaction is not null){await Transaction.DisposeAsync();Transaction=null;} - if(Connection is not null){await Connection.DisposeAsync();Connection=null;} - } + public NpgsqlConnection? Connection { get; private set; } + public NpgsqlTransaction? Transaction { get; private set; } + public bool Active => Transaction is not null; + public async Task BeginAsync(bool write, CancellationToken ct) + { + if (Active) return; + Connection = await source.OpenConnectionAsync(ct); + Transaction = await Connection.BeginTransactionAsync(write ? IsolationLevel.ReadCommitted : IsolationLevel.RepeatableRead, ct); + } + public async Task EnlistAsync(DbContext context, CancellationToken ct) + { + if (Transaction is null || Connection is null) throw new InvalidOperationException("No request transaction."); + if (context.Database.GetDbConnection() != Connection) context.Database.SetDbConnection(Connection, false); + await context.Database.UseTransactionAsync(Transaction, ct); + } + public async Task FinishAsync(CancellationToken ct) + { + if (Transaction is null) return; + await Transaction.CommitAsync(ct); await Transaction.DisposeAsync(); Transaction = null; + await Connection!.DisposeAsync(); Connection = null; + } + public async ValueTask DisposeAsync() + { + if (Transaction is not null) { await Transaction.DisposeAsync(); Transaction = null; } + if (Connection is not null) { await Connection.DisposeAsync(); Connection = null; } + } } diff --git a/src/HealthApp/Controllers/AuthenticationController.cs b/src/HealthApp/Controllers/AuthenticationController.cs index 862575b..b702f01 100644 --- a/src/HealthApp/Controllers/AuthenticationController.cs +++ b/src/HealthApp/Controllers/AuthenticationController.cs @@ -26,13 +26,20 @@ public sealed class AuthenticationController(PrototypeAccounts accounts, new Claim(ClaimTypes.Role, account.Role) }, "Bearer")); var settings = options.Get("Bearer"); - var expiry = settings.TimeProvider!.GetUtcNow().Add(settings.BearerTokenExpiration); + var issued = settings.TimeProvider!.GetUtcNow(); + var expiry = issued.Add(settings.BearerTokenExpiration); // Use the framework's ticket protector and bearer validation. No refresh endpoint/token. - var ticket = new AuthenticationTicket(principal, new AuthenticationProperties { ExpiresUtc = expiry }, "Bearer"); + var ticket = new AuthenticationTicket(principal, new AuthenticationProperties { IssuedUtc = issued, ExpiresUtc = expiry }, "Bearer"); Response.Headers.CacheControl = "no-store"; Response.Headers.Pragma = "no-cache"; - return Ok(new { accessToken = settings.BearerTokenProtector.Protect(ticket), tokenType = "Bearer", - expiresIn = (long)settings.BearerTokenExpiration.TotalSeconds, accountId = account.AccountId, role = account.Role }); + return Ok(new + { + accessToken = settings.BearerTokenProtector.Protect(ticket), + tokenType = "Bearer", + expiresIn = (long)settings.BearerTokenExpiration.TotalSeconds, + accountId = account.AccountId, + role = account.Role + }); } public sealed record LoginRequest([Required] string AccountId, [Required] string Password); diff --git a/src/HealthApp/Controllers/HealthOverviewController.cs b/src/HealthApp/Controllers/HealthOverviewController.cs index 5cd14a0..d7d56ff 100644 --- a/src/HealthApp/Controllers/HealthOverviewController.cs +++ b/src/HealthApp/Controllers/HealthOverviewController.cs @@ -4,14 +4,15 @@ using HealthApp.Security; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace HealthApp.Controllers; + [ApiController] -public sealed class HealthOverviewController(OverviewQueries overview,AccessPolicy access,RequestTransaction tx) : ControllerBase +public sealed class HealthOverviewController(OverviewQueries overview, AccessPolicy access, RequestTransaction tx) : ControllerBase { - [HttpGet("api/patients/{patientId:guid}/overview")] - public async Task Get(Guid patientId,[FromQuery,BindRequired]DateTime from,[FromQuery,BindRequired]DateTime to,[FromQuery]ContextSelection selection,CancellationToken ct) - { - var scope=await access.AuthorizeAsync(User,patientId,false,ct);if(scope is null){Response.StatusCode=404;return new EmptyResult();} - try{var o=await overview.GetAsync(scope,from,to,selection,ct);await tx.FinishAsync(ct);return o is null?Problem(statusCode:404,title:"Patient does not exist."):Ok(o);} - catch(ArgumentException){ModelState.AddModelError(nameof(to),"The end time must not be earlier than the start time.");return ValidationProblem(ModelState);} - } + [HttpGet("api/patients/{patientId:guid}/overview")] + public async Task Get(Guid patientId, [FromQuery, BindRequired] DateTime from, [FromQuery, BindRequired] DateTime to, [FromQuery] ContextSelection selection, CancellationToken ct) + { + var scope = await access.AuthorizeAsync(User, patientId, false, ct); if (scope is null) { Response.StatusCode = 404; return new EmptyResult(); } + try { var o = await overview.GetAsync(scope, from, to, selection, ct); await tx.FinishAsync(ct); return o is null ? Problem(statusCode: 404, title: "Patient does not exist.") : Ok(o); } + catch (ArgumentException) { ModelState.AddModelError(nameof(to), "The end time must not be earlier than the start time."); return ValidationProblem(ModelState); } + } } diff --git a/src/HealthApp/Controllers/InsightsController.cs b/src/HealthApp/Controllers/InsightsController.cs index be3775d..5eb0ce5 100644 --- a/src/HealthApp/Controllers/InsightsController.cs +++ b/src/HealthApp/Controllers/InsightsController.cs @@ -3,17 +3,18 @@ using HealthApp.Security; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace HealthApp.Controllers; + [ApiController] -public sealed class InsightsController(AnalyticsQueries analytics,AccessPolicy access) : ControllerBase +public sealed class InsightsController(AnalyticsQueries analytics, AccessPolicy access) : ControllerBase { - [HttpGet("api/patients/{patientId:guid}/insights")] - public Task Insight(Guid patientId,[FromQuery,BindRequired]DateTime from,[FromQuery,BindRequired]DateTime to,[FromQuery]ContextSelection selection,CancellationToken ct)=>Calculate(patientId,from,to,selection,false,ct); - [HttpGet("api/patients/{patientId:guid}/trends")] - public Task Trend(Guid patientId,[FromQuery,BindRequired]DateTime from,[FromQuery,BindRequired]DateTime to,[FromQuery]ContextSelection selection,CancellationToken ct)=>Calculate(patientId,from,to,selection,true,ct); - private async Task Calculate(Guid patientId,DateTime from,DateTime to,ContextSelection selection,bool trend,CancellationToken ct) - { - var scope=await access.AuthorizeAsync(User,patientId,false,ct);if(scope is null){Response.StatusCode=404;return new EmptyResult();} - try{if(trend)return Ok(await analytics.TrendAsync(scope,from,to,selection,ct));var insight=await analytics.InsightAsync(scope,from,to,selection,ct);return insight is null?Problem(statusCode:404,title:"Insufficient observation data for calculation."):Ok(insight);} - catch(ArgumentException){ModelState.AddModelError(nameof(to),"The end time must not be earlier than the start time.");return ValidationProblem(ModelState);} - } + [HttpGet("api/patients/{patientId:guid}/insights")] + public Task Insight(Guid patientId, [FromQuery, BindRequired] DateTime from, [FromQuery, BindRequired] DateTime to, [FromQuery] ContextSelection selection, CancellationToken ct) => Calculate(patientId, from, to, selection, false, ct); + [HttpGet("api/patients/{patientId:guid}/trends")] + public Task Trend(Guid patientId, [FromQuery, BindRequired] DateTime from, [FromQuery, BindRequired] DateTime to, [FromQuery] ContextSelection selection, CancellationToken ct) => Calculate(patientId, from, to, selection, true, ct); + private async Task Calculate(Guid patientId, DateTime from, DateTime to, ContextSelection selection, bool trend, CancellationToken ct) + { + var scope = await access.AuthorizeAsync(User, patientId, false, ct); if (scope is null) { Response.StatusCode = 404; return new EmptyResult(); } + try { if (trend) return Ok(await analytics.TrendAsync(scope, from, to, selection, ct)); var insight = await analytics.InsightAsync(scope, from, to, selection, ct); return insight is null ? Problem(statusCode: 404, title: "Insufficient observation data for calculation.") : Ok(insight); } + catch (ArgumentException) { ModelState.AddModelError(nameof(to), "The end time must not be earlier than the start time."); return ValidationProblem(ModelState); } + } } diff --git a/src/HealthApp/Controllers/MeasurementGuidanceController.cs b/src/HealthApp/Controllers/MeasurementGuidanceController.cs index 386ea6e..31805b7 100644 --- a/src/HealthApp/Controllers/MeasurementGuidanceController.cs +++ b/src/HealthApp/Controllers/MeasurementGuidanceController.cs @@ -2,13 +2,14 @@ using HealthApp.Guidance; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace HealthApp.Controllers; + [ApiController, AllowAnonymous, Route("api/measurement-guidance")] public sealed class MeasurementGuidanceController(GuidanceQueries guidance) : ControllerBase { - [HttpGet] - public IActionResult Get([FromQuery] string? setting, [FromQuery] string? activityCondition) - { - try { return Ok(guidance.Get(setting, activityCondition)); } - catch (ArgumentException e) { return Problem(statusCode:400, title:e.Message); } - } + [HttpGet] + public IActionResult Get([FromQuery] string? setting, [FromQuery] string? activityCondition) + { + try { return Ok(guidance.Get(setting, activityCondition)); } + catch (ArgumentException e) { return Problem(statusCode: 400, title: e.Message); } + } } diff --git a/src/HealthApp/Controllers/ObservationController.cs b/src/HealthApp/Controllers/ObservationController.cs index a662c8f..8c3d6a5 100644 --- a/src/HealthApp/Controllers/ObservationController.cs +++ b/src/HealthApp/Controllers/ObservationController.cs @@ -5,29 +5,30 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace HealthApp.Controllers; -[ApiController,Route("api")] -public sealed class ObservationController(ObservationQueries queries,ObservationCommands commands,AccessPolicy access,RequestTransaction tx) : ControllerBase -{ - private IActionResult Unavailable(){Response.StatusCode=404;return new EmptyResult();} - private async Task Owner(Guid id,bool write,CancellationToken ct){var owner=await queries.ResolveOwnerAsync(id,ct);return owner is null?null:await access.AuthorizeAsync(User,owner.Value,write,ct);} - [HttpPost("patients/{patientId:guid}/observations"),Authorize(Policy="Patient")] - public async Task Record(Guid patientId,RecordObservationRequest r,CancellationToken ct){var scope=await access.AuthorizeAsync(User,patientId,true,ct);if(scope is null)return Unavailable();var o=await commands.RecordAsync(scope,r,ct);await tx.FinishAsync(ct);return o is null?NotFound():Created($"/api/observations/{o.ObservationId}",o);} - [HttpGet("observations/{observationId:guid}")] - public async Task Get(Guid observationId,CancellationToken ct){var scope=await Owner(observationId,false,ct);if(scope is null)return Unavailable();var o=await queries.GetAsync(scope,observationId,ct);await tx.FinishAsync(ct);return o is null?NotFound():Ok(o);} - [HttpPut("observations/{observationId:guid}"),Authorize(Policy="Patient")] - public Task Put(Guid observationId,UpdateObservationRequest r,CancellationToken ct)=>Patch(observationId,new PatchObservationRequest{Systolic=r.Systolic,Diastolic=r.Diastolic,Pulse=r.Pulse},ct); - [HttpPatch("observations/{observationId:guid}"),Authorize(Policy="Patient")] - public async Task Patch(Guid observationId,PatchObservationRequest r,CancellationToken ct){var scope=await Owner(observationId,true,ct);if(scope is null)return Unavailable();var o=await commands.PatchAsync(scope,observationId,r,ct);await tx.FinishAsync(ct);return o is null?NotFound():Ok(o);} - [HttpDelete("observations/{observationId:guid}"),Authorize(Policy="Patient")] - public async Task Delete(Guid observationId,CancellationToken ct){var scope=await Owner(observationId,true,ct);if(scope is null)return Unavailable();var found=await commands.DeleteAsync(scope,observationId,ct);await tx.FinishAsync(ct);return found?NoContent():NotFound();} - [HttpGet("patients/{patientId:guid}/observations/latest")] - public async Task Latest(Guid patientId,CancellationToken ct){var scope=await access.AuthorizeAsync(User,patientId,false,ct);if(scope is null)return Unavailable();var o=await queries.LatestAsync(scope,ct);await tx.FinishAsync(ct);return o is null?NotFound():Ok(o);} - [HttpGet("patients/{patientId:guid}/observations")] - public async Task History(Guid patientId,[FromQuery,BindRequired]DateTime from,[FromQuery,BindRequired]DateTime to,[FromQuery]ContextSelection selection,CancellationToken ct) - { - var scope=await access.AuthorizeAsync(User,patientId,false,ct);if(scope is null)return Unavailable(); - try{var series=await queries.SelectedAsync(scope,from,to,selection,ct);await tx.FinishAsync(ct);Response.Headers["X-Measurement-Setting"]=selection.Setting??"All";Response.Headers["X-Activity-Condition"]=selection.ActivityCondition??"All";return Ok(series);} - catch(ArgumentException){ModelState.AddModelError(nameof(to),"The end time must not be earlier than the start time.");return ValidationProblem(ModelState);} - } +[ApiController, Route("api")] +public sealed class ObservationController(ObservationQueries queries, ObservationCommands commands, AccessPolicy access, RequestTransaction tx) : ControllerBase +{ + private IActionResult Unavailable() { Response.StatusCode = 404; return new EmptyResult(); } + + private async Task Owner(Guid id, bool write, CancellationToken ct) { var owner = await queries.ResolveOwnerAsync(id, ct); return owner is null ? null : await access.AuthorizeAsync(User, owner.Value, write, ct); } + [HttpPost("patients/{patientId:guid}/observations"), Authorize(Policy = "Patient")] + public async Task Record(Guid patientId, RecordObservationRequest r, CancellationToken ct) { var scope = await access.AuthorizeAsync(User, patientId, true, ct); if (scope is null) return Unavailable(); var o = await commands.RecordAsync(scope, r, ct); await tx.FinishAsync(ct); return o is null ? NotFound() : Created($"/api/observations/{o.ObservationId}", o); } + [HttpGet("observations/{observationId:guid}")] + public async Task Get(Guid observationId, CancellationToken ct) { var scope = await Owner(observationId, false, ct); if (scope is null) return Unavailable(); var o = await queries.GetAsync(scope, observationId, ct); await tx.FinishAsync(ct); return o is null ? NotFound() : Ok(o); } + [HttpPut("observations/{observationId:guid}"), Authorize(Policy = "Patient")] + public Task Put(Guid observationId, UpdateObservationRequest r, CancellationToken ct) => Patch(observationId, new PatchObservationRequest { Systolic = r.Systolic, Diastolic = r.Diastolic, Pulse = r.Pulse }, ct); + [HttpPatch("observations/{observationId:guid}"), Authorize(Policy = "Patient")] + public async Task Patch(Guid observationId, PatchObservationRequest r, CancellationToken ct) { var scope = await Owner(observationId, true, ct); if (scope is null) return Unavailable(); var o = await commands.PatchAsync(scope, observationId, r, ct); await tx.FinishAsync(ct); return o is null ? NotFound() : Ok(o); } + [HttpDelete("observations/{observationId:guid}"), Authorize(Policy = "Patient")] + public async Task Delete(Guid observationId, CancellationToken ct) { var scope = await Owner(observationId, true, ct); if (scope is null) return Unavailable(); var found = await commands.DeleteAsync(scope, observationId, ct); await tx.FinishAsync(ct); return found ? NoContent() : NotFound(); } + [HttpGet("patients/{patientId:guid}/observations/latest")] + public async Task Latest(Guid patientId, CancellationToken ct) { var scope = await access.AuthorizeAsync(User, patientId, false, ct); if (scope is null) return Unavailable(); var o = await queries.LatestAsync(scope, ct); await tx.FinishAsync(ct); return o is null ? NotFound() : Ok(o); } + [HttpGet("patients/{patientId:guid}/observations")] + public async Task History(Guid patientId, [FromQuery, BindRequired] DateTime from, [FromQuery, BindRequired] DateTime to, [FromQuery] ContextSelection selection, CancellationToken ct) + { + var scope = await access.AuthorizeAsync(User, patientId, false, ct); if (scope is null) return Unavailable(); + try { var series = await queries.SelectedAsync(scope, from, to, selection, ct); await tx.FinishAsync(ct); Response.Headers["X-Measurement-Setting"] = selection.Setting ?? "All"; Response.Headers["X-Activity-Condition"] = selection.ActivityCondition ?? "All"; return Ok(series); } + catch (ArgumentException) { ModelState.AddModelError(nameof(to), "The end time must not be earlier than the start time."); return ValidationProblem(ModelState); } + } } diff --git a/src/HealthApp/Controllers/PatientController.cs b/src/HealthApp/Controllers/PatientController.cs index f87b76d..d58876a 100644 --- a/src/HealthApp/Controllers/PatientController.cs +++ b/src/HealthApp/Controllers/PatientController.cs @@ -5,27 +5,28 @@ using HealthApp.Security; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace HealthApp.Controllers; -[ApiController,Route("api/patients")] -public sealed class PatientController(ProfileQueries queries,ProfileCommands commands,AccessPolicy access,RequestTransaction tx) : ControllerBase -{ - private IActionResult Unavailable(){Response.StatusCode=404;return new EmptyResult();} - [HttpPost,Authorize(Policy="Patient")] - public async Task Create(CreatePatientRequest r,CancellationToken ct) - { - try{var p=await commands.CreateAsync(User.FindFirstValue(ClaimTypes.NameIdentifier)!,r,ct);await tx.FinishAsync(ct);return Created($"/api/patients/{p.PatientId}",p);} - catch(ProfileAlreadyExistsException){return Conflict(new{title="A profile already exists for this account."});} - } - [HttpGet("me"),Authorize(Policy="Patient")] - public async Task Me(CancellationToken ct) - { - var id=await queries.ResolveAccountAsync(User.FindFirstValue(ClaimTypes.NameIdentifier)!,ct);if(id is null)return NotFound(); - var scope=await access.AuthorizeAsync(User,id.Value,false,ct);var p=await queries.GetAsync(scope!,ct);await tx.FinishAsync(ct);return p is null?NotFound():Ok(p); - } - [HttpGet("{patientId:guid}")] - public async Task Get(Guid patientId,CancellationToken ct) - {var scope=await access.AuthorizeAsync(User,patientId,false,ct);if(scope is null)return Unavailable();var p=await queries.GetAsync(scope,ct);await tx.FinishAsync(ct);return p is null?NotFound():Ok(p);} - [HttpPut("{patientId:guid}"),Authorize(Policy="Patient")] - public async Task Update(Guid patientId,UpdatePatientRequest r,CancellationToken ct) - {var scope=await access.AuthorizeAsync(User,patientId,true,ct);if(scope is null)return Unavailable();var p=await commands.UpdateAsync(scope,r,ct);await tx.FinishAsync(ct);return p is null?NotFound():Ok(p);} +[ApiController, Route("api/patients")] +public sealed class PatientController(ProfileQueries queries, ProfileCommands commands, AccessPolicy access, RequestTransaction tx) : ControllerBase +{ + private IActionResult Unavailable() { Response.StatusCode = 404; return new EmptyResult(); } + + [HttpPost, Authorize(Policy = "Patient")] + public async Task Create(CreatePatientRequest r, CancellationToken ct) + { + try { var p = await commands.CreateAsync(User.FindFirstValue(ClaimTypes.NameIdentifier)!, r, ct); await tx.FinishAsync(ct); return Created($"/api/patients/{p.PatientId}", p); } + catch (ProfileAlreadyExistsException) { return Conflict(new { title = "A profile already exists for this account." }); } + } + [HttpGet("me"), Authorize(Policy = "Patient")] + public async Task Me(CancellationToken ct) + { + var id = await queries.ResolveAccountAsync(User.FindFirstValue(ClaimTypes.NameIdentifier)!, ct); if (id is null) return NotFound(); + var scope = await access.AuthorizeAsync(User, id.Value, false, ct); var p = await queries.GetAsync(scope!, ct); await tx.FinishAsync(ct); return p is null ? NotFound() : Ok(p); + } + [HttpGet("{patientId:guid}")] + public async Task Get(Guid patientId, CancellationToken ct) + { var scope = await access.AuthorizeAsync(User, patientId, false, ct); if (scope is null) return Unavailable(); var p = await queries.GetAsync(scope, ct); await tx.FinishAsync(ct); return p is null ? NotFound() : Ok(p); } + [HttpPut("{patientId:guid}"), Authorize(Policy = "Patient")] + public async Task Update(Guid patientId, UpdatePatientRequest r, CancellationToken ct) + { var scope = await access.AuthorizeAsync(User, patientId, true, ct); if (scope is null) return Unavailable(); var p = await commands.UpdateAsync(scope, r, ct); await tx.FinishAsync(ct); return p is null ? NotFound() : Ok(p); } } diff --git a/src/HealthApp/Program.cs b/src/HealthApp/Program.cs index 1179e4b..a19840b 100644 --- a/src/HealthApp/Program.cs +++ b/src/HealthApp/Program.cs @@ -11,69 +11,79 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Authentication.BearerToken; namespace HealthApp; + public class Program { - public static async Task Main(string[] args) - { - var builder = WebApplication.CreateBuilder(args); - builder.Logging.AddFilter("Microsoft.AspNetCore",LogLevel.Warning); - builder.Logging.AddFilter("Microsoft.EntityFrameworkCore",LogLevel.None); - builder.Services.AddControllers(o=>o.Filters.Add()); - builder.Services.AddSingleton(); - builder.Services.AddProblemDetails(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton();builder.Services.AddSingleton();builder.Services.AddAnalytics();builder.Services.AddOverview(); - builder.Services.AddSingleton(sp=> { - var c=sp.GetRequiredService(); - var text=c.GetConnectionString("HealthDatabase"); - if(string.IsNullOrWhiteSpace(text))throw new InvalidOperationException("HealthDatabase connection is required."); - var options=new NpgsqlConnectionStringBuilder(text){Pooling=true,MaxPoolSize=c.GetValue("Resources:MaxPoolSize",32)}; - var local=options.Host is "localhost" or "127.0.0.1" or "::1" || options.Host?.StartsWith('/')==true; - if((c.GetValue("Database:Remote",false)||!local)&&options.SslMode!=SslMode.VerifyFull)throw new InvalidOperationException("Remote database requires verified TLS and hostname checking."); - return NpgsqlDataSource.Create(options.ConnectionString); - }); - builder.Services.AddScoped();builder.Services.AddProfile();builder.Services.AddObservations();builder.Services.AddScoped(); - builder.Services.AddDataProtection().SetApplicationName("HealthApp.ApiGateway"); - builder.Services.AddOptions().Configure((o,c,l)=> { - var keys=c["Authentication:KeyDirectory"]; - if(string.IsNullOrWhiteSpace(keys)) throw new InvalidOperationException("Authentication:KeyDirectory is required."); - o.XmlRepository=new Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository(new DirectoryInfo(keys),l); - }); - builder.Services.AddAuthentication("Bearer").AddBearerToken("Bearer",o=>o.BearerTokenExpiration=TimeSpan.FromMinutes(builder.Configuration.GetValue("Authentication:TokenLifetimeMinutes",30))); - builder.Services.AddAuthorization(o=> { - o.FallbackPolicy=new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); - foreach(var role in new[]{"Patient","HealthcareProfessional"}) o.AddPolicy(role,p=>p.RequireRole(role).RequireClaim(System.Security.Claims.ClaimTypes.NameIdentifier)); - }); - var app=builder.Build(); - var lifetime=app.Configuration.GetValue("Authentication:TokenLifetimeMinutes",30); - if(lifetime is <=0 or >1440)throw new InvalidOperationException("Invalid token lifetime."); - if(string.IsNullOrWhiteSpace(app.Configuration["Authentication:KeyDirectory"]))throw new InvalidOperationException("Authentication:KeyDirectory is required."); - _=app.Services.GetRequiredService(); - if(app.Configuration.GetValue("Resources:RequestDeadlineSeconds",30d)<=0)throw new InvalidOperationException("Request deadline must be positive."); - if(!string.IsNullOrWhiteSpace(app.Configuration.GetConnectionString("HealthDatabase")))_=app.Services.GetRequiredService(); - _=app.Services.GetRequiredService(); - _=app.Services.GetRequiredService(); - app.UseExceptionHandler(); - app.Use(async(ctx,next)=> { - if(!app.Environment.IsDevelopment() && !ctx.Request.IsHttps){ctx.Response.StatusCode=400;return;} - if(!ctx.Request.Path.StartsWithSegments("/api/measurement-guidance"))ctx.Response.Headers.CacheControl="no-store"; - await next(ctx); - }); - app.UseAuthentication();app.UseAuthorization(); - app.UseMiddleware(); - app.MapControllers(); - app.MapGet("/health/live",()=>Results.Ok(new{status="live"})).RequireAuthorization(); - app.MapGet("/health/ready",async (HttpContext ctx)=>{ - try{ - _=ctx.RequestServices.GetRequiredService().CreateProtector("readiness").Protect("probe"); - var catalog=ctx.RequestServices.GetRequiredService(); - if(string.IsNullOrWhiteSpace(catalog.Version))return Results.StatusCode(503); - await using var connection=await ctx.RequestServices.GetRequiredService().OpenConnectionAsync(ctx.RequestAborted); - await using var command=new NpgsqlCommand("SELECT (SELECT max(version) FROM profile.schema_version)=1 AND (SELECT max(version) FROM observations.schema_version)=1",connection); - return await command.ExecuteScalarAsync(ctx.RequestAborted) is true?Results.Ok(new{status="ready"}):Results.StatusCode(503); - }catch(NpgsqlException){return Results.StatusCode(503);} - }).RequireAuthorization(); - await app.RunAsync(); - } + public static async Task Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + var configurationFile = Environment.GetEnvironmentVariable("HEALTHAPP_CONFIGURATION_FILE"); + if (!string.IsNullOrWhiteSpace(configurationFile)) builder.Configuration.AddJsonFile(configurationFile, optional: false, reloadOnChange: false); + builder.Logging.AddFilter("Microsoft.AspNetCore", LogLevel.Warning); + builder.Logging.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.None); + builder.Services.AddControllers(o => o.Filters.Add()); + builder.Services.AddSingleton(); + builder.Services.AddProblemDetails(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddAnalytics(); builder.Services.AddOverview(); + builder.Services.AddSingleton(sp => + { + var c = sp.GetRequiredService(); + var text = c.GetConnectionString("HealthDatabase"); + if (string.IsNullOrWhiteSpace(text)) throw new InvalidOperationException("HealthDatabase connection is required."); + var options = new NpgsqlConnectionStringBuilder(text) { Pooling = true, MaxPoolSize = c.GetValue("Resources:MaxPoolSize", 32) }; + var local = options.Host is "localhost" or "127.0.0.1" or "::1" || options.Host?.StartsWith('/') == true; + if ((c.GetValue("Database:Remote", false) || !local) && options.SslMode != SslMode.VerifyFull) throw new InvalidOperationException("Remote database requires verified TLS and hostname checking."); + return NpgsqlDataSource.Create(options.ConnectionString); + }); + builder.Services.AddScoped(); builder.Services.AddProfile(); builder.Services.AddObservations(); builder.Services.AddScoped(); + builder.Services.AddDataProtection().SetApplicationName("HealthApp.ApiGateway"); + builder.Services.AddOptions().Configure((o, c, l) => + { + var keys = c["Authentication:KeyDirectory"]; + if (string.IsNullOrWhiteSpace(keys)) throw new InvalidOperationException("Authentication:KeyDirectory is required."); + o.XmlRepository = new Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository(new DirectoryInfo(keys), l); + }); + builder.Services.AddAuthentication("Bearer").AddBearerToken("Bearer", o => o.BearerTokenExpiration = TimeSpan.FromMinutes(builder.Configuration.GetValue("Authentication:TokenLifetimeMinutes", 30))); + builder.Services.AddAuthorization(o => + { + o.FallbackPolicy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); + foreach (var role in new[] { "Patient", "HealthcareProfessional" }) o.AddPolicy(role, p => p.RequireRole(role).RequireClaim(System.Security.Claims.ClaimTypes.NameIdentifier)); + }); + var app = builder.Build(); + var lifetime = app.Configuration.GetValue("Authentication:TokenLifetimeMinutes", 30); + if (lifetime is <= 0 or > 1440) throw new InvalidOperationException("Invalid token lifetime."); + if (string.IsNullOrWhiteSpace(app.Configuration["Authentication:KeyDirectory"])) throw new InvalidOperationException("Authentication:KeyDirectory is required."); + _ = app.Services.GetRequiredService(); + if (app.Configuration.GetValue("Resources:RequestDeadlineSeconds", 30d) <= 0) throw new InvalidOperationException("Request deadline must be positive."); + if (!string.IsNullOrWhiteSpace(app.Configuration.GetConnectionString("HealthDatabase"))) _ = app.Services.GetRequiredService(); + _ = app.Services.GetRequiredService(); + _ = app.Services.GetRequiredService(); + app.UseExceptionHandler(); + app.Use(async (ctx, next) => + { + if (!app.Environment.IsDevelopment() && !ctx.Request.IsHttps) { ctx.Response.StatusCode = 400; return; } + if (!ctx.Request.Path.StartsWithSegments("/api/measurement-guidance")) ctx.Response.Headers.CacheControl = "no-store"; + await next(ctx); + }); + app.UseAuthentication(); app.UseAuthorization(); + app.UseMiddleware(); + app.MapControllers(); + app.MapGet("/health/live", () => Results.Ok(new { status = "live" })).RequireAuthorization(); + app.MapGet("/health/ready", async (HttpContext ctx) => + { + try + { + _ = ctx.RequestServices.GetRequiredService().CreateProtector("readiness").Protect("probe"); + var catalog = ctx.RequestServices.GetRequiredService(); + if (string.IsNullOrWhiteSpace(catalog.Version)) return Results.StatusCode(503); + await using var connection = await ctx.RequestServices.GetRequiredService().OpenConnectionAsync(ctx.RequestAborted); + await using var command = new NpgsqlCommand("SELECT (SELECT max(version) FROM profile.schema_version)=1 AND (SELECT max(version) FROM observations.schema_version)=1", connection); + return await command.ExecuteScalarAsync(ctx.RequestAborted) is true ? Results.Ok(new { status = "ready" }) : Results.StatusCode(503); + } + catch (NpgsqlException) { return Results.StatusCode(503); } + }).RequireAuthorization(); + await app.RunAsync(); + } } diff --git a/src/HealthApp/Security/AccessPolicy.cs b/src/HealthApp/Security/AccessPolicy.cs index 81e6791..9c2bd2b 100644 --- a/src/HealthApp/Security/AccessPolicy.cs +++ b/src/HealthApp/Security/AccessPolicy.cs @@ -1,12 +1,13 @@ using System.Security.Claims; using HealthApp.Contracts; namespace HealthApp.Security; -public sealed class AccessPolicy(ProfileQueries profiles,ProfessionalAssignments assignments) + +public sealed class AccessPolicy(ProfileQueries profiles, ProfessionalAssignments assignments) { - public async Task AuthorizeAsync(ClaimsPrincipal user,Guid actualPatient,bool write,CancellationToken ct) - { - var account=user.FindFirstValue(ClaimTypes.NameIdentifier)!; - bool allowed=user.IsInRole("HealthcareProfessional") ? !write&&assignments.IsAssigned(account,actualPatient) : user.IsInRole("Patient")&&await profiles.ResolveAccountAsync(account,ct)==actualPatient; - return allowed?new AuthorizedPatientContext(actualPatient,write):null; - } + public async Task AuthorizeAsync(ClaimsPrincipal user, Guid actualPatient, bool write, CancellationToken ct) + { + var account = user.FindFirstValue(ClaimTypes.NameIdentifier)!; + bool allowed = user.IsInRole("HealthcareProfessional") ? !write && assignments.IsAssigned(account, actualPatient) : user.IsInRole("Patient") && await profiles.ResolveAccountAsync(account, ct) == actualPatient; + return allowed ? new AuthorizedPatientContext(actualPatient, write) : null; + } } diff --git a/src/HealthApp/Security/RequestBoundaryMiddleware.cs b/src/HealthApp/Security/RequestBoundaryMiddleware.cs index 745bc3f..6b208b8 100644 --- a/src/HealthApp/Security/RequestBoundaryMiddleware.cs +++ b/src/HealthApp/Security/RequestBoundaryMiddleware.cs @@ -4,68 +4,69 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Filters; using Npgsql; namespace HealthApp.Security; + public sealed class RequestAdmission(IConfiguration configuration) : IDisposable { - public SemaphoreSlim Health {get;}=new(Positive(configuration,"Resources:MaxConcurrentRequests",32)); - public SemaphoreSlim Assessment {get;}=new(Positive(configuration,"Resources:MaxConcurrentAssessments",4)); - private static int Positive(IConfiguration c,string key,int fallback) - {var value=c.GetValue(key,fallback);return value>0?value:throw new InvalidOperationException(key+" must be positive.");} - public void Dispose(){Health.Dispose();Assessment.Dispose();} + public SemaphoreSlim Health { get; } = new(Positive(configuration, "Resources:MaxConcurrentRequests", 32)); + public SemaphoreSlim Assessment { get; } = new(Positive(configuration, "Resources:MaxConcurrentAssessments", 4)); + private static int Positive(IConfiguration c, string key, int fallback) + { var value = c.GetValue(key, fallback); return value > 0 ? value : throw new InvalidOperationException(key + " must be positive."); } + public void Dispose() { Health.Dispose(); Assessment.Dispose(); } } public sealed class ReleaseTransactionFilter : IAsyncActionFilter { - public async Task OnActionExecutionAsync(ActionExecutingContext context,ActionExecutionDelegate next) - { - try{await next();} - finally{if(context.HttpContext.Items[typeof(RequestTransaction)] is RequestTransaction tx && tx.Active)await tx.DisposeAsync();} - } + public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) + { + try { await next(); } + finally { if (context.HttpContext.Items[typeof(RequestTransaction)] is RequestTransaction tx && tx.Active) await tx.DisposeAsync(); } + } } -public sealed class RequestBoundaryMiddleware(RequestDelegate next,RequestAdmission admission,IConfiguration configuration,ILogger logger) +public sealed class RequestBoundaryMiddleware(RequestDelegate next, RequestAdmission admission, IConfiguration configuration, ILogger logger) { - public async Task InvokeAsync(HttpContext ctx) - { - if(ctx.GetEndpoint() is null || ctx.GetEndpoint()!.Metadata.GetMetadata() is not null || ctx.Request.Path.StartsWithSegments("/api/professionals") || ctx.Request.Path.StartsWithSegments("/health")){await next(ctx);return;} - if(ctx.User.Identity?.IsAuthenticated!=true){await next(ctx);return;} - if(!ctx.User.IsInRole("Patient")&&!ctx.User.IsInRole("HealthcareProfessional")){ctx.Response.StatusCode=403;return;} - if(ctx.User.IsInRole("HealthcareProfessional")&&ctx.Request.Method!="GET"){ctx.Response.StatusCode=403;return;} - var assessment=ctx.Request.RouteValues["controller"]?.ToString() is "Insights" or "HealthOverview"; - if(!await admission.Health.WaitAsync(0,ctx.RequestAborted)){await Overloaded(ctx);return;} - var assessmentHeld=false; - var parent=ctx.RequestAborted; - using var deadline=CancellationTokenSource.CreateLinkedTokenSource(parent); - deadline.CancelAfter(TimeSpan.FromSeconds(configuration.GetValue("Resources:RequestDeadlineSeconds",30d))); - ctx.RequestAborted=deadline.Token; - RequestTransaction? tx=null; - try - { - if(assessment){assessmentHeld=await admission.Assessment.WaitAsync(0,deadline.Token);if(!assessmentHeld){await Overloaded(ctx);return;}} - tx=ctx.RequestServices.GetRequiredService();ctx.Items[typeof(RequestTransaction)]=tx; - var write=ctx.Request.Method!="GET";await tx.BeginAsync(write,deadline.Token); - Guid? actual=null; - if(Guid.TryParse(ctx.Request.RouteValues["patientId"]?.ToString(),out var patient))actual=patient; - else if(Guid.TryParse(ctx.Request.RouteValues["observationId"]?.ToString(),out var observation))actual=await ctx.RequestServices.GetRequiredService().ResolveOwnerAsync(observation,deadline.Token); - if(ctx.Request.RouteValues.ContainsKey("patientId")||ctx.Request.RouteValues.ContainsKey("observationId")) - { - var scope=actual is null?null:await ctx.RequestServices.GetRequiredService().AuthorizeAsync(ctx.User,actual.Value,write,deadline.Token); - if(scope is null){ctx.Response.StatusCode=404;return;} - } - await next(ctx); - } - catch(OperationCanceledException) when(parent.IsCancellationRequested){ctx.Abort();} - catch(OperationCanceledException){ctx.RequestAborted=parent;await Failure(ctx,504);} - catch(NpgsqlException e){ctx.RequestAborted=parent;await Failure(ctx,e.InnerException is TimeoutException?504:503);} - finally - { - if(tx is not null)await tx.DisposeAsync();ctx.RequestAborted=parent; - if(assessmentHeld)admission.Assessment.Release();admission.Health.Release(); - } - } - private Task Failure(HttpContext ctx,int status) - { - logger.LogWarning("Operation {Operation} failed with {Status}; correlation {Correlation}",ctx.Request.RouteValues["action"],status,ctx.TraceIdentifier); - if(ctx.Response.HasStarted){ctx.Abort();return Task.CompletedTask;} - ctx.Response.Clear();ctx.Response.Headers.CacheControl="no-store"; - return Results.Problem(statusCode:status,title:status==504?"Request deadline reached.":"Health data dependency is unavailable.").ExecuteAsync(ctx); - } - private static Task Overloaded(HttpContext ctx){ctx.Response.Headers.RetryAfter="1";ctx.Response.Headers.CacheControl="no-store";return Results.Problem(statusCode:503,title:"Request capacity is unavailable.").ExecuteAsync(ctx);} + public async Task InvokeAsync(HttpContext ctx) + { + if (ctx.GetEndpoint() is null || ctx.GetEndpoint()!.Metadata.GetMetadata() is not null || ctx.Request.Path.StartsWithSegments("/api/professionals") || ctx.Request.Path.StartsWithSegments("/health")) { await next(ctx); return; } + if (ctx.User.Identity?.IsAuthenticated != true) { await next(ctx); return; } + if (!ctx.User.IsInRole("Patient") && !ctx.User.IsInRole("HealthcareProfessional")) { ctx.Response.StatusCode = 403; return; } + if (ctx.User.IsInRole("HealthcareProfessional") && ctx.Request.Method != "GET") { ctx.Response.StatusCode = 403; return; } + var assessment = ctx.Request.RouteValues["controller"]?.ToString() is "Insights" or "HealthOverview"; + if (!await admission.Health.WaitAsync(0, ctx.RequestAborted)) { await Overloaded(ctx); return; } + var assessmentHeld = false; + var parent = ctx.RequestAborted; + using var deadline = CancellationTokenSource.CreateLinkedTokenSource(parent); + deadline.CancelAfter(TimeSpan.FromSeconds(configuration.GetValue("Resources:RequestDeadlineSeconds", 30d))); + ctx.RequestAborted = deadline.Token; + RequestTransaction? tx = null; + try + { + if (assessment) { assessmentHeld = await admission.Assessment.WaitAsync(0, deadline.Token); if (!assessmentHeld) { await Overloaded(ctx); return; } } + tx = ctx.RequestServices.GetRequiredService(); ctx.Items[typeof(RequestTransaction)] = tx; + var write = ctx.Request.Method != "GET"; await tx.BeginAsync(write, deadline.Token); + Guid? actual = null; + if (Guid.TryParse(ctx.Request.RouteValues["patientId"]?.ToString(), out var patient)) actual = patient; + else if (Guid.TryParse(ctx.Request.RouteValues["observationId"]?.ToString(), out var observation)) actual = await ctx.RequestServices.GetRequiredService().ResolveOwnerAsync(observation, deadline.Token); + if (ctx.Request.RouteValues.ContainsKey("patientId") || ctx.Request.RouteValues.ContainsKey("observationId")) + { + var scope = actual is null ? null : await ctx.RequestServices.GetRequiredService().AuthorizeAsync(ctx.User, actual.Value, write, deadline.Token); + if (scope is null) { ctx.Response.StatusCode = 404; return; } + } + await next(ctx); + } + catch (OperationCanceledException) when (parent.IsCancellationRequested) { ctx.Abort(); } + catch (OperationCanceledException) { ctx.RequestAborted = parent; await Failure(ctx, 504); } + catch (NpgsqlException e) { ctx.RequestAborted = parent; await Failure(ctx, e.InnerException is TimeoutException ? 504 : 503); } + finally + { + if (tx is not null) await tx.DisposeAsync(); ctx.RequestAborted = parent; + if (assessmentHeld) admission.Assessment.Release(); admission.Health.Release(); + } + } + private Task Failure(HttpContext ctx, int status) + { + logger.LogWarning("Operation {Operation} failed with {Status}; correlation {Correlation}", ctx.Request.RouteValues["action"], status, ctx.TraceIdentifier); + if (ctx.Response.HasStarted) { ctx.Abort(); return Task.CompletedTask; } + ctx.Response.Clear(); ctx.Response.Headers.CacheControl = "no-store"; + return Results.Problem(statusCode: status, title: status == 504 ? "Request deadline reached." : "Health data dependency is unavailable.").ExecuteAsync(ctx); + } + private static Task Overloaded(HttpContext ctx) { ctx.Response.Headers.RetryAfter = "1"; ctx.Response.Headers.CacheControl = "no-store"; return Results.Problem(statusCode: 503, title: "Request capacity is unavailable.").ExecuteAsync(ctx); } } diff --git a/src/Modules/Analytics/AnalyticsFacade.cs b/src/Modules/Analytics/AnalyticsFacade.cs index 68fd70d..b55327b 100644 --- a/src/Modules/Analytics/AnalyticsFacade.cs +++ b/src/Modules/Analytics/AnalyticsFacade.cs @@ -2,24 +2,33 @@ using HealthApp.Contracts; using HealthApp.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace HealthApp.Analytics; -internal sealed class AnalyticsFacade(ObservationQueries observations,RequestTransaction tx,SummaryPolicy summary,TrendPolicy trend) : AnalyticsQueries + +internal sealed class AnalyticsFacade(ObservationQueries observations, RequestTransaction tx, SummaryPolicy summary, TrendPolicy trend) : AnalyticsQueries { - public async Task InsightAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct) - {var series=await observations.SelectedAsync(scope,from,to,selection,ct);await tx.FinishAsync(ct);ct.ThrowIfCancellationRequested();return summary.CalculateSummary(scope.PatientId,MeasurementPeriod.Normalize(from),MeasurementPeriod.Normalize(to),series,selection);} - public async Task TrendAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct) - {var series=await observations.SelectedAsync(scope,from,to,selection,ct);await tx.FinishAsync(ct);ct.ThrowIfCancellationRequested();return trend.CalculateTrend(scope.PatientId,MeasurementPeriod.Normalize(from),MeasurementPeriod.Normalize(to),series,selection);} + public async Task InsightAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct) + { + var series = await observations.SelectedAsync(scope, from, to, selection, ct); await tx.FinishAsync(ct); ct.ThrowIfCancellationRequested(); var result = summary.CalculateSummary(scope.PatientId, MeasurementPeriod.Normalize(from), MeasurementPeriod.Normalize(to), series, selection); + ct.ThrowIfCancellationRequested(); + return result; + } + public async Task TrendAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct) + { + var series = await observations.SelectedAsync(scope, from, to, selection, ct); await tx.FinishAsync(ct); ct.ThrowIfCancellationRequested(); var result = trend.CalculateTrend(scope.PatientId, MeasurementPeriod.Normalize(from), MeasurementPeriod.Normalize(to), series, selection); + ct.ThrowIfCancellationRequested(); + return result; + } } public static class AnalyticsModule { - public static IServiceCollection AddAnalytics(this IServiceCollection s) - {s.AddSingleton();s.AddSingleton();s.AddSingleton();s.AddScoped();return s;} + public static IServiceCollection AddAnalytics(this IServiceCollection s) + { s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); s.AddScoped(); return s; } } // Test-only-compatible calculation entry, internal to the module; no public repository/SQL access. internal sealed class InsightCalculator { - private readonly SummaryPolicy summary=new(); - private readonly TrendPolicy trend; - internal InsightCalculator(ReferenceCatalog catalog){trend=new(new ClinicalPolicy(catalog));} - public HealthInsight? CalculateSummary(Guid patientId,DateTime from,DateTime to,IReadOnlyList observations,ContextSelection selection)=>summary.CalculateSummary(patientId,from,to,observations,selection); - public TrendAssessment CalculateTrend(Guid patientId,DateTime from,DateTime to,IReadOnlyList observations,ContextSelection selection)=>trend.CalculateTrend(patientId,from,to,observations,selection); + private readonly SummaryPolicy summary = new(); + private readonly TrendPolicy trend; + internal InsightCalculator(ReferenceCatalog catalog) { trend = new(new ClinicalPolicy(catalog)); } + public HealthInsight? CalculateSummary(Guid patientId, DateTime from, DateTime to, IReadOnlyList observations, ContextSelection selection) => summary.CalculateSummary(patientId, from, to, observations, selection); + public TrendAssessment CalculateTrend(Guid patientId, DateTime from, DateTime to, IReadOnlyList observations, ContextSelection selection) => trend.CalculateTrend(patientId, from, to, observations, selection); } diff --git a/src/Modules/Analytics/AssemblyInfo.cs b/src/Modules/Analytics/AssemblyInfo.cs index f136d84..db382ed 100644 --- a/src/Modules/Analytics/AssemblyInfo.cs +++ b/src/Modules/Analytics/AssemblyInfo.cs @@ -1,2 +1,2 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("HealthApp.AcceptanceTests")] +[assembly: InternalsVisibleTo("HealthApp.AcceptanceTests")] diff --git a/src/Modules/Analytics/ClinicalPolicy.cs b/src/Modules/Analytics/ClinicalPolicy.cs index ec69f97..25bb148 100644 --- a/src/Modules/Analytics/ClinicalPolicy.cs +++ b/src/Modules/Analytics/ClinicalPolicy.cs @@ -1,14 +1,15 @@ using System.Globalization; using HealthApp.Contracts; namespace HealthApp.Analytics; + internal sealed class ClinicalPolicy(ReferenceCatalog catalog) { internal const string GeneralLimits = "General reference thresholds are not individual treatment targets. " + "This is a descriptive assessment, not a diagnosis or medication recommendation. " + "Symptoms, treatment, training, risk factors and measurement technique are not established by these observations."; - internal (ClinicalReference? Reference,string Comparison,string Interpretation,string Hint) Apply(string metric,string unit,IReadOnlyList observations,ComparabilityAssessment comparability,(DateTime Time,decimal Value)[] points,string direction,int reversals,decimal mean,Func value) - { + internal (ClinicalReference? Reference, string Comparison, string Interpretation, string Hint) Apply(string metric, string unit, IReadOnlyList observations, ComparabilityAssessment comparability, (DateTime Time, decimal Value)[] points, string direction, int reversals, decimal mean, Func value) + { var reference = SelectReference(metric, observations, comparability); var comparison = "Unavailable: known, non-conflicting resting conditions" + (metric == "Pulse" ? "" : " and a single Home or Clinic setting") + " are required; recorded inadequate preparation also limits applicability."; @@ -64,8 +65,8 @@ internal sealed class ClinicalPolicy(ReferenceCatalog catalog) "missing or differing conditions limit interpretation of the combined trajectory. ") + "An outside-reference value is not dismissed because preparation information is incomplete."; } - return (reference,comparison,interpretation,hint); - } + return (reference, comparison, interpretation, hint); + } private ClinicalReference? SelectReference(string metric, IReadOnlyList observations, ComparabilityAssessment comparability) { @@ -79,7 +80,7 @@ internal sealed class ClinicalPolicy(ReferenceCatalog catalog) if (observations.Any(o => !string.IsNullOrWhiteSpace(o.MeasurementContext?.BodyPosition) && !new[] { "seated", "sitting", "siddende" }.Contains(o.MeasurementContext!.BodyPosition!.Trim(), StringComparer.OrdinalIgnoreCase))) return null; - return catalog.Pressure(metric,settings[0]!); + return catalog.Pressure(metric, settings[0]!); } private static bool IsHigh(decimal value, ClinicalReference reference) => diff --git a/src/Modules/Analytics/TrendPolicy.cs b/src/Modules/Analytics/TrendPolicy.cs index 2c68fd3..e004d51 100644 --- a/src/Modules/Analytics/TrendPolicy.cs +++ b/src/Modules/Analytics/TrendPolicy.cs @@ -5,7 +5,8 @@ namespace HealthApp.Analytics; internal sealed class TrendPolicy(ClinicalPolicy clinical) { - private const string GeneralLimits=ClinicalPolicy.GeneralLimits; + internal const string MethodVersion = "baseline-2026-10-05"; + private const string GeneralLimits = ClinicalPolicy.GeneralLimits; public TrendAssessment CalculateTrend(Guid patientId, DateTime from, DateTime to, IReadOnlyList observations, ContextSelection selection) @@ -62,8 +63,8 @@ internal sealed class TrendPolicy(ClinicalPolicy clinical) $"Total successive change is {Format(totalChange!.Value)} {unit}.") + " Range and successive change describe observed variation; no clinical stability classification is made."; - var result = clinical.Apply(metric,unit,observations,comparability,points,direction,reversals,mean,value); - var reference=result.Reference;var comparison=result.Comparison;var interpretation=result.Interpretation;var hint=result.Hint; + var result = clinical.Apply(metric, unit, observations, comparability, points, direction, reversals, mean, value); + var reference = result.Reference; var comparison = result.Comparison; var interpretation = result.Interpretation; var hint = result.Hint; return new(metric, unit, Round(mean), minimum, maximum, maximum - minimum, points.Length, direction, overall, slope is { } s ? Math.Round(s, 6, MidpointRounding.AwayFromZero) : null, reversals, totalChange is { } change ? Round(change) : null, numerical, reference, diff --git a/src/Modules/Guidance/GuidanceQueries.cs b/src/Modules/Guidance/GuidanceQueries.cs index dbfb6b8..de1847d 100644 --- a/src/Modules/Guidance/GuidanceQueries.cs +++ b/src/Modules/Guidance/GuidanceQueries.cs @@ -3,6 +3,7 @@ namespace HealthApp.Guidance; // Content preserved from the pinned baseline; no new clinical review is implied. public sealed class GuidanceQueries { + public const string Version = "baseline-2026-10-04"; public object Get(string? setting, string? activityCondition) { var requestedSetting = string.IsNullOrWhiteSpace(setting) ? "Unknown" : setting.Trim(); diff --git a/src/Modules/Guidance/ReviewedReferenceCatalog.cs b/src/Modules/Guidance/ReviewedReferenceCatalog.cs index daa1aa8..5306f13 100644 --- a/src/Modules/Guidance/ReviewedReferenceCatalog.cs +++ b/src/Modules/Guidance/ReviewedReferenceCatalog.cs @@ -3,21 +3,36 @@ namespace HealthApp.Guidance; // Pinned content and thresholds; this relocation does not imply a new clinical review. public sealed class ReviewedReferenceCatalog : ReferenceCatalog { - public string Version=>"baseline-2026-10-05"; - public ClinicalReference Pulse() - { - return new("Recorded resting pulse", 50, "<", 100, ">", - [new("Patienthåndbogen: Bradykardi (langsom puls)", + public string Version => "baseline-2026-10-05"; + public IReadOnlyList Claims { get; } = Array.AsReadOnly(new[] + { + new ClinicalRuleProvenance("Systolic/Diastolic", "Setting-specific reference comparison", + "All recorded AtRest, one Home/Clinic setting, no detected conflicts; recorded rest below five minutes or non-seated position blocks the comparison", + "Compare raw levels with the cited inclusive high boundary; missing irrelevant optional detail does not suppress provisional comparison; no individual target or diagnosis", + "Baseline sources reviewed 2026-10-05; no new clinical review"), + new ClinicalRuleProvenance("Pulse", "Resting rate reference comparison", + "All recorded AtRest and no detected narrative conflicts; BP-specific preparation does not gate pulse", + "Compare raw resting rates below 50 or above 100 using exclusive limits; no rhythm diagnosis or universal healthy range", + "Baseline sources reviewed 2026-10-05; no new clinical review"), + new ClinicalRuleProvenance("Systolic/Diastolic/Pulse", "Development classification", + "At least two distinct instants, applicable reference, SupportedRecordedComparability; exact preserved ClinicalPolicy branches govern reversals and opposite-boundary excursions", + "Only the baseline PotentiallyFavourable/PotentiallyConcerning/Mixed/CannotInterpret branches; no blanket interpretation from numerical sign or range", + "Preserved cautious baseline inference; independent domain validity remains unverified") + }); + public ClinicalReference Pulse() + { + return new("Recorded resting pulse", 50, "<", 100, ">", + [new("Patienthåndbogen: Bradykardi (langsom puls)", "https://www.sundhed.dk/borger/patienthaandbogen/hjerte-og-blodkar/sygdomme/hjertearytmier/bradykardi-langsom-puls/", "2025-09-02", "2026-10-05"), new("Patienthåndbogen: Hurtig puls (takykardi)", "https://www.sundhed.dk/borger/patienthaandbogen/hjerte-og-blodkar/sygdomme/hjertearytmier/takykardier-hurtig-puls/", "2025-05-12", "2026-10-05")], - "These are resting-rate reference boundaries, not a diagnosis, a universal normal range or a treatment target. " + - "Low pulse can be physiological in trained people; age, fitness, symptoms and medicines affect applicability."); - } - public ClinicalReference Pressure(string metric,string setting) - { + "These are resting-rate reference boundaries, not a diagnosis, a universal normal range or a treatment target. " + + "Low pulse can be physiological in trained people; age, fitness, symptoms and medicines affect applicability."); + } + public ClinicalReference Pressure(string metric, string setting) + { var threshold = metric == "Systolic" ? (setting == "Home" ? 135 : 140) : (setting == "Home" ? 85 : 90); return new($"Recorded {setting} resting blood pressure", null, null, threshold, ">=", @@ -27,5 +42,5 @@ public sealed class ReviewedReferenceCatalog : ReferenceCatalog "Setting-specific high-pressure reference threshold. Missing preparation details make this comparison provisional; " + "five minutes of rest, appropriate technique and repeated measurements are not inferred. " + "Being below a high-pressure threshold does not establish an appropriate lower level or a personalised goal."); - } + } } diff --git a/src/Modules/Observations/AssemblyInfo.cs b/src/Modules/Observations/AssemblyInfo.cs index f136d84..db382ed 100644 --- a/src/Modules/Observations/AssemblyInfo.cs +++ b/src/Modules/Observations/AssemblyInfo.cs @@ -1,2 +1,2 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("HealthApp.AcceptanceTests")] +[assembly: InternalsVisibleTo("HealthApp.AcceptanceTests")] diff --git a/src/Modules/Observations/ObservationFacade.cs b/src/Modules/Observations/ObservationFacade.cs index 95fee05..2a4fa54 100644 --- a/src/Modules/Observations/ObservationFacade.cs +++ b/src/Modules/Observations/ObservationFacade.cs @@ -6,34 +6,35 @@ using HealthApp.Observations.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace HealthApp.Observations; -internal sealed class ObservationFacade(ObservationDbContext db,RequestTransaction tx,ProfileQueries profiles) : ObservationQueries,ObservationCommands + +internal sealed class ObservationFacade(ObservationDbContext db, RequestTransaction tx, ProfileQueries profiles) : ObservationQueries, ObservationCommands { - public async Task ResolveOwnerAsync(Guid id,CancellationToken ct){await tx.EnlistAsync(db,ct);return await db.Observations.AsNoTracking().Where(o=>o.ObservationId==id).Select(o=>(Guid?)o.PatientId).SingleOrDefaultAsync(ct);} - public async Task GetAsync(AuthorizedPatientContext scope,Guid id,CancellationToken ct){await tx.EnlistAsync(db,ct);var o=await db.Observations.AsNoTracking().SingleOrDefaultAsync(o=>o.ObservationId==id&&o.PatientId==scope.PatientId,ct);return o is null?null:Dto(o);} - public async Task LatestAsync(AuthorizedPatientContext scope,CancellationToken ct){await tx.EnlistAsync(db,ct);var o=await db.Observations.AsNoTracking().Where(o=>o.PatientId==scope.PatientId).OrderByDescending(o=>o.MeasuredAt).ThenByDescending(o=>o.CreatedAt).ThenByDescending(o=>o.ObservationId).FirstOrDefaultAsync(ct);return o is null?null:Dto(o);} - public async Task> SelectedAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct) - { - from=MeasurementPeriod.Normalize(from);to=MeasurementPeriod.Normalize(to);MeasurementPeriod.Validate(from,to);Validator.ValidateObject(selection,new ValidationContext(selection),true);await tx.EnlistAsync(db,ct); - var q=db.Observations.AsNoTracking().Where(o=>o.PatientId==scope.PatientId&&o.MeasuredAt>=from&&o.MeasuredAt<=to); - if(selection.Setting is not null)q=q.Where(o=>o.MeasurementContext.Setting==selection.Setting); - if(selection.ActivityCondition is not null)q=q.Where(o=>o.MeasurementContext.ActivityCondition==selection.ActivityCondition); - return Array.AsReadOnly((await q.OrderBy(o=>o.MeasuredAt).ThenBy(o=>o.ObservationId).ToListAsync(ct)).Select(Dto).ToArray()); - } - public async Task RecordAsync(AuthorizedPatientContext scope,RecordObservationRequest request,CancellationToken ct) - { - scope.RequireWrite();Validator.ValidateObject(request,new ValidationContext(request),true); - var context=request.MeasurementContext??new();context=context with{Setting=context.Setting??"Unknown",ActivityCondition=context.ActivityCondition??"Unknown"};Validator.ValidateObject(context,new ValidationContext(context),true); - if(await profiles.GetAsync(scope,ct) is null)return null;await tx.EnlistAsync(db,ct); - var now=DateTime.SpecifyKind(DateTime.UtcNow,DateTimeKind.Unspecified); - var o=new BloodPressureObservation{ObservationId=Guid.NewGuid(),PatientId=scope.PatientId,MeasuredAt=MeasurementPeriod.Normalize(request.MeasuredAt!.Value),Systolic=request.Systolic!.Value,Diastolic=request.Diastolic!.Value,Pulse=request.Pulse!.Value,MeasurementContext=context,Context=request.Context,Note=request.Note,CreatedAt=now,UpdatedAt=now};db.Observations.Add(o);await db.SaveChangesAsync(ct);return Dto(o); - } - private async Task LockedAsync(AuthorizedPatientContext scope,Guid id,CancellationToken cancellationToken) - {scope.RequireWrite();await tx.EnlistAsync(db,cancellationToken);return await db.Observations.FromSqlInterpolated($"SELECT * FROM observations.observation WHERE observation_id={id} AND patient_id={scope.PatientId} FOR UPDATE").SingleOrDefaultAsync(cancellationToken);} - public async Task PatchAsync(AuthorizedPatientContext scope,Guid id,PatchObservationRequest request,CancellationToken cancellationToken) - { - Validator.ValidateObject(request,new ValidationContext(request),true);if(request.MeasurementContext is not null)Validator.ValidateObject(request.MeasurementContext,new ValidationContext(request.MeasurementContext),true); - var observation=await LockedAsync(scope,id,cancellationToken);if(observation is null)return null; - var updatedAt=DateTime.SpecifyKind(DateTime.UtcNow,DateTimeKind.Unspecified); + public async Task ResolveOwnerAsync(Guid id, CancellationToken ct) { await tx.EnlistAsync(db, ct); return await db.Observations.AsNoTracking().Where(o => o.ObservationId == id).Select(o => (Guid?)o.PatientId).SingleOrDefaultAsync(ct); } + public async Task GetAsync(AuthorizedPatientContext scope, Guid id, CancellationToken ct) { await tx.EnlistAsync(db, ct); var o = await db.Observations.AsNoTracking().SingleOrDefaultAsync(o => o.ObservationId == id && o.PatientId == scope.PatientId, ct); return o is null ? null : Dto(o); } + public async Task LatestAsync(AuthorizedPatientContext scope, CancellationToken ct) { await tx.EnlistAsync(db, ct); var o = await db.Observations.AsNoTracking().Where(o => o.PatientId == scope.PatientId).OrderByDescending(o => o.MeasuredAt).ThenByDescending(o => o.CreatedAt).ThenByDescending(o => o.ObservationId).FirstOrDefaultAsync(ct); return o is null ? null : Dto(o); } + public async Task> SelectedAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct) + { + from = MeasurementPeriod.Normalize(from); to = MeasurementPeriod.Normalize(to); MeasurementPeriod.Validate(from, to); Validator.ValidateObject(selection, new ValidationContext(selection), true); await tx.EnlistAsync(db, ct); + var q = db.Observations.AsNoTracking().Where(o => o.PatientId == scope.PatientId && o.MeasuredAt >= from && o.MeasuredAt <= to); + if (selection.Setting is not null) q = q.Where(o => o.MeasurementContext.Setting == selection.Setting); + if (selection.ActivityCondition is not null) q = q.Where(o => o.MeasurementContext.ActivityCondition == selection.ActivityCondition); + return Array.AsReadOnly((await q.OrderBy(o => o.MeasuredAt).ThenBy(o => o.ObservationId).ToListAsync(ct)).Select(Dto).ToArray()); + } + public async Task RecordAsync(AuthorizedPatientContext scope, RecordObservationRequest request, CancellationToken ct) + { + scope.RequireWrite(); Validator.ValidateObject(request, new ValidationContext(request), true); + var context = request.MeasurementContext ?? new(); context = context with { Setting = context.Setting ?? "Unknown", ActivityCondition = context.ActivityCondition ?? "Unknown" }; Validator.ValidateObject(context, new ValidationContext(context), true); + if (await profiles.GetAsync(scope, ct) is null) return null; await tx.EnlistAsync(db, ct); + var now = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified); + var o = new BloodPressureObservation { ObservationId = Guid.NewGuid(), PatientId = scope.PatientId, MeasuredAt = MeasurementPeriod.Normalize(request.MeasuredAt!.Value), Systolic = request.Systolic!.Value, Diastolic = request.Diastolic!.Value, Pulse = request.Pulse!.Value, MeasurementContext = context, Context = request.Context, Note = request.Note, CreatedAt = now, UpdatedAt = now }; db.Observations.Add(o); await db.SaveChangesAsync(ct); return Dto(o); + } + private async Task LockedAsync(AuthorizedPatientContext scope, Guid id, CancellationToken cancellationToken) + { scope.RequireWrite(); await tx.EnlistAsync(db, cancellationToken); return await db.Observations.FromSqlInterpolated($"SELECT * FROM observations.observation WHERE observation_id={id} AND patient_id={scope.PatientId} FOR UPDATE").SingleOrDefaultAsync(cancellationToken); } + public async Task PatchAsync(AuthorizedPatientContext scope, Guid id, PatchObservationRequest request, CancellationToken cancellationToken) + { + Validator.ValidateObject(request, new ValidationContext(request), true); if (request.MeasurementContext is not null) Validator.ValidateObject(request.MeasurementContext, new ValidationContext(request.MeasurementContext), true); + var observation = await LockedAsync(scope, id, cancellationToken); if (observation is null) return null; + var updatedAt = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified); if (request.SystolicSpecified) observation.Systolic = request.Systolic!.Value; if (request.DiastolicSpecified) observation.Diastolic = request.Diastolic!.Value; if (request.PulseSpecified) observation.Pulse = request.Pulse!.Value; @@ -61,17 +62,17 @@ internal sealed class ObservationFacade(ObservationDbContext db,RequestTransacti } observation.UpdatedAt = updatedAt; await db.SaveChangesAsync(cancellationToken); - return Dto(observation); - } - public async Task DeleteAsync(AuthorizedPatientContext scope,Guid id,CancellationToken ct) - {var o=await LockedAsync(scope,id,ct);if(o is null)return false;db.Observations.Remove(o);await db.SaveChangesAsync(ct);return true;} - private static ObservationDto Dto(BloodPressureObservation o)=>new(o.ObservationId,o.PatientId,o.MeasuredAt,o.Systolic,o.Diastolic,o.Pulse,new MeasurementContextDto(o.MeasurementContext.Setting,o.MeasurementContext.ActivityCondition,o.MeasurementContext.RestDurationMinutes,o.MeasurementContext.BodyPosition,o.MeasurementContext.MeasuredArm,o.MeasurementContext.DeviceDetails,o.MeasurementContext.CuffDetails,o.MeasurementContext.AdditionalCircumstances),o.Context,o.Note); + return Dto(observation); + } + public async Task DeleteAsync(AuthorizedPatientContext scope, Guid id, CancellationToken ct) + { var o = await LockedAsync(scope, id, ct); if (o is null) return false; db.Observations.Remove(o); await db.SaveChangesAsync(ct); return true; } + private static ObservationDto Dto(BloodPressureObservation o) => new(o.ObservationId, o.PatientId, o.MeasuredAt, o.Systolic, o.Diastolic, o.Pulse, new MeasurementContextDto(o.MeasurementContext.Setting, o.MeasurementContext.ActivityCondition, o.MeasurementContext.RestDurationMinutes, o.MeasurementContext.BodyPosition, o.MeasurementContext.MeasuredArm, o.MeasurementContext.DeviceDetails, o.MeasurementContext.CuffDetails, o.MeasurementContext.AdditionalCircumstances), o.Context, o.Note); } public static class ObservationsModule { - public static IServiceCollection AddObservations(this IServiceCollection s) - { - s.AddScoped(sp=>new ObservationDbContext(new DbContextOptionsBuilder().UseNpgsql(sp.GetRequiredService().Connection??throw new InvalidOperationException("No request transaction.")).Options)); - s.AddScoped();s.AddScoped(sp=>sp.GetRequiredService());s.AddScoped(sp=>sp.GetRequiredService());return s; - } + public static IServiceCollection AddObservations(this IServiceCollection s) + { + s.AddScoped(sp => new ObservationDbContext(new DbContextOptionsBuilder().UseNpgsql(sp.GetRequiredService().Connection ?? throw new InvalidOperationException("No request transaction.")).Options)); + s.AddScoped(); s.AddScoped(sp => sp.GetRequiredService()); s.AddScoped(sp => sp.GetRequiredService()); return s; + } } diff --git a/src/Modules/Overview/OverviewFacade.cs b/src/Modules/Overview/OverviewFacade.cs index d4350c5..67776ec 100644 --- a/src/Modules/Overview/OverviewFacade.cs +++ b/src/Modules/Overview/OverviewFacade.cs @@ -2,23 +2,24 @@ using System.ComponentModel.DataAnnotations; using HealthApp.Contracts; using Microsoft.Extensions.DependencyInjection; namespace HealthApp.Overview; -internal sealed class OverviewFacade(ProfileQueries patients,ObservationQueries observations,AnalyticsQueries analytics) : OverviewQueries + +internal sealed class OverviewFacade(ProfileQueries patients, ObservationQueries observations, AnalyticsQueries analytics) : OverviewQueries { - public async Task GetAsync(AuthorizedPatientContext scope,DateTime from,DateTime to,ContextSelection selection,CancellationToken ct) - { - from=MeasurementPeriod.Normalize(from);to=MeasurementPeriod.Normalize(to);MeasurementPeriod.Validate(from,to);Validator.ValidateObject(selection,new ValidationContext(selection),true); - var patient=await patients.GetAsync(scope,ct);if(patient is null)return null; - var latest=await observations.LatestAsync(scope,ct); - // Analytics captures the selected series once and closes the shared snapshot before calculation. - var insight=await analytics.InsightAsync(scope,from,to,selection,ct); - return new(patient,latest,insight,from,to,selection,insight?.ContributingCount??0, - "Latest overall observation for the patient, independent of the insight period and context selections. "+ - "Its recorded context applies only to that observation, not to the insight's contributing observations.", - insight is null?"No calculated insight is available: no observations match the requested period and insight selection.": - "The insight uses the requested period and context selection only. "+insight.ContextExplanation); - } + public async Task GetAsync(AuthorizedPatientContext scope, DateTime from, DateTime to, ContextSelection selection, CancellationToken ct) + { + from = MeasurementPeriod.Normalize(from); to = MeasurementPeriod.Normalize(to); MeasurementPeriod.Validate(from, to); Validator.ValidateObject(selection, new ValidationContext(selection), true); + var patient = await patients.GetAsync(scope, ct); if (patient is null) return null; + var latest = await observations.LatestAsync(scope, ct); + // Analytics captures the selected series once and closes the shared snapshot before calculation. + var insight = await analytics.InsightAsync(scope, from, to, selection, ct); + return new(patient, latest, insight, from, to, selection, insight?.ContributingCount ?? 0, + "Latest overall observation for the patient, independent of the insight period and context selections. " + + "Its recorded context applies only to that observation, not to the insight's contributing observations.", + insight is null ? "No calculated insight is available: no observations match the requested period and insight selection." : + "The insight uses the requested period and context selection only. " + insight.ContextExplanation); + } } public static class OverviewModule { - public static IServiceCollection AddOverview(this IServiceCollection services)=>services.AddScoped(); + public static IServiceCollection AddOverview(this IServiceCollection services) => services.AddScoped(); } diff --git a/src/Modules/Profile/AssemblyInfo.cs b/src/Modules/Profile/AssemblyInfo.cs index f136d84..db382ed 100644 --- a/src/Modules/Profile/AssemblyInfo.cs +++ b/src/Modules/Profile/AssemblyInfo.cs @@ -1,2 +1,2 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("HealthApp.AcceptanceTests")] +[assembly: InternalsVisibleTo("HealthApp.AcceptanceTests")] diff --git a/src/Modules/Profile/ProfileFacade.cs b/src/Modules/Profile/ProfileFacade.cs index fe554bf..36f6304 100644 --- a/src/Modules/Profile/ProfileFacade.cs +++ b/src/Modules/Profile/ProfileFacade.cs @@ -7,34 +7,35 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Npgsql; namespace HealthApp.Profile; -internal sealed class ProfileFacade(PatientDbContext db,RequestTransaction tx) : ProfileQueries,ProfileCommands + +internal sealed class ProfileFacade(PatientDbContext db, RequestTransaction tx) : ProfileQueries, ProfileCommands { - public async Task ResolveAccountAsync(string id,CancellationToken ct) - {await tx.EnlistAsync(db,ct);return await db.Patients.AsNoTracking().Where(p=>p.AccountId==id).Select(p=>(Guid?)p.PatientId).SingleOrDefaultAsync(ct);} - public async Task GetAsync(AuthorizedPatientContext scope,CancellationToken ct) - {await tx.EnlistAsync(db,ct);var p=await db.Patients.AsNoTracking().SingleOrDefaultAsync(p=>p.PatientId==scope.PatientId,ct);return p is null?null:Dto(p);} - public async Task CreateAsync(string trustedAccountId,CreatePatientRequest r,CancellationToken ct) - { - ArgumentException.ThrowIfNullOrWhiteSpace(trustedAccountId);Validator.ValidateObject(r,new ValidationContext(r),true); - await tx.EnlistAsync(db,ct);if(await db.Patients.AnyAsync(p=>p.AccountId==trustedAccountId,ct))throw new ProfileAlreadyExistsException(); - var now=DateTime.SpecifyKind(DateTime.UtcNow,DateTimeKind.Unspecified); - var p=new Patient{PatientId=Guid.NewGuid(),AccountId=trustedAccountId,Name=r.Name!,DateOfBirth=r.DateOfBirth!.Value,ContactInfo=r.ContactInfo,CreatedAt=now,UpdatedAt=now};db.Patients.Add(p); - try{await db.SaveChangesAsync(ct);}catch(DbUpdateException e) when(e.InnerException is PostgresException {SqlState:"23505",ConstraintName:"IX_patient_account_id"}){throw new ProfileAlreadyExistsException();} - return Dto(p); - } - public async Task UpdateAsync(AuthorizedPatientContext scope,UpdatePatientRequest r,CancellationToken ct) - { - scope.RequireWrite();Validator.ValidateObject(r,new ValidationContext(r),true);await tx.EnlistAsync(db,ct); - var p=await db.Patients.FromSqlInterpolated($"SELECT * FROM profile.patient WHERE patient_id={scope.PatientId} FOR UPDATE").SingleOrDefaultAsync(ct); - if(p is null)return null;p.Name=r.Name!;p.ContactInfo=r.ContactInfo;p.UpdatedAt=DateTime.SpecifyKind(DateTime.UtcNow,DateTimeKind.Unspecified);await db.SaveChangesAsync(ct);return Dto(p); - } - private static PatientDto Dto(Patient p)=>new(p.PatientId,p.Name,p.DateOfBirth,p.ContactInfo); + public async Task ResolveAccountAsync(string id, CancellationToken ct) + { await tx.EnlistAsync(db, ct); return await db.Patients.AsNoTracking().Where(p => p.AccountId == id).Select(p => (Guid?)p.PatientId).SingleOrDefaultAsync(ct); } + public async Task GetAsync(AuthorizedPatientContext scope, CancellationToken ct) + { await tx.EnlistAsync(db, ct); var p = await db.Patients.AsNoTracking().SingleOrDefaultAsync(p => p.PatientId == scope.PatientId, ct); return p is null ? null : Dto(p); } + public async Task CreateAsync(string trustedAccountId, CreatePatientRequest r, CancellationToken ct) + { + ArgumentException.ThrowIfNullOrWhiteSpace(trustedAccountId); Validator.ValidateObject(r, new ValidationContext(r), true); + await tx.EnlistAsync(db, ct); if (await db.Patients.AnyAsync(p => p.AccountId == trustedAccountId, ct)) throw new ProfileAlreadyExistsException(); + var now = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified); + var p = new Patient { PatientId = Guid.NewGuid(), AccountId = trustedAccountId, Name = r.Name!, DateOfBirth = r.DateOfBirth!.Value, ContactInfo = r.ContactInfo, CreatedAt = now, UpdatedAt = now }; db.Patients.Add(p); + try { await db.SaveChangesAsync(ct); } catch (DbUpdateException e) when (e.InnerException is PostgresException { SqlState: "23505", ConstraintName: "IX_patient_account_id" }) { throw new ProfileAlreadyExistsException(); } + return Dto(p); + } + public async Task UpdateAsync(AuthorizedPatientContext scope, UpdatePatientRequest r, CancellationToken ct) + { + scope.RequireWrite(); Validator.ValidateObject(r, new ValidationContext(r), true); await tx.EnlistAsync(db, ct); + var p = await db.Patients.FromSqlInterpolated($"SELECT * FROM profile.patient WHERE patient_id={scope.PatientId} FOR UPDATE").SingleOrDefaultAsync(ct); + if (p is null) return null; p.Name = r.Name!; p.ContactInfo = r.ContactInfo; p.UpdatedAt = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified); await db.SaveChangesAsync(ct); return Dto(p); + } + private static PatientDto Dto(Patient p) => new(p.PatientId, p.Name, p.DateOfBirth, p.ContactInfo); } public static class ProfileModule { - public static IServiceCollection AddProfile(this IServiceCollection services) - { - services.AddScoped(sp=>new PatientDbContext(new DbContextOptionsBuilder().UseNpgsql(sp.GetRequiredService().Connection ?? throw new InvalidOperationException("Request transaction must begin before module activation.")).Options)); - services.AddScoped();services.AddScoped(sp=>sp.GetRequiredService());services.AddScoped(sp=>sp.GetRequiredService());return services; - } + public static IServiceCollection AddProfile(this IServiceCollection services) + { + services.AddScoped(sp => new PatientDbContext(new DbContextOptionsBuilder().UseNpgsql(sp.GetRequiredService().Connection ?? throw new InvalidOperationException("Request transaction must begin before module activation.")).Options)); + services.AddScoped(); services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(sp => sp.GetRequiredService()); return services; + } } diff --git a/tests/HealthApp.AcceptanceTests/AuthenticationIntegrationTests.cs b/tests/HealthApp.AcceptanceTests/AuthenticationIntegrationTests.cs index 176f4d6..a3b37ef 100644 --- a/tests/HealthApp.AcceptanceTests/AuthenticationIntegrationTests.cs +++ b/tests/HealthApp.AcceptanceTests/AuthenticationIntegrationTests.cs @@ -45,28 +45,29 @@ public sealed class AuthenticationIntegrationTests [Theory] [InlineData("Patient", "test-0")] [InlineData("HealthcareProfessional", "professional")] - public async Task Standard_replacement_handler_with_same_identity_retains_ownership_policy(string role,string accountId) + public async Task Standard_replacement_handler_with_same_identity_retains_ownership_policy(string role, string accountId) { - var fixture=new PatientApiFixture();await fixture.InitializeAsync(); + var fixture = new PatientApiFixture(); await fixture.InitializeAsync(); try { - Guid patient=Guid.NewGuid(); - await using(var db=fixture.CreateDbContext()) + Guid patient = Guid.NewGuid(); + await using (var db = fixture.CreateDbContext()) { - var time=new DateTime(2026,9,12); - db.Patients.Add(new HealthApp.Profile.Domain.Patient{PatientId=patient,AccountId="test-0",Name="Replacement",DateOfBirth=new DateOnly(1980,1,1),CreatedAt=time,UpdatedAt=time});await db.SaveChangesAsync(); + var time = new DateTime(2026, 9, 12); + db.Patients.Add(new HealthApp.Profile.Domain.Patient { PatientId = patient, AccountId = "test-0", Name = "Replacement", DateOfBirth = new DateOnly(1980, 1, 1), CreatedAt = time, UpdatedAt = time }); await db.SaveChangesAsync(); } - fixture.AdditionalGatewayConfiguration["TestIdentity:Role"]=role;fixture.AdditionalGatewayConfiguration["TestIdentity:AccountId"]=accountId; - fixture.AdditionalGatewayConfiguration[$"Access:ProfessionalAssignments:{accountId}:0"]=patient.ToString(); - fixture.ConfigureServices=services=>{ - services.AddAuthentication().AddScheme("Replacement",null); - services.PostConfigure(options=>{options.DefaultAuthenticateScheme="Replacement";options.DefaultChallengeScheme="Replacement";options.DefaultScheme="Replacement";}); + fixture.AdditionalGatewayConfiguration["TestIdentity:Role"] = role; fixture.AdditionalGatewayConfiguration["TestIdentity:AccountId"] = accountId; + fixture.AdditionalGatewayConfiguration[$"Access:ProfessionalAssignments:{accountId}:0"] = patient.ToString(); + fixture.ConfigureServices = services => + { + services.AddAuthentication().AddScheme("Replacement", null); + services.PostConfigure(options => { options.DefaultAuthenticateScheme = "Replacement"; options.DefaultChallengeScheme = "Replacement"; options.DefaultScheme = "Replacement"; }); }; await fixture.RestartHostsAsync(); - using var own=await fixture.RawClient.GetAsync($"/api/patients/{patient}");Assert.Equal(HttpStatusCode.OK,own.StatusCode); - using var other=await fixture.RawClient.GetAsync($"/api/patients/{Guid.NewGuid()}");Assert.Equal(HttpStatusCode.NotFound,other.StatusCode);Assert.Empty(await other.Content.ReadAsStringAsync()); + using var own = await fixture.RawClient.GetAsync($"/api/patients/{patient}"); Assert.Equal(HttpStatusCode.OK, own.StatusCode); + using var other = await fixture.RawClient.GetAsync($"/api/patients/{Guid.NewGuid()}"); Assert.Equal(HttpStatusCode.NotFound, other.StatusCode); Assert.Empty(await other.Content.ReadAsStringAsync()); } - finally{await fixture.DisposeAsync();} + finally { await fixture.DisposeAsync(); } } public sealed class ReplacementHandler(IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration configuration) diff --git a/tests/HealthApp.AcceptanceTests/ConformanceTests.cs b/tests/HealthApp.AcceptanceTests/ConformanceTests.cs index ab2a661..455f0a1 100644 --- a/tests/HealthApp.AcceptanceTests/ConformanceTests.cs +++ b/tests/HealthApp.AcceptanceTests/ConformanceTests.cs @@ -6,26 +6,27 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class ConformanceTests { - [Fact] - public void Persistence_entities_and_contexts_are_private_and_dependency_graph_is_acyclic() - { - var assemblies=new[]{typeof(HealthApp.Profile.ProfileModule).Assembly,typeof(HealthApp.Observations.ObservationsModule).Assembly,typeof(HealthApp.Analytics.AnalyticsModule).Assembly,typeof(HealthApp.Overview.OverviewModule).Assembly,typeof(HealthApp.Guidance.GuidanceQueries).Assembly}; - foreach(var assembly in assemblies) - { - Assert.DoesNotContain(assembly.GetExportedTypes(),t=>t.Name.EndsWith("DbContext")||t.Name is "Patient" or "BloodPressureObservation"); - Assert.DoesNotContain(assembly.GetReferencedAssemblies(),a=>a.Name=="HealthApp"); - } - foreach(var a in new[]{typeof(HealthApp.Analytics.AnalyticsModule).Assembly,typeof(HealthApp.Overview.OverviewModule).Assembly,typeof(HealthApp.Guidance.GuidanceQueries).Assembly})Assert.DoesNotContain(a.GetTypes(),t=>typeof(Microsoft.EntityFrameworkCore.DbContext).IsAssignableFrom(t)); - Assert.Empty(typeof(AuthorizedPatientContext).GetConstructors(BindingFlags.Public|BindingFlags.Instance)); - } - [Fact] - public void Final_solution_has_one_web_host_and_no_reference_project_or_internal_business_http() - { - var root=PatientProfile.AcceptanceTests.PatientApiFixture.FindRoot();var solution=File.ReadAllText(Path.Combine(root,"HealthApp.slnx"));Assert.DoesNotContain("Reference/",solution); - var webProjects=Directory.GetFiles(Path.Combine(root,"src"),"*.csproj",SearchOption.AllDirectories).Where(p=>File.ReadAllText(p).Contains("Sdk=\"Microsoft.NET.Sdk.Web\""));Assert.Single(webProjects); - foreach(var path in Directory.GetFiles(Path.Combine(root,"src"),"*.cs",SearchOption.AllDirectories).Where(p=>!p.Contains("/obj/")&&!p.Contains("/bin/"))) - {var code=File.ReadAllText(path);Assert.DoesNotContain("IHttpClientFactory",code);Assert.DoesNotContain("X-Service-Key",code);Assert.DoesNotContain("X-Gateway-Key",code);} - } + [Fact] + public void Persistence_entities_and_contexts_are_private_and_dependency_graph_is_acyclic() + { + var assemblies = new[] { typeof(HealthApp.Profile.ProfileModule).Assembly, typeof(HealthApp.Observations.ObservationsModule).Assembly, typeof(HealthApp.Analytics.AnalyticsModule).Assembly, typeof(HealthApp.Overview.OverviewModule).Assembly, typeof(HealthApp.Guidance.GuidanceQueries).Assembly }; + foreach (var assembly in assemblies) + { + Assert.DoesNotContain(assembly.GetExportedTypes(), t => t.Name.EndsWith("DbContext") || t.Name is "Patient" or "BloodPressureObservation"); + Assert.DoesNotContain(assembly.GetReferencedAssemblies(), a => a.Name == "HealthApp"); + } + foreach (var a in new[] { typeof(HealthApp.Analytics.AnalyticsModule).Assembly, typeof(HealthApp.Overview.OverviewModule).Assembly, typeof(HealthApp.Guidance.GuidanceQueries).Assembly }) Assert.DoesNotContain(a.GetTypes(), t => typeof(Microsoft.EntityFrameworkCore.DbContext).IsAssignableFrom(t)); + Assert.Empty(typeof(AuthorizedPatientContext).GetConstructors(BindingFlags.Public | BindingFlags.Instance)); + } + [Fact] + public void Final_solution_has_one_web_host_and_no_reference_project_or_internal_business_http() + { + var root = PatientProfile.AcceptanceTests.PatientApiFixture.FindRoot(); var solution = File.ReadAllText(Path.Combine(root, "HealthApp.slnx")); Assert.DoesNotContain("Reference/", solution); + var webProjects = Directory.GetFiles(Path.Combine(root, "src"), "*.csproj", SearchOption.AllDirectories).Where(p => File.ReadAllText(p).Contains("Sdk=\"Microsoft.NET.Sdk.Web\"")); Assert.Single(webProjects); + foreach (var path in Directory.GetFiles(Path.Combine(root, "src"), "*.cs", SearchOption.AllDirectories).Where(p => !p.Contains("/obj/") && !p.Contains("/bin/"))) + { var code = File.ReadAllText(path); Assert.DoesNotContain("IHttpClientFactory", code); Assert.DoesNotContain("X-Service-Key", code); Assert.DoesNotContain("X-Gateway-Key", code); } + } } diff --git a/tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs b/tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs index cd43e32..da61682 100644 --- a/tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs +++ b/tests/HealthApp.AcceptanceTests/ContextFilteredHistoryTests.cs @@ -27,10 +27,16 @@ public sealed class ContextFilteredHistoryTests(ObservationApiFixture fixture) : { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patient}/observations", new { - measuredAt = time, systolic = 128, diastolic = 82, pulse = 68, context = legacy, + measuredAt = time, + systolic = 128, + diastolic = 82, + pulse = 68, + context = legacy, measurementContext = includeContext ? new { - setting, activityCondition = activity, deviceDetails = "Saved device", + setting, + activityCondition = activity, + deviceDetails = "Saved device", restDurationMinutes = completeContext ? (decimal?)5 : null, bodyPosition = completeContext ? "Seated" : null, measuredArm = completeContext ? "Left" : null, diff --git a/tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs b/tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs index fba1f83..4d87bf4 100644 --- a/tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs +++ b/tests/HealthApp.AcceptanceTests/ContextSelectedInsightTests.cs @@ -29,7 +29,11 @@ public sealed class ContextSelectedInsightTests(ObservationApiFixture fixture) : { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patient}/observations", new { - measuredAt = time, systolic, diastolic, pulse, context = "Home resting?", + measuredAt = time, + systolic, + diastolic, + pulse, + context = "Home resting?", measurementContext = new { setting, activityCondition = activity, bodyPosition = position } }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); @@ -101,6 +105,8 @@ public sealed class ContextSelectedInsightTests(ObservationApiFixture fixture) : Assert.Equal(120m, result.AverageSystolic); Assert.Equal(80m, result.AverageDiastolic); Assert.Equal(60m, result.AveragePulse); + Assert.Equal(120, result.MinSystolic); + Assert.Equal(80, result.MinDiastolic); Assert.Equal(result.MinSystolic, result.MaxSystolic); Assert.Equal(result.MinDiastolic, result.MaxDiastolic); Assert.Equal(new Selection(setting, activity), result.AppliedSelection); diff --git a/tests/HealthApp.AcceptanceTests/CreatePatientTests.cs b/tests/HealthApp.AcceptanceTests/CreatePatientTests.cs index ae804c1..347ca05 100644 --- a/tests/HealthApp.AcceptanceTests/CreatePatientTests.cs +++ b/tests/HealthApp.AcceptanceTests/CreatePatientTests.cs @@ -17,7 +17,9 @@ public sealed class CreatePatientTests(PatientApiFixture fixture) : IClassFixtur { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Steffen Example", dateOfBirth = "1980-01-01", contactInfo = "steffen@example.test" + name = "Steffen Example", + dateOfBirth = "1980-01-01", + contactInfo = "steffen@example.test" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); var created = await response.Content.ReadFromJsonAsync(); diff --git a/tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs b/tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs index fb1636d..6942f91 100644 --- a/tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/DeleteContextualisedObservationTests.cs @@ -29,9 +29,23 @@ public sealed class DeleteContextualisedObservationTests(ObservationApiFixture f { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patient}/observations", new { - measuredAt = time, systolic, diastolic, pulse, context = "Original context", note = "Original note", - measurementContext = new { setting = "Home", activityCondition = "AtRest", restDurationMinutes = 5.5m, - bodyPosition = "Seated", measuredArm = "Left", deviceDetails = "Device", cuffDetails = "Cuff", additionalCircumstances = "Actual circumstances" } + measuredAt = time, + systolic, + diastolic, + pulse, + context = "Original context", + note = "Original note", + measurementContext = new + { + setting = "Home", + activityCondition = "AtRest", + restDurationMinutes = 5.5m, + bodyPosition = "Seated", + measuredArm = "Left", + deviceDetails = "Device", + cuffDetails = "Cuff", + additionalCircumstances = "Actual circumstances" + } }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; diff --git a/tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs b/tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs index 9592363..683f15b 100644 --- a/tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/DeleteObservationTests.cs @@ -15,7 +15,8 @@ public sealed class DeleteObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Deletion Example", dateOfBirth = "1980-01-01" + name = "Deletion Example", + dateOfBirth = "1980-01-01" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.PatientId; @@ -25,7 +26,12 @@ public sealed class DeleteObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt, systolic = 128, diastolic = 82, pulse = 68, context = "Resting", note = "Before breakfast" + measuredAt, + systolic = 128, + diastolic = 82, + pulse = 68, + context = "Resting", + note = "Before breakfast" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; diff --git a/tests/HealthApp.AcceptanceTests/FoundationTests.cs b/tests/HealthApp.AcceptanceTests/FoundationTests.cs index 43156d3..0c3cc5b 100644 --- a/tests/HealthApp.AcceptanceTests/FoundationTests.cs +++ b/tests/HealthApp.AcceptanceTests/FoundationTests.cs @@ -7,24 +7,25 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class FoundationTests { - [Fact] - public async Task Framework_login_retains_identity_generic_failures_and_no_service_key_bypass() - { - var auth=new AuthenticatedTestClient(); - using var host=new WebApplicationFactory().WithWebHostBuilder(b=>b.UseEnvironment("Development").ConfigureAppConfiguration((_,c)=>c.AddInMemoryCollection(auth.Configuration()))); - using var client=host.CreateClient(); - using var login=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="professional",password=AuthenticatedTestClient.Password}); - Assert.Equal(HttpStatusCode.OK,login.StatusCode);Assert.Equal("no-store",login.Headers.CacheControl!.ToString()); - using var json=JsonDocument.Parse(await login.Content.ReadAsStringAsync()); - Assert.Equal("HealthcareProfessional",json.RootElement.GetProperty("role").GetString()); - Assert.Equal(1800,json.RootElement.GetProperty("expiresIn").GetInt32()); - Assert.DoesNotContain("patientId",json.RootElement.GetRawText()); - using var badAccount=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="missing",password=AuthenticatedTestClient.Password}); - using var badPassword=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="test-0",password="wrong"}); - Assert.Equal(HttpStatusCode.Unauthorized,badAccount.StatusCode);Assert.Equal(await badAccount.Content.ReadAsStringAsync(),await badPassword.Content.ReadAsStringAsync()); - using var forged=new HttpRequestMessage(HttpMethod.Get,"/api/professionals/me/patients");forged.Headers.Add("X-Service-Key",auth.OverviewServiceKey); - using var rejected=await client.SendAsync(forged);Assert.Equal(HttpStatusCode.Unauthorized,rejected.StatusCode); - } + [Fact] + public async Task Framework_login_retains_identity_generic_failures_and_no_service_key_bypass() + { + var auth = new AuthenticatedTestClient(); + using var host = new WebApplicationFactory().WithWebHostBuilder(b => b.UseEnvironment("Development").ConfigureAppConfiguration((_, c) => c.AddInMemoryCollection(auth.Configuration()))); + using var client = host.CreateClient(); + using var login = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "professional", password = AuthenticatedTestClient.Password }); + Assert.Equal(HttpStatusCode.OK, login.StatusCode); Assert.Equal("no-store", login.Headers.CacheControl!.ToString()); + using var json = JsonDocument.Parse(await login.Content.ReadAsStringAsync()); + Assert.Equal("HealthcareProfessional", json.RootElement.GetProperty("role").GetString()); + Assert.Equal(1800, json.RootElement.GetProperty("expiresIn").GetInt32()); + Assert.DoesNotContain("patientId", json.RootElement.GetRawText()); + using var badAccount = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "missing", password = AuthenticatedTestClient.Password }); + using var badPassword = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "test-0", password = "wrong" }); + Assert.Equal(HttpStatusCode.Unauthorized, badAccount.StatusCode); Assert.Equal(await badAccount.Content.ReadAsStringAsync(), await badPassword.Content.ReadAsStringAsync()); + using var forged = new HttpRequestMessage(HttpMethod.Get, "/api/professionals/me/patients"); forged.Headers.Add("X-Service-Key", auth.OverviewServiceKey); + using var rejected = await client.SendAsync(forged); Assert.Equal(HttpStatusCode.Unauthorized, rejected.StatusCode); + } } diff --git a/tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs b/tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs index 5bc6ebf..c33d606 100644 --- a/tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs +++ b/tests/HealthApp.AcceptanceTests/HealthOverviewTests.cs @@ -16,7 +16,7 @@ public sealed class HealthOverviewTests(ObservationApiFixture fixture) : IClassF private async Task Patient() { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new - { name = "Overview patient", dateOfBirth = "1980-01-01", contactInfo = "Synthetic contact" }); + { name = "Overview patient", dateOfBirth = "1980-01-01", contactInfo = "Synthetic contact" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.PatientId; } @@ -25,9 +25,23 @@ public sealed class HealthOverviewTests(ObservationApiFixture fixture) : IClassF { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patient}/observations", new { - measuredAt = time, systolic, diastolic = 80, pulse = 65, context = "Preserved original context", note = "Preserved note", - measurementContext = new { setting, activityCondition = activity, restDurationMinutes = 5, - bodyPosition = "Seated", measuredArm = "Left", deviceDetails = "Device", cuffDetails = "Cuff", additionalCircumstances = "Morning" } + measuredAt = time, + systolic, + diastolic = 80, + pulse = 65, + context = "Preserved original context", + note = "Preserved note", + measurementContext = new + { + setting, + activityCondition = activity, + restDurationMinutes = 5, + bodyPosition = "Seated", + measuredArm = "Left", + deviceDetails = "Device", + cuffDetails = "Cuff", + additionalCircumstances = "Morning" + } }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.ObservationId; diff --git a/tests/HealthApp.AcceptanceTests/HealthTrendTests.cs b/tests/HealthApp.AcceptanceTests/HealthTrendTests.cs index 2990446..1422984 100644 --- a/tests/HealthApp.AcceptanceTests/HealthTrendTests.cs +++ b/tests/HealthApp.AcceptanceTests/HealthTrendTests.cs @@ -187,7 +187,7 @@ public sealed class HealthTrendCalculationTests public void Different_conditions_and_preparation_are_visible_and_limit_combined_trajectory() { var result = Calculate(Observation(0, 150), Observation(1, 160, context: Prepared with - { ActivityCondition = "AfterActivity", BodyPosition = "Standing" })); + { ActivityCondition = "AfterActivity", BodyPosition = "Standing" })); Assert.Equal("KnownDifferences", result.Comparability.Status); Assert.Contains(result.Comparability.KnownDifferences, s => s.Contains("activity condition")); Assert.Contains(result.Comparability.KnownDifferences, s => s.Contains("body position")); @@ -261,9 +261,20 @@ public sealed class HealthTrendTests(ObservationApiFixture fixture) : IClassFixt { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patient}/observations", new { - measuredAt = time, systolic, diastolic = 85, pulse = 70, - measurementContext = new { setting, activityCondition = activity, restDurationMinutes = 5, - bodyPosition = "Seated", measuredArm = "Left", deviceDetails = "Device A", cuffDetails = "Adult cuff" } + measuredAt = time, + systolic, + diastolic = 85, + pulse = 70, + measurementContext = new + { + setting, + activityCondition = activity, + restDurationMinutes = 5, + bodyPosition = "Seated", + measuredArm = "Left", + deviceDetails = "Device A", + cuffDetails = "Adult cuff" + } }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.ObservationId; diff --git a/tests/HealthApp.AcceptanceTests/LatestObservationTests.cs b/tests/HealthApp.AcceptanceTests/LatestObservationTests.cs index 9fc6b5a..dfefa7a 100644 --- a/tests/HealthApp.AcceptanceTests/LatestObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/LatestObservationTests.cs @@ -17,7 +17,8 @@ public sealed class LatestObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Latest Example", dateOfBirth = "1980-01-01" + name = "Latest Example", + dateOfBirth = "1980-01-01" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.PatientId; @@ -27,7 +28,12 @@ public sealed class LatestObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt, systolic, diastolic, pulse, context = "Resting", note = "Before breakfast" + measuredAt, + systolic, + diastolic, + pulse, + context = "Resting", + note = "Before breakfast" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; @@ -74,15 +80,27 @@ public sealed class LatestObservationTests(ObservationApiFixture fixture) : ICla db.Observations.AddRange( new BloodPressureObservation { - ObservationId = newerId, PatientId = patientId, MeasuredAt = newerMeasured, - Systolic = 126, Diastolic = 80, Pulse = 66, MeasurementContext = newerContext, - CreatedAt = newerRecorded, UpdatedAt = newerRecorded + ObservationId = newerId, + PatientId = patientId, + MeasuredAt = newerMeasured, + Systolic = 126, + Diastolic = 80, + Pulse = 66, + MeasurementContext = newerContext, + CreatedAt = newerRecorded, + UpdatedAt = newerRecorded }, new BloodPressureObservation { - ObservationId = olderId, PatientId = patientId, MeasuredAt = olderMeasured, - Systolic = 130, Diastolic = 84, Pulse = 70, MeasurementContext = olderContext, - CreatedAt = olderRecorded, UpdatedAt = olderRecorded + ObservationId = olderId, + PatientId = patientId, + MeasuredAt = olderMeasured, + Systolic = 130, + Diastolic = 84, + Pulse = 70, + MeasurementContext = olderContext, + CreatedAt = olderRecorded, + UpdatedAt = olderRecorded }); await db.SaveChangesAsync(); return (olderId, newerId); @@ -110,8 +128,16 @@ public sealed class LatestObservationTests(ObservationApiFixture fixture) : ICla var patient = await CreatePatientAsync(); var time = new DateTime(2026, 9, 12, 8, 0, 0); var pair = await SeedPair(patient, time.AddDays(-1), time, time, time.AddHours(1), - new MeasurementContext { Setting = "Home", ActivityCondition = "AtRest", RestDurationMinutes = 5, - BodyPosition = "Seated", MeasuredArm = "Left", DeviceDetails = "Recorded device", CuffDetails = "Recorded cuff" }, + new MeasurementContext + { + Setting = "Home", + ActivityCondition = "AtRest", + RestDurationMinutes = 5, + BodyPosition = "Seated", + MeasuredArm = "Left", + DeviceDetails = "Recorded device", + CuffDetails = "Recorded cuff" + }, new MeasurementContext()); var latest = (await Latest(patient))!; Assert.Equal(pair.NewerId, latest.ObservationId); diff --git a/tests/HealthApp.AcceptanceTests/MeasurementContextMigrationTests.cs b/tests/HealthApp.AcceptanceTests/MeasurementContextMigrationTests.cs index 17907dd..df026e3 100644 --- a/tests/HealthApp.AcceptanceTests/MeasurementContextMigrationTests.cs +++ b/tests/HealthApp.AcceptanceTests/MeasurementContextMigrationTests.cs @@ -24,12 +24,12 @@ public sealed class MeasurementContextMigrationTests var options = new DbContextOptionsBuilder().UseNpgsql( new NpgsqlConnectionStringBuilder(admin) { Database = database }.ConnectionString).Options; await using var db = new ObservationDbContext(options); - await using(var target=new NpgsqlConnection(new NpgsqlConnectionStringBuilder(admin){Database=database}.ConnectionString)) + await using (var target = new NpgsqlConnection(new NpgsqlConnectionStringBuilder(admin) { Database = database }.ConnectionString)) { await target.OpenAsync(); - foreach(var module in new[]{"Profile","Observations"}) - foreach(var file in Directory.GetFiles(Path.Combine(PatientProfile.AcceptanceTests.PatientApiFixture.FindRoot(),"src/Modules",module,"Migrations"),"*.sql")) - await new NpgsqlCommand(await File.ReadAllTextAsync(file),target).ExecuteNonQueryAsync(); + foreach (var module in new[] { "Profile", "Observations" }) + foreach (var file in Directory.GetFiles(Path.Combine(PatientProfile.AcceptanceTests.PatientApiFixture.FindRoot(), "src/Modules", module, "Migrations"), "*.sql")) + await new NpgsqlCommand(await File.ReadAllTextAsync(file), target).ExecuteNonQueryAsync(); } var observation = Guid.NewGuid(); var patient = Guid.NewGuid(); diff --git a/tests/HealthApp.AcceptanceTests/ObservationApiFixture.cs b/tests/HealthApp.AcceptanceTests/ObservationApiFixture.cs index 6ebb2ba..40f07c6 100644 --- a/tests/HealthApp.AcceptanceTests/ObservationApiFixture.cs +++ b/tests/HealthApp.AcceptanceTests/ObservationApiFixture.cs @@ -2,18 +2,19 @@ using HealthApp.Observations.Persistence; using Microsoft.EntityFrameworkCore; using Npgsql; namespace Observation.AcceptanceTests; + public sealed class ObservationApiFixture : PatientProfile.AcceptanceTests.PatientApiFixture { - private string? healthyConnection; - public string ObservationConnectionString=>ConnectionString; - internal ObservationDbContext CreateObservationDbContext()=>new(new DbContextOptionsBuilder().UseNpgsql(ConnectionString).Options); - public async Task StopPatientServiceAsync(){healthyConnection=RuntimeConnectionString;RuntimeConnectionString=new NpgsqlConnectionStringBuilder(RuntimeConnectionString){Host="127.0.0.1",Port=1,Timeout=1}.ConnectionString;await base.RestartHostsAsync();} - public Task StopObservationServiceAsync()=>StopPatientServiceAsync(); - public Task StopInsightsServiceAsync()=>StopPatientServiceAsync(); - public Task StopOverviewServiceAsync()=>StopPatientServiceAsync(); - public override async Task RestartHostsAsync(){if(healthyConnection is not null){RuntimeConnectionString=healthyConnection;healthyConnection=null;}await base.RestartHostsAsync();} - public HttpClient CreateDirectPatientClient()=>new(){BaseAddress=RawClient.BaseAddress}; - public HttpClient CreateDirectObservationClient()=>CreateDirectPatientClient(); - public HttpClient CreateDirectInsightsClient()=>CreateDirectPatientClient(); - public HttpClient CreateDirectOverviewClient()=>CreateDirectPatientClient(); + private string? healthyConnection; + public string ObservationConnectionString => ConnectionString; + internal ObservationDbContext CreateObservationDbContext() => new(new DbContextOptionsBuilder().UseNpgsql(ConnectionString).Options); + public async Task StopPatientServiceAsync() { healthyConnection = RuntimeConnectionString; RuntimeConnectionString = new NpgsqlConnectionStringBuilder(RuntimeConnectionString) { Host = "127.0.0.1", Port = 1, Timeout = 1 }.ConnectionString; await base.RestartHostsAsync(); } + public Task StopObservationServiceAsync() => StopPatientServiceAsync(); + public Task StopInsightsServiceAsync() => StopPatientServiceAsync(); + public Task StopOverviewServiceAsync() => StopPatientServiceAsync(); + public override async Task RestartHostsAsync() { if (healthyConnection is not null) { RuntimeConnectionString = healthyConnection; healthyConnection = null; } await base.RestartHostsAsync(); } + public HttpClient CreateDirectPatientClient() => new() { BaseAddress = RawClient.BaseAddress }; + public HttpClient CreateDirectObservationClient() => CreateDirectPatientClient(); + public HttpClient CreateDirectInsightsClient() => CreateDirectPatientClient(); + public HttpClient CreateDirectOverviewClient() => CreateDirectPatientClient(); } diff --git a/tests/HealthApp.AcceptanceTests/ObservationConcurrencyTests.cs b/tests/HealthApp.AcceptanceTests/ObservationConcurrencyTests.cs index 9be5647..37fcc3d 100644 --- a/tests/HealthApp.AcceptanceTests/ObservationConcurrencyTests.cs +++ b/tests/HealthApp.AcceptanceTests/ObservationConcurrencyTests.cs @@ -5,35 +5,45 @@ using Npgsql; using Observation.AcceptanceTests; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class ObservationConcurrencyTests(ObservationApiFixture fixture) : IClassFixture { - [Fact] - public async Task Locked_disjoint_patches_preserve_both_committed_changes() - { - using var created=await fixture.Client.PostAsJsonAsync("/api/patients",new{name="Concurrency",dateOfBirth="1980-01-01"});var p=(await created.Content.ReadFromJsonAsync())!; - using var recorded=await fixture.Client.PostAsJsonAsync($"/api/patients/{p.PatientId}/observations",new{measuredAt="2026-09-12T08:00:00",systolic=128,diastolic=82,pulse=68,note="Keep"});var o=(await recorded.Content.ReadFromJsonAsync())!; - await using var c=new NpgsqlConnection(fixture.ConnectionString);await c.OpenAsync();await using var held=await c.BeginTransactionAsync(); - await new NpgsqlCommand("SELECT observation_id FROM observations.observation WHERE observation_id=@id FOR UPDATE",c,held){Parameters={new NpgsqlParameter("id",o.ObservationId)}}.ExecuteScalarAsync(); - var first=fixture.Client.PatchAsJsonAsync($"/api/observations/{o.ObservationId}",new{systolic=130}); - var second=fixture.Client.PatchAsJsonAsync($"/api/observations/{o.ObservationId}",new{measurementContext=new{setting="Clinic"}}); - await using var probe=new NpgsqlConnection(fixture.ConnectionString);await probe.OpenAsync(); - var role=new NpgsqlConnectionStringBuilder(fixture.RuntimeConnectionString).Username; - var waited=false; - for(var i=0;i<100;i++) - { - var count=(long)(await new NpgsqlCommand("SELECT count(*) FROM pg_stat_activity WHERE usename=@role AND wait_event_type='Lock'",probe){Parameters={new NpgsqlParameter("role",role)}}.ExecuteScalarAsync())!; - if(count>=2){waited=true;break;}await Task.Delay(20); - } - Assert.True(waited,"Both mutations must wait on the held observation lock."); - Assert.False(first.IsCompleted);Assert.False(second.IsCompleted); - await held.CommitAsync();using var a=await first;using var b=await second;Assert.Equal(HttpStatusCode.OK,a.StatusCode);Assert.Equal(HttpStatusCode.OK,b.StatusCode); - var saved=(await fixture.Client.GetFromJsonAsync($"/api/observations/{o.ObservationId}"))!; - Assert.Equal(130,saved.Systolic);Assert.Equal("Clinic",saved.MeasurementContext!.Setting);Assert.Equal("Keep",saved.Note);Assert.Equal(o.MeasuredAt,saved.MeasuredAt);Assert.Equal(o.PatientId,saved.PatientId); - } - [Fact] - public async Task Database_rejects_orphan_and_invalid_measurement_values() - { - await using var c=new NpgsqlConnection(fixture.ConnectionString);await c.OpenAsync(); - var e=await Assert.ThrowsAsync(()=>new NpgsqlCommand("INSERT INTO observations.observation(observation_id,patient_id,measured_at,systolic,diastolic,pulse,created_at,updated_at) VALUES(gen_random_uuid(),gen_random_uuid(),now(),128,82,68,now(),now())",c).ExecuteNonQueryAsync());Assert.Equal("23503",e.SqlState); - } + [Fact] + public async Task Locked_disjoint_patches_preserve_both_committed_changes() + { + using var created = await fixture.Client.PostAsJsonAsync("/api/patients", new { name = "Concurrency", dateOfBirth = "1980-01-01" }); var p = (await created.Content.ReadFromJsonAsync())!; + using var recorded = await fixture.Client.PostAsJsonAsync($"/api/patients/{p.PatientId}/observations", new { measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68, note = "Keep" }); var o = (await recorded.Content.ReadFromJsonAsync())!; + await using var c = new NpgsqlConnection(fixture.ConnectionString); await c.OpenAsync(); await using var held = await c.BeginTransactionAsync(); + await new NpgsqlCommand("SELECT observation_id FROM observations.observation WHERE observation_id=@id FOR UPDATE", c, held) { Parameters = { new NpgsqlParameter("id", o.ObservationId) } }.ExecuteScalarAsync(); + var first = fixture.Client.PatchAsJsonAsync($"/api/observations/{o.ObservationId}", new { systolic = 130 }); + var second = fixture.Client.PatchAsJsonAsync($"/api/observations/{o.ObservationId}", new { measurementContext = new { setting = "Clinic" } }); + await using var probe = new NpgsqlConnection(fixture.ConnectionString); await probe.OpenAsync(); + var role = new NpgsqlConnectionStringBuilder(fixture.RuntimeConnectionString).Username; + var waited = false; + for (var i = 0; i < 100; i++) + { + var count = (long)(await new NpgsqlCommand("SELECT count(*) FROM pg_stat_activity WHERE usename=@role AND wait_event_type='Lock'", probe) { Parameters = { new NpgsqlParameter("role", role) } }.ExecuteScalarAsync())!; + if (count >= 2) { waited = true; break; } + await Task.Delay(20); + } + Assert.True(waited, "Both mutations must wait on the held observation lock."); + Assert.False(first.IsCompleted); Assert.False(second.IsCompleted); + await held.CommitAsync(); using var a = await first; using var b = await second; Assert.Equal(HttpStatusCode.OK, a.StatusCode); Assert.Equal(HttpStatusCode.OK, b.StatusCode); + var saved = (await fixture.Client.GetFromJsonAsync($"/api/observations/{o.ObservationId}"))!; + Assert.Equal(130, saved.Systolic); Assert.Equal("Clinic", saved.MeasurementContext!.Setting); Assert.Equal("Keep", saved.Note); Assert.Equal(o.MeasuredAt, saved.MeasuredAt); Assert.Equal(o.PatientId, saved.PatientId); + } + [Fact] + public async Task Database_rejects_orphan_and_invalid_measurement_values() + { + await using var c = new NpgsqlConnection(fixture.ConnectionString); await c.OpenAsync(); + var e = await Assert.ThrowsAsync(() => new NpgsqlCommand("INSERT INTO observations.observation(observation_id,patient_id,measured_at,systolic,diastolic,pulse,created_at,updated_at) VALUES(gen_random_uuid(),gen_random_uuid(),now(),128,82,68,now(),now())", c).ExecuteNonQueryAsync()); Assert.Equal("23503", e.SqlState); + using var created = await fixture.Client.PostAsJsonAsync("/api/patients", new { name = "Constraints", dateOfBirth = "1980-01-01" }); var p = (await created.Content.ReadFromJsonAsync())!; + using var recorded = await fixture.Client.PostAsJsonAsync($"/api/patients/{p.PatientId}/observations", new { measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68 }); var o = (await recorded.Content.ReadFromJsonAsync())!; + foreach (var update in new[] { "systolic=0", "diastolic=-1", "pulse=0", "setting='Unsupported'", "activity_condition='Unsupported'", "rest_duration_minutes=-1" }) + { + var command = new NpgsqlCommand($"UPDATE observations.observation SET {update} WHERE observation_id=@id", c); command.Parameters.AddWithValue("id", o.ObservationId); + e = await Assert.ThrowsAsync(() => command.ExecuteNonQueryAsync()); Assert.Equal("23514", e.SqlState); + } + var saved = (await fixture.Client.GetFromJsonAsync($"/api/observations/{o.ObservationId}"))!; Assert.Equal(128, saved.Systolic); Assert.Equal("Unknown", saved.MeasurementContext!.Setting); + } } diff --git a/tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs b/tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs index 397cc96..9069869 100644 --- a/tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs +++ b/tests/HealthApp.AcceptanceTests/ObservationHistoryTests.cs @@ -15,7 +15,8 @@ public sealed class ObservationHistoryTests(ObservationApiFixture fixture) : ICl { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "History Example", dateOfBirth = "1980-01-01" + name = "History Example", + dateOfBirth = "1980-01-01" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.PatientId; @@ -25,7 +26,12 @@ public sealed class ObservationHistoryTests(ObservationApiFixture fixture) : ICl { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt, systolic, diastolic, pulse, context = "Resting", note = "Before breakfast" + measuredAt, + systolic, + diastolic, + pulse, + context = "Resting", + note = "Before breakfast" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; diff --git a/tests/HealthApp.AcceptanceTests/OperationalTests.cs b/tests/HealthApp.AcceptanceTests/OperationalTests.cs index 486b52e..6c42462 100644 --- a/tests/HealthApp.AcceptanceTests/OperationalTests.cs +++ b/tests/HealthApp.AcceptanceTests/OperationalTests.cs @@ -7,70 +7,72 @@ using Npgsql; using Observation.AcceptanceTests; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class OperationalTests(ObservationApiFixture fixture) : IClassFixture { - [Fact] - public async Task Readiness_uses_configured_schemas_and_guidance_remains_public_during_database_outage() - { - var token=await AuthenticatedTestClient.LoginAsync(fixture.RawClient); - async Task Ready(){using var q=new HttpRequestMessage(HttpMethod.Get,"/health/ready");q.Headers.Authorization=new AuthenticationHeaderValue("Bearer",token);return await fixture.RawClient.SendAsync(q);} - using(var ready=await Ready())Assert.Equal(HttpStatusCode.OK,ready.StatusCode); - await fixture.StopObservationServiceAsync(); - try - { - using var notReady=await Ready();Assert.Equal(HttpStatusCode.ServiceUnavailable,notReady.StatusCode); - using var guidance=await fixture.RawClient.GetAsync("/api/measurement-guidance");Assert.Equal(HttpStatusCode.OK,guidance.StatusCode); - Assert.NotEmpty(await AuthenticatedTestClient.LoginAsync(fixture.RawClient)); - } - finally{await fixture.RestartHostsAsync();} - } - [Fact] - public async Task Deadline_cancels_locked_write_without_changing_profile() - { - using var create=await fixture.Client.PostAsJsonAsync("/api/patients",new{name="Keep",dateOfBirth="1980-01-01"});var p=(await create.Content.ReadFromJsonAsync())!; - fixture.AdditionalGatewayConfiguration["Resources:RequestDeadlineSeconds"]="0.2";await fixture.RestartHostsAsync(); - await using var c=new NpgsqlConnection(fixture.ConnectionString);await c.OpenAsync();await using var t=await c.BeginTransactionAsync(); - await new NpgsqlCommand("SELECT patient_id FROM profile.patient WHERE patient_id=@id FOR UPDATE",c,t){Parameters={new NpgsqlParameter("id",p.PatientId)}}.ExecuteScalarAsync(); - try - { - using var timed=await fixture.Client.PutAsJsonAsync($"/api/patients/{p.PatientId}",new{name="Must not persist"}); - Assert.Equal(HttpStatusCode.GatewayTimeout,timed.StatusCode); - await t.RollbackAsync();var saved=(await fixture.Client.GetFromJsonAsync($"/api/patients/{p.PatientId}"))!;Assert.Equal("Keep",saved.Name); - } - finally{fixture.AdditionalGatewayConfiguration.Remove("Resources:RequestDeadlineSeconds");await fixture.RestartHostsAsync();} - } - [Fact] - public async Task Assessment_admission_does_not_block_guidance_and_overload_is_explicit() - { - using var create=await fixture.Client.PostAsJsonAsync("/api/patients",new{name="Budget",dateOfBirth="1980-01-01"});var p=(await create.Content.ReadFromJsonAsync())!; - fixture.AdditionalGatewayConfiguration["Resources:MaxConcurrentAssessments"]="1";await fixture.RestartHostsAsync(); - var held=new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);var release=new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - fixture.ConfigureServices=services=>{ - var descriptor=services.Last(d=>d.ServiceType==typeof(ProfileQueries));services.Remove(descriptor); - services.AddScoped(sp=>new PausedProfile((ProfileQueries)descriptor.ImplementationFactory!(sp),async()=>{held.TrySetResult();await release.Task;})); - };await fixture.RestartHostsAsync(); - try - { - var path=$"/api/patients/{p.PatientId}/overview?from=2026-09-01&to=2026-09-30";var first=fixture.Client.GetAsync(path);await held.Task.WaitAsync(TimeSpan.FromSeconds(10)); - using var second=await fixture.Client.GetAsync(path);Assert.Equal(HttpStatusCode.ServiceUnavailable,second.StatusCode);Assert.NotNull(second.Headers.RetryAfter); - using var guidance=await fixture.RawClient.GetAsync("/api/measurement-guidance");Assert.Equal(HttpStatusCode.OK,guidance.StatusCode); - release.SetResult();using var completed=await first;Assert.Equal(HttpStatusCode.OK,completed.StatusCode); - } - finally{release.TrySetResult();fixture.ConfigureServices=null;fixture.AdditionalGatewayConfiguration.Remove("Resources:MaxConcurrentAssessments");await fixture.RestartHostsAsync();} - } - private sealed class PausedProfile(ProfileQueries inner,Func pause) : ProfileQueries - { - public Task ResolveAccountAsync(string a,CancellationToken ct)=>inner.ResolveAccountAsync(a,ct); - public async Task GetAsync(AuthorizedPatientContext scope,CancellationToken ct){var p=await inner.GetAsync(scope,ct);await pause();return p;} - } - [Fact] - public async Task Remote_connection_without_hostname_verified_tls_is_rejected_before_start() - { - fixture.AdditionalGatewayConfiguration["Database:Remote"]="true"; - try - { - var e=await Assert.ThrowsAsync(()=>fixture.RestartHostsAsync());Assert.Contains("verified TLS",e.Message); - } - finally{fixture.AdditionalGatewayConfiguration.Remove("Database:Remote");await fixture.RestartHostsAsync();} - } + [Fact] + public async Task Readiness_uses_configured_schemas_and_guidance_remains_public_during_database_outage() + { + var token = await AuthenticatedTestClient.LoginAsync(fixture.RawClient); + async Task Ready() { using var q = new HttpRequestMessage(HttpMethod.Get, "/health/ready"); q.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); return await fixture.RawClient.SendAsync(q); } + using (var ready = await Ready()) Assert.Equal(HttpStatusCode.OK, ready.StatusCode); + await fixture.StopObservationServiceAsync(); + try + { + using var notReady = await Ready(); Assert.Equal(HttpStatusCode.ServiceUnavailable, notReady.StatusCode); + using var guidance = await fixture.RawClient.GetAsync("/api/measurement-guidance"); Assert.Equal(HttpStatusCode.OK, guidance.StatusCode); + Assert.NotEmpty(await AuthenticatedTestClient.LoginAsync(fixture.RawClient)); + } + finally { await fixture.RestartHostsAsync(); } + } + [Fact] + public async Task Deadline_cancels_locked_write_without_changing_profile() + { + using var create = await fixture.Client.PostAsJsonAsync("/api/patients", new { name = "Keep", dateOfBirth = "1980-01-01" }); var p = (await create.Content.ReadFromJsonAsync())!; + fixture.AdditionalGatewayConfiguration["Resources:RequestDeadlineSeconds"] = "0.2"; await fixture.RestartHostsAsync(); + await using var c = new NpgsqlConnection(fixture.ConnectionString); await c.OpenAsync(); await using var t = await c.BeginTransactionAsync(); + await new NpgsqlCommand("SELECT patient_id FROM profile.patient WHERE patient_id=@id FOR UPDATE", c, t) { Parameters = { new NpgsqlParameter("id", p.PatientId) } }.ExecuteScalarAsync(); + try + { + using var timed = await fixture.Client.PutAsJsonAsync($"/api/patients/{p.PatientId}", new { name = "Must not persist" }); + Assert.Equal(HttpStatusCode.GatewayTimeout, timed.StatusCode); + await t.RollbackAsync(); var saved = (await fixture.Client.GetFromJsonAsync($"/api/patients/{p.PatientId}"))!; Assert.Equal("Keep", saved.Name); + } + finally { fixture.AdditionalGatewayConfiguration.Remove("Resources:RequestDeadlineSeconds"); await fixture.RestartHostsAsync(); } + } + [Fact] + public async Task Assessment_admission_does_not_block_guidance_and_overload_is_explicit() + { + using var create = await fixture.Client.PostAsJsonAsync("/api/patients", new { name = "Budget", dateOfBirth = "1980-01-01" }); var p = (await create.Content.ReadFromJsonAsync())!; + fixture.AdditionalGatewayConfiguration["Resources:MaxConcurrentAssessments"] = "1"; await fixture.RestartHostsAsync(); + var held = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var release = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + fixture.ConfigureServices = services => + { + var descriptor = services.Last(d => d.ServiceType == typeof(ProfileQueries)); services.Remove(descriptor); + services.AddScoped(sp => new PausedProfile((ProfileQueries)descriptor.ImplementationFactory!(sp), async () => { held.TrySetResult(); await release.Task; })); + }; await fixture.RestartHostsAsync(); + try + { + var path = $"/api/patients/{p.PatientId}/overview?from=2026-09-01&to=2026-09-30"; var first = fixture.Client.GetAsync(path); await held.Task.WaitAsync(TimeSpan.FromSeconds(10)); + using var second = await fixture.Client.GetAsync(path); Assert.Equal(HttpStatusCode.ServiceUnavailable, second.StatusCode); Assert.NotNull(second.Headers.RetryAfter); + using var guidance = await fixture.RawClient.GetAsync("/api/measurement-guidance"); Assert.Equal(HttpStatusCode.OK, guidance.StatusCode); + release.SetResult(); using var completed = await first; Assert.Equal(HttpStatusCode.OK, completed.StatusCode); + } + finally { release.TrySetResult(); fixture.ConfigureServices = null; fixture.AdditionalGatewayConfiguration.Remove("Resources:MaxConcurrentAssessments"); await fixture.RestartHostsAsync(); } + } + private sealed class PausedProfile(ProfileQueries inner, Func pause) : ProfileQueries + { + public Task ResolveAccountAsync(string a, CancellationToken ct) => inner.ResolveAccountAsync(a, ct); + public async Task GetAsync(AuthorizedPatientContext scope, CancellationToken ct) { var p = await inner.GetAsync(scope, ct); await pause(); return p; } + } + [Fact] + public async Task Remote_connection_without_hostname_verified_tls_is_rejected_before_start() + { + fixture.AdditionalGatewayConfiguration["Database:Remote"] = "true"; + try + { + var e = await Assert.ThrowsAsync(() => fixture.RestartHostsAsync()); Assert.Contains("verified TLS", e.Message); + } + finally { fixture.AdditionalGatewayConfiguration.Remove("Database:Remote"); await fixture.RestartHostsAsync(); } + } } diff --git a/tests/HealthApp.AcceptanceTests/PatchObservationTests.cs b/tests/HealthApp.AcceptanceTests/PatchObservationTests.cs index 6dc8d3f..82b65ba 100644 --- a/tests/HealthApp.AcceptanceTests/PatchObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/PatchObservationTests.cs @@ -24,10 +24,23 @@ public sealed class PatchObservationTests(ObservationApiFixture fixture) : IClas var patientId = (await patient.Content.ReadFromJsonAsync())!.PatientId; using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 182, diastolic = 82, pulse = 68, - context = "Legacy text", note = "Saved note", - measurementContext = withContext ? new { setting = "Home", activityCondition = "AtRest", restDurationMinutes = 5.5m, - bodyPosition = "Seated", measuredArm = "Left", deviceDetails = "Device", cuffDetails = "Cuff", additionalCircumstances = "Circumstances" } : null + measuredAt = "2026-09-12T08:00:00", + systolic = 182, + diastolic = 82, + pulse = 68, + context = "Legacy text", + note = "Saved note", + measurementContext = withContext ? new + { + setting = "Home", + activityCondition = "AtRest", + restDurationMinutes = 5.5m, + bodyPosition = "Seated", + measuredArm = "Left", + deviceDetails = "Device", + cuffDetails = "Cuff", + additionalCircumstances = "Circumstances" + } : null }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; @@ -72,15 +85,45 @@ public sealed class PatchObservationTests(ObservationApiFixture fixture) : IClas public async Task Individual_optional_fields_can_be_corrected_or_cleared_without_erasing_other_context() { var original = await Record(); - using var corrected = await Patch(original.ObservationId, new { measurementContext = new { restDurationMinutes = 0m, - bodyPosition = "Standing", measuredArm = "Right", deviceDetails = "Corrected device", cuffDetails = "Corrected cuff", additionalCircumstances = "After walking" } }); + using var corrected = await Patch(original.ObservationId, new + { + measurementContext = new + { + restDurationMinutes = 0m, + bodyPosition = "Standing", + measuredArm = "Right", + deviceDetails = "Corrected device", + cuffDetails = "Corrected cuff", + additionalCircumstances = "After walking" + } + }); Assert.Equal(HttpStatusCode.OK, corrected.StatusCode); - var expected = original with { MeasurementContext = original.MeasurementContext with { RestDurationMinutes = 0, - BodyPosition = "Standing", MeasuredArm = "Right", DeviceDetails = "Corrected device", CuffDetails = "Corrected cuff", AdditionalCircumstances = "After walking" } }; + var expected = original with + { + MeasurementContext = original.MeasurementContext with + { + RestDurationMinutes = 0, + BodyPosition = "Standing", + MeasuredArm = "Right", + DeviceDetails = "Corrected device", + CuffDetails = "Corrected cuff", + AdditionalCircumstances = "After walking" + } + }; Assert.Equal(expected, await corrected.Content.ReadFromJsonAsync()); - using var clear = await Patch(original.ObservationId, new { measurementContext = new { activityCondition = (string?)null, - restDurationMinutes = (decimal?)null, bodyPosition = (string?)null, measuredArm = (string?)null, - deviceDetails = (string?)null, cuffDetails = (string?)null, additionalCircumstances = (string?)null } }); + using var clear = await Patch(original.ObservationId, new + { + measurementContext = new + { + activityCondition = (string?)null, + restDurationMinutes = (decimal?)null, + bodyPosition = (string?)null, + measuredArm = (string?)null, + deviceDetails = (string?)null, + cuffDetails = (string?)null, + additionalCircumstances = (string?)null + } + }); Assert.Equal(HttpStatusCode.OK, clear.StatusCode); expected = original with { MeasurementContext = new ContextData("Home", "Unknown", null, null, null, null, null, null) }; Assert.Equal(expected, await Read(original.ObservationId)); @@ -145,7 +188,9 @@ public sealed class PatchObservationTests(ObservationApiFixture fixture) : IClas var original = await Record(); using var response = await fixture.Client.PutAsJsonAsync($"/api/observations/{original.ObservationId}", new { - systolic = 128, diastolic = 80, pulse = 65, + systolic = 128, + diastolic = 80, + pulse = 65, measurementContext = new { setting = "Unsupported" } }); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); @@ -179,7 +224,7 @@ public sealed class PatchObservationTests(ObservationApiFixture fixture) : IClas }) { using var request = new HttpRequestMessage(HttpMethod.Patch, $"/api/observations/{original.ObservationId}") - { Content = JsonContent.Create(new { measurementContext = new { setting = "Clinic" } }) }; + { Content = JsonContent.Create(new { measurementContext = new { setting = "Clinic" } }) }; if (token is not null) request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); using var response = await fixture.RawClient.SendAsync(request); Assert.Equal(expected, response.StatusCode); diff --git a/tests/HealthApp.AcceptanceTests/PatientApiFixture.cs b/tests/HealthApp.AcceptanceTests/PatientApiFixture.cs index 1ef213a..8967452 100644 --- a/tests/HealthApp.AcceptanceTests/PatientApiFixture.cs +++ b/tests/HealthApp.AcceptanceTests/PatientApiFixture.cs @@ -11,56 +11,58 @@ using Microsoft.Extensions.DependencyInjection; using Npgsql; using Xunit; namespace PatientProfile.AcceptanceTests; + public class PatientApiFixture : IAsyncLifetime { - private readonly string databaseName="architecture_b_"+Guid.NewGuid().ToString("N"); - private readonly string runtimeRole="b_runtime_"+Guid.NewGuid().ToString("N"); - private string admin=""; - private WebApplicationFactory? host; - public string ConnectionString {get;private set;}=""; - public string RuntimeConnectionString {get;protected set;}=""; - public HttpClient Client {get;private set;}=null!; - public HttpClient RawClient {get;private set;}=null!; - public AuthenticatedTestClient Authentication {get;}=new(); - public Action? ConfigureServices {get;set;} - public Dictionary AdditionalGatewayConfiguration {get;}=new(); - public async Task InitializeAsync() - { - admin=Environment.GetEnvironmentVariable("TEST_POSTGRES_CONNECTION")??throw new InvalidOperationException("TEST_POSTGRES_CONNECTION required."); - await using var c=new NpgsqlConnection(admin);await c.OpenAsync(); - await new NpgsqlCommand($"CREATE DATABASE {databaseName}; CREATE ROLE {runtimeRole} LOGIN PASSWORD 'test-runtime-only';",c).ExecuteNonQueryAsync(); - ConnectionString=new NpgsqlConnectionStringBuilder(admin){Database=databaseName,SearchPath="profile,observations"}.ConnectionString; - await using var db=new NpgsqlConnection(ConnectionString);await db.OpenAsync(); - var root=FindRoot(); - foreach(var _ in new[]{0,1}) - foreach(var script in new[]{"Profile","Observations"}.SelectMany(m=>Directory.GetFiles(Path.Combine(root,"src/Modules",m,"Migrations"),"*.sql").Order())) - await new NpgsqlCommand(await File.ReadAllTextAsync(script),db).ExecuteNonQueryAsync(); - await new NpgsqlCommand($"REVOKE CREATE ON SCHEMA public FROM PUBLIC; GRANT CONNECT ON DATABASE {databaseName} TO {runtimeRole}; GRANT USAGE ON SCHEMA profile TO {runtimeRole}; GRANT SELECT,INSERT,UPDATE ON profile.patient TO {runtimeRole}; GRANT SELECT ON profile.schema_version TO {runtimeRole}; GRANT USAGE ON SCHEMA observations TO {runtimeRole}; GRANT SELECT,INSERT,UPDATE,DELETE ON observations.observation TO {runtimeRole}; GRANT SELECT ON observations.schema_version TO {runtimeRole};",db).ExecuteNonQueryAsync(); - RuntimeConnectionString=new NpgsqlConnectionStringBuilder(ConnectionString){Username=runtimeRole,Password="test-runtime-only"}.ConnectionString; - Start(); - } - public static string FindRoot() - { - var d=new DirectoryInfo(AppContext.BaseDirectory); - while(d is not null && !File.Exists(Path.Combine(d.FullName,"HealthApp.slnx")))d=d.Parent; - return d?.FullName??throw new InvalidOperationException("root missing"); - } - internal PatientDbContext CreateDbContext()=>new(new DbContextOptionsBuilder().UseNpgsql(ConnectionString).Options); - private void Start() - { - host=new WebApplicationFactory().WithWebHostBuilder(b=>{ - b.UseEnvironment("Development");b.ConfigureKestrel(k=>k.Listen(IPAddress.Loopback,0)); - b.ConfigureAppConfiguration((_,c)=>c.AddInMemoryCollection(Authentication.Configuration()).AddInMemoryCollection(AdditionalGatewayConfiguration).AddInMemoryCollection(new Dictionary{["ConnectionStrings:HealthDatabase"]=RuntimeConnectionString})); - b.ConfigureServices(s=>{s.PostConfigure("Bearer",o=>o.TimeProvider=Authentication.Clock);ConfigureServices?.Invoke(s);}); - }); - host.UseKestrel(0);RawClient=host.CreateClient();Client=Authentication.Wrap(RawClient); - } - public virtual async Task RestartHostsAsync(){Client.Dispose();RawClient.Dispose();if(host is not null)await host.DisposeAsync();Start();} - public async Task DisposeAsync() - { - Client?.Dispose();RawClient?.Dispose();if(host is not null)await host.DisposeAsync(); - NpgsqlConnection.ClearAllPools(); - if(admin.Length>0){await using var c=new NpgsqlConnection(admin);await c.OpenAsync();await new NpgsqlCommand($"DROP DATABASE IF EXISTS {databaseName} WITH(FORCE); DROP ROLE IF EXISTS {runtimeRole};",c).ExecuteNonQueryAsync();} - if(Directory.Exists(Authentication.KeyDirectory))Directory.Delete(Authentication.KeyDirectory,true); - } + private readonly string databaseName = "architecture_b_" + Guid.NewGuid().ToString("N"); + private readonly string runtimeRole = "b_runtime_" + Guid.NewGuid().ToString("N"); + private string admin = ""; + private WebApplicationFactory? host; + public string ConnectionString { get; private set; } = ""; + public string RuntimeConnectionString { get; protected set; } = ""; + public HttpClient Client { get; private set; } = null!; + public HttpClient RawClient { get; private set; } = null!; + public AuthenticatedTestClient Authentication { get; } = new(); + public Action? ConfigureServices { get; set; } + public Dictionary AdditionalGatewayConfiguration { get; } = new(); + public async Task InitializeAsync() + { + admin = Environment.GetEnvironmentVariable("TEST_POSTGRES_CONNECTION") ?? throw new InvalidOperationException("TEST_POSTGRES_CONNECTION required."); + await using var c = new NpgsqlConnection(admin); await c.OpenAsync(); + await new NpgsqlCommand($"CREATE DATABASE {databaseName}; CREATE ROLE {runtimeRole} LOGIN PASSWORD 'test-runtime-only';", c).ExecuteNonQueryAsync(); + ConnectionString = new NpgsqlConnectionStringBuilder(admin) { Database = databaseName, SearchPath = "profile,observations" }.ConnectionString; + await using var db = new NpgsqlConnection(ConnectionString); await db.OpenAsync(); + var root = FindRoot(); + foreach (var _ in new[] { 0, 1 }) + foreach (var script in new[] { "Profile", "Observations" }.SelectMany(m => Directory.GetFiles(Path.Combine(root, "src/Modules", m, "Migrations"), "*.sql").Order())) + await new NpgsqlCommand(await File.ReadAllTextAsync(script), db).ExecuteNonQueryAsync(); + await new NpgsqlCommand($"REVOKE CREATE ON SCHEMA public FROM PUBLIC; GRANT CONNECT ON DATABASE {databaseName} TO {runtimeRole}; GRANT USAGE ON SCHEMA profile TO {runtimeRole}; GRANT SELECT,INSERT,UPDATE ON profile.patient TO {runtimeRole}; GRANT SELECT ON profile.schema_version TO {runtimeRole}; GRANT USAGE ON SCHEMA observations TO {runtimeRole}; GRANT SELECT,INSERT,UPDATE,DELETE ON observations.observation TO {runtimeRole}; GRANT SELECT ON observations.schema_version TO {runtimeRole};", db).ExecuteNonQueryAsync(); + RuntimeConnectionString = new NpgsqlConnectionStringBuilder(ConnectionString) { Username = runtimeRole, Password = "test-runtime-only" }.ConnectionString; + Start(); + } + public static string FindRoot() + { + var d = new DirectoryInfo(AppContext.BaseDirectory); + while (d is not null && !File.Exists(Path.Combine(d.FullName, "HealthApp.slnx"))) d = d.Parent; + return d?.FullName ?? throw new InvalidOperationException("root missing"); + } + internal PatientDbContext CreateDbContext() => new(new DbContextOptionsBuilder().UseNpgsql(ConnectionString).Options); + private void Start() + { + host = new WebApplicationFactory().WithWebHostBuilder(b => + { + b.UseEnvironment("Development"); b.ConfigureKestrel(k => k.Listen(IPAddress.Loopback, 0)); + b.ConfigureAppConfiguration((_, c) => c.AddInMemoryCollection(Authentication.Configuration()).AddInMemoryCollection(AdditionalGatewayConfiguration).AddInMemoryCollection(new Dictionary { ["ConnectionStrings:HealthDatabase"] = RuntimeConnectionString })); + b.ConfigureServices(s => { s.PostConfigure("Bearer", o => o.TimeProvider = Authentication.Clock); ConfigureServices?.Invoke(s); }); + }); + host.UseKestrel(0); RawClient = host.CreateClient(); Client = Authentication.Wrap(RawClient); + } + public virtual async Task RestartHostsAsync() { Client.Dispose(); RawClient.Dispose(); if (host is not null) await host.DisposeAsync(); Start(); } + public async Task DisposeAsync() + { + Client?.Dispose(); RawClient?.Dispose(); if (host is not null) await host.DisposeAsync(); + NpgsqlConnection.ClearAllPools(); + if (admin.Length > 0) { await using var c = new NpgsqlConnection(admin); await c.OpenAsync(); await new NpgsqlCommand($"DROP DATABASE IF EXISTS {databaseName} WITH(FORCE); DROP ROLE IF EXISTS {runtimeRole};", c).ExecuteNonQueryAsync(); } + if (Directory.Exists(Authentication.KeyDirectory)) Directory.Delete(Authentication.KeyDirectory, true); + } } diff --git a/tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs b/tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs index 4d19666..ae3e1b8 100644 --- a/tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs +++ b/tests/HealthApp.AcceptanceTests/PatientAuthenticationTests.cs @@ -239,16 +239,16 @@ public sealed class PatientAuthenticationTests(ObservationApiFixture fixture) : { var patient = await Patient(); using var request = new HttpRequestMessage(HttpMethod.Get, $"/api/patients/{patient.PatientId}"); - request.Headers.Authorization=new("Bearer",patient.Token);request.Headers.Add("X-Gateway-Key","forged"); - using var own=await fixture.RawClient.SendAsync(request);Assert.Equal(HttpStatusCode.OK,own.StatusCode); - using var bypass=new HttpRequestMessage(HttpMethod.Get,"/api/patients/by-account/"+patient.Account); - bypass.Headers.Authorization=new("Bearer",patient.Token); - using var absent=await fixture.RawClient.SendAsync(bypass);Assert.Equal(HttpStatusCode.NotFound,absent.StatusCode); - foreach(var path in new[]{"/api/patients","/api/patients/by-account/test-0"}) + request.Headers.Authorization = new("Bearer", patient.Token); request.Headers.Add("X-Gateway-Key", "forged"); + using var own = await fixture.RawClient.SendAsync(request); Assert.Equal(HttpStatusCode.OK, own.StatusCode); + using var bypass = new HttpRequestMessage(HttpMethod.Get, "/api/patients/by-account/" + patient.Account); + bypass.Headers.Authorization = new("Bearer", patient.Token); + using var absent = await fixture.RawClient.SendAsync(bypass); Assert.Equal(HttpStatusCode.NotFound, absent.StatusCode); + foreach (var path in new[] { "/api/patients", "/api/patients/by-account/test-0" }) { - using var forged=new HttpRequestMessage(path=="/api/patients"?HttpMethod.Post:HttpMethod.Get,path){Content=path=="/api/patients"?JsonContent.Create(ProfileRequest):null}; - forged.Headers.Add("X-Service-Key",fixture.Authentication.ObservationServiceKey); - using var denied=await fixture.RawClient.SendAsync(forged);Assert.Equal(HttpStatusCode.Unauthorized,denied.StatusCode); + using var forged = new HttpRequestMessage(path == "/api/patients" ? HttpMethod.Post : HttpMethod.Get, path) { Content = path == "/api/patients" ? JsonContent.Create(ProfileRequest) : null }; + forged.Headers.Add("X-Service-Key", fixture.Authentication.ObservationServiceKey); + using var denied = await fixture.RawClient.SendAsync(forged); Assert.Equal(HttpStatusCode.Unauthorized, denied.StatusCode); } } diff --git a/tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs b/tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs index ef64e80..8723c3d 100644 --- a/tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs +++ b/tests/HealthApp.AcceptanceTests/ProfessionalAccessTests.cs @@ -26,8 +26,12 @@ public sealed class ProfessionalAccessTests(ObservationApiFixture fixture) : ICl { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68, - context = "Resting", note = "Actual conditions" + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68, + context = "Resting", + note = "Actual conditions" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; diff --git a/tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs b/tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs index d9309ab..0425908 100644 --- a/tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs +++ b/tests/HealthApp.AcceptanceTests/ProfileLifecycleTests.cs @@ -7,26 +7,27 @@ using Npgsql; using PatientProfile.AcceptanceTests; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class ProfileLifecycleTests(PatientApiFixture fixture) : IClassFixture { - [Fact] - public async Task Concurrent_creation_lost_response_and_restart_preserve_one_accessible_profile() - { - var token=await AuthenticatedTestClient.LoginAsync(fixture.RawClient,"test-200"); - async Task Create(){using var r=new HttpRequestMessage(HttpMethod.Post,"/api/patients"){Content=JsonContent.Create(new{name="Concurrent",dateOfBirth="1980-01-01"})};r.Headers.Authorization=new AuthenticationHeaderValue("Bearer",token);return await fixture.RawClient.SendAsync(r);} - var responses=await Task.WhenAll(Create(),Create()); - Assert.Single(responses,r=>r.StatusCode==HttpStatusCode.Created);Assert.Single(responses,r=>r.StatusCode==HttpStatusCode.Conflict); - using var retry=await Create();Assert.Equal(HttpStatusCode.Conflict,retry.StatusCode); - await using(var db=fixture.CreateDbContext()){Assert.Equal(1,await db.Patients.CountAsync(p=>p.AccountId=="test-200"));} - await fixture.RestartHostsAsync();using var read=new HttpRequestMessage(HttpMethod.Get,"/api/patients/me");read.Headers.Authorization=new AuthenticationHeaderValue("Bearer",token); - using var found=await fixture.RawClient.SendAsync(read);Assert.Equal(HttpStatusCode.OK,found.StatusCode); - foreach(var response in responses)response.Dispose(); - } - [Fact] - public async Task Runtime_role_cannot_create_or_drop_health_objects() - { - await using var c=new NpgsqlConnection(fixture.RuntimeConnectionString);await c.OpenAsync(); - var e=await Assert.ThrowsAsync(()=>new NpgsqlCommand("CREATE TABLE profile.forbidden(id integer)",c).ExecuteNonQueryAsync());Assert.Equal("42501",e.SqlState); - e=await Assert.ThrowsAsync(()=>new NpgsqlCommand("DROP TABLE profile.patient",c).ExecuteNonQueryAsync());Assert.Equal("42501",e.SqlState); - } + [Fact] + public async Task Concurrent_creation_lost_response_and_restart_preserve_one_accessible_profile() + { + var token = await AuthenticatedTestClient.LoginAsync(fixture.RawClient, "test-200"); + async Task Create() { using var r = new HttpRequestMessage(HttpMethod.Post, "/api/patients") { Content = JsonContent.Create(new { name = "Concurrent", dateOfBirth = "1980-01-01" }) }; r.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); return await fixture.RawClient.SendAsync(r); } + var responses = await Task.WhenAll(Create(), Create()); + Assert.Single(responses, r => r.StatusCode == HttpStatusCode.Created); Assert.Single(responses, r => r.StatusCode == HttpStatusCode.Conflict); + using var retry = await Create(); Assert.Equal(HttpStatusCode.Conflict, retry.StatusCode); + await using (var db = fixture.CreateDbContext()) { Assert.Equal(1, await db.Patients.CountAsync(p => p.AccountId == "test-200")); } + await fixture.RestartHostsAsync(); using var read = new HttpRequestMessage(HttpMethod.Get, "/api/patients/me"); read.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); + using var found = await fixture.RawClient.SendAsync(read); Assert.Equal(HttpStatusCode.OK, found.StatusCode); + foreach (var response in responses) response.Dispose(); + } + [Fact] + public async Task Runtime_role_cannot_create_or_drop_health_objects() + { + await using var c = new NpgsqlConnection(fixture.RuntimeConnectionString); await c.OpenAsync(); + var e = await Assert.ThrowsAsync(() => new NpgsqlCommand("CREATE TABLE profile.forbidden(id integer)", c).ExecuteNonQueryAsync()); Assert.Equal("42501", e.SqlState); + e = await Assert.ThrowsAsync(() => new NpgsqlCommand("DROP TABLE profile.patient", c).ExecuteNonQueryAsync()); Assert.Equal("42501", e.SqlState); + } } diff --git a/tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs b/tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs index 1d9bf16..7d89487 100644 --- a/tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs +++ b/tests/HealthApp.AcceptanceTests/RecordMeasurementContextTests.cs @@ -27,8 +27,13 @@ public sealed class RecordMeasurementContextTests(ObservationApiFixture fixture) private Task Record(Guid patientId, object? measurementContext, string? context = null, string? note = null) => fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68, - measurementContext, context, note + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68, + measurementContext, + context, + note }); [Fact] @@ -75,8 +80,14 @@ public sealed class RecordMeasurementContextTests(ObservationApiFixture fixture) public async Task Setting_and_activity_are_independent_and_departures_from_guidance_are_valid(string setting, string activity) { var patient = await Patient(); - using var response = await Record(patient, new { setting, activityCondition = activity, - restDurationMinutes = 0m, bodyPosition = "Standing", additionalCircumstances = "Walking immediately beforehand" }); + using var response = await Record(patient, new + { + setting, + activityCondition = activity, + restDurationMinutes = 0m, + bodyPosition = "Standing", + additionalCircumstances = "Walking immediately beforehand" + }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); var saved = (await response.Content.ReadFromJsonAsync())!; Assert.Equal(setting, saved.MeasurementContext.Setting); @@ -116,8 +127,12 @@ public sealed class RecordMeasurementContextTests(ObservationApiFixture fixture) public async Task Conflicting_categories_and_narrative_are_preserved_without_relabelling() { var patient = await Patient(); - using var response = await Record(patient, new { setting = "Home", activityCondition = "AtRest", - additionalCircumstances = "During exercise" }, "During exercise", "Recorded as supplied"); + using var response = await Record(patient, new + { + setting = "Home", + activityCondition = "AtRest", + additionalCircumstances = "During exercise" + }, "During exercise", "Recorded as supplied"); Assert.Equal(HttpStatusCode.Created, response.StatusCode); var saved = (await response.Content.ReadFromJsonAsync())!; Assert.Equal("AtRest", saved.MeasurementContext.ActivityCondition); @@ -166,8 +181,14 @@ public sealed class RecordMeasurementContextTests(ObservationApiFixture fixture) { using var request = new HttpRequestMessage(HttpMethod.Post, $"/api/patients/{patient}/observations") { - Content = JsonContent.Create(new { measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, - pulse = 68, measurementContext = new { setting = "Clinic" } }) + Content = JsonContent.Create(new + { + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68, + measurementContext = new { setting = "Clinic" } + }) }; request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); using var response = await fixture.RawClient.SendAsync(request); diff --git a/tests/HealthApp.AcceptanceTests/RecordObservationTests.cs b/tests/HealthApp.AcceptanceTests/RecordObservationTests.cs index 633fb98..91030ed 100644 --- a/tests/HealthApp.AcceptanceTests/RecordObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/RecordObservationTests.cs @@ -17,7 +17,8 @@ public sealed class RecordObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Steffen Example", dateOfBirth = "1980-01-01" + name = "Steffen Example", + dateOfBirth = "1980-01-01" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!.PatientId; @@ -29,8 +30,12 @@ public sealed class RecordObservationTests(ObservationApiFixture fixture) : ICla var patientId = await CreatePatientAsync(); using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68, - context = "Resting", note = "Before breakfast" + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68, + context = "Resting", + note = "Before breakfast" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); var saved = await response.Content.ReadFromJsonAsync(); @@ -79,7 +84,10 @@ public sealed class RecordObservationTests(ObservationApiFixture fixture) : ICla var before = await db.Observations.CountAsync(); using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic, diastolic, pulse + measuredAt = "2026-09-12T08:00:00", + systolic, + diastolic, + pulse }); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); Assert.Equal(before, await db.Observations.CountAsync()); @@ -113,7 +121,10 @@ public sealed class RecordObservationTests(ObservationApiFixture fixture) : ICla var before = await db.Observations.CountAsync(); using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{Guid.NewGuid()}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68 + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68 }); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(before, await db.Observations.CountAsync()); @@ -137,7 +148,10 @@ public sealed class RecordObservationTests(ObservationApiFixture fixture) : ICla { using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 128, diastolic = 82, pulse = 68 + measuredAt = "2026-09-12T08:00:00", + systolic = 128, + diastolic = 82, + pulse = 68 }); Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode); Assert.Equal(before, await db.Observations.CountAsync()); diff --git a/tests/HealthApp.AcceptanceTests/SnapshotTests.cs b/tests/HealthApp.AcceptanceTests/SnapshotTests.cs index 91d5b69..df63d39 100644 --- a/tests/HealthApp.AcceptanceTests/SnapshotTests.cs +++ b/tests/HealthApp.AcceptanceTests/SnapshotTests.cs @@ -6,52 +6,54 @@ using Npgsql; using Observation.AcceptanceTests; using Xunit; namespace HealthApp.AcceptanceTests; + public sealed class SnapshotTests(ObservationApiFixture fixture) : IClassFixture { - [Fact] - public async Task Overview_is_coherent_and_next_snapshot_sees_commits() - { - using var create=await fixture.Client.PostAsJsonAsync("/api/patients",new{name="Before",dateOfBirth="1980-01-01"});var p=(await create.Content.ReadFromJsonAsync())!; - using var record=await fixture.Client.PostAsJsonAsync($"/api/patients/{p.PatientId}/observations",new{measuredAt="2026-09-12T08:00:00",systolic=120,diastolic=80,pulse=60});var o=(await record.Content.ReadFromJsonAsync())!; - var captured=new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);var resume=new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var armed=1;var selectedCount=0;var releasedBeforeReturn=false; - fixture.ConfigureServices=services=>{ - var pd=services.Last(d=>d.ServiceType==typeof(ProfileQueries));services.Remove(pd); - services.AddScoped(sp=>new PausingProfile((ProfileQueries)pd.ImplementationFactory!(sp),async()=>{if(Interlocked.Exchange(ref armed,0)==1){captured.SetResult();await resume.Task;}})); - var od=services.Last(d=>d.ServiceType==typeof(ObservationQueries));services.Remove(od); - services.AddScoped(sp=>new CountingObservations((ObservationQueries)od.ImplementationFactory!(sp),()=>Interlocked.Increment(ref selectedCount))); - var ad=services.Last(d=>d.ServiceType==typeof(AnalyticsQueries));services.Remove(ad); - services.AddScoped(sp=>new CheckingAnalytics((AnalyticsQueries)ActivatorUtilities.CreateInstance(sp,ad.ImplementationType!),()=>releasedBeforeReturn=!sp.GetRequiredService().Active)); - }; - await fixture.RestartHostsAsync(); - try - { - var path=$"/api/patients/{p.PatientId}/overview?from=2026-09-01&to=2026-09-30"; - var reading=fixture.Client.GetFromJsonAsync(path); - await captured.Task.WaitAsync(TimeSpan.FromSeconds(10)); - await using(var c=new NpgsqlConnection(fixture.ConnectionString)) - {await c.OpenAsync();await using var t=await c.BeginTransactionAsync();var cmd=new NpgsqlCommand("UPDATE profile.patient SET name='After' WHERE patient_id=@p; UPDATE observations.observation SET systolic=180 WHERE observation_id=@o",c,t);cmd.Parameters.AddWithValue("p",p.PatientId);cmd.Parameters.AddWithValue("o",o.ObservationId);await cmd.ExecuteNonQueryAsync();await t.CommitAsync();} - resume.SetResult();var first=(await reading)!; - Assert.Equal("Before",first.Patient.Name);Assert.Equal(120,first.LatestObservation!.Systolic);Assert.Equal(120m,first.Insight!.AverageSystolic);Assert.Equal(1,selectedCount);Assert.True(releasedBeforeReturn); - var next=(await fixture.Client.GetFromJsonAsync(path))!;Assert.Equal("After",next.Patient.Name);Assert.Equal(180,next.LatestObservation!.Systolic);Assert.Equal(180m,next.Insight!.AverageSystolic); - } - finally{resume.TrySetResult();fixture.ConfigureServices=null;await fixture.RestartHostsAsync();} - } - private sealed class PausingProfile(ProfileQueries inner,Func pause) : ProfileQueries - { - public Task ResolveAccountAsync(string a,CancellationToken ct)=>inner.ResolveAccountAsync(a,ct); - public async Task GetAsync(AuthorizedPatientContext s,CancellationToken ct){var p=await inner.GetAsync(s,ct);await pause();return p;} - } - private sealed class CountingObservations(ObservationQueries inner,Action count) : ObservationQueries - { - public Task ResolveOwnerAsync(Guid id,CancellationToken ct)=>inner.ResolveOwnerAsync(id,ct); - public Task GetAsync(AuthorizedPatientContext s,Guid id,CancellationToken ct)=>inner.GetAsync(s,id,ct); - public Task LatestAsync(AuthorizedPatientContext s,CancellationToken ct)=>inner.LatestAsync(s,ct); - public Task> SelectedAsync(AuthorizedPatientContext s,DateTime f,DateTime t,ContextSelection c,CancellationToken ct){count();return inner.SelectedAsync(s,f,t,c,ct);} - } - private sealed class CheckingAnalytics(AnalyticsQueries inner,Action check) : AnalyticsQueries - { - public async Task InsightAsync(AuthorizedPatientContext s,DateTime f,DateTime t,ContextSelection c,CancellationToken ct){var v=await inner.InsightAsync(s,f,t,c,ct);check();return v;} - public Task TrendAsync(AuthorizedPatientContext s,DateTime f,DateTime t,ContextSelection c,CancellationToken ct)=>inner.TrendAsync(s,f,t,c,ct); - } + [Fact] + public async Task Overview_is_coherent_and_next_snapshot_sees_commits() + { + using var create = await fixture.Client.PostAsJsonAsync("/api/patients", new { name = "Before", dateOfBirth = "1980-01-01" }); var p = (await create.Content.ReadFromJsonAsync())!; + using var record = await fixture.Client.PostAsJsonAsync($"/api/patients/{p.PatientId}/observations", new { measuredAt = "2026-09-12T08:00:00", systolic = 120, diastolic = 80, pulse = 60 }); var o = (await record.Content.ReadFromJsonAsync())!; + var captured = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var resume = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var armed = 1; var selectedCount = 0; var releasedBeforeReturn = false; + fixture.ConfigureServices = services => + { + var pd = services.Last(d => d.ServiceType == typeof(ProfileQueries)); services.Remove(pd); + services.AddScoped(sp => new PausingProfile((ProfileQueries)pd.ImplementationFactory!(sp), async () => { if (Interlocked.Exchange(ref armed, 0) == 1) { captured.SetResult(); await resume.Task; } })); + var od = services.Last(d => d.ServiceType == typeof(ObservationQueries)); services.Remove(od); + services.AddScoped(sp => new CountingObservations((ObservationQueries)od.ImplementationFactory!(sp), () => Interlocked.Increment(ref selectedCount))); + var ad = services.Last(d => d.ServiceType == typeof(AnalyticsQueries)); services.Remove(ad); + services.AddScoped(sp => new CheckingAnalytics((AnalyticsQueries)ActivatorUtilities.CreateInstance(sp, ad.ImplementationType!), () => releasedBeforeReturn = !sp.GetRequiredService().Active)); + }; + await fixture.RestartHostsAsync(); + try + { + var path = $"/api/patients/{p.PatientId}/overview?from=2026-09-01&to=2026-09-30"; + var reading = fixture.Client.GetFromJsonAsync(path); + await captured.Task.WaitAsync(TimeSpan.FromSeconds(10)); + await using (var c = new NpgsqlConnection(fixture.ConnectionString)) + { await c.OpenAsync(); await using var t = await c.BeginTransactionAsync(); var cmd = new NpgsqlCommand("UPDATE profile.patient SET name='After' WHERE patient_id=@p; UPDATE observations.observation SET systolic=180 WHERE observation_id=@o", c, t); cmd.Parameters.AddWithValue("p", p.PatientId); cmd.Parameters.AddWithValue("o", o.ObservationId); await cmd.ExecuteNonQueryAsync(); await t.CommitAsync(); } + resume.SetResult(); var first = (await reading)!; + Assert.Equal("Before", first.Patient.Name); Assert.Equal(120, first.LatestObservation!.Systolic); Assert.Equal(120m, first.Insight!.AverageSystolic); Assert.Equal(1, selectedCount); Assert.True(releasedBeforeReturn); + var next = (await fixture.Client.GetFromJsonAsync(path))!; Assert.Equal("After", next.Patient.Name); Assert.Equal(180, next.LatestObservation!.Systolic); Assert.Equal(180m, next.Insight!.AverageSystolic); + } + finally { resume.TrySetResult(); fixture.ConfigureServices = null; await fixture.RestartHostsAsync(); } + } + private sealed class PausingProfile(ProfileQueries inner, Func pause) : ProfileQueries + { + public Task ResolveAccountAsync(string a, CancellationToken ct) => inner.ResolveAccountAsync(a, ct); + public async Task GetAsync(AuthorizedPatientContext s, CancellationToken ct) { var p = await inner.GetAsync(s, ct); await pause(); return p; } + } + private sealed class CountingObservations(ObservationQueries inner, Action count) : ObservationQueries + { + public Task ResolveOwnerAsync(Guid id, CancellationToken ct) => inner.ResolveOwnerAsync(id, ct); + public Task GetAsync(AuthorizedPatientContext s, Guid id, CancellationToken ct) => inner.GetAsync(s, id, ct); + public Task LatestAsync(AuthorizedPatientContext s, CancellationToken ct) => inner.LatestAsync(s, ct); + public Task> SelectedAsync(AuthorizedPatientContext s, DateTime f, DateTime t, ContextSelection c, CancellationToken ct) { count(); return inner.SelectedAsync(s, f, t, c, ct); } + } + private sealed class CheckingAnalytics(AnalyticsQueries inner, Action check) : AnalyticsQueries + { + public async Task InsightAsync(AuthorizedPatientContext s, DateTime f, DateTime t, ContextSelection c, CancellationToken ct) { var v = await inner.InsightAsync(s, f, t, c, ct); check(); return v; } + public Task TrendAsync(AuthorizedPatientContext s, DateTime f, DateTime t, ContextSelection c, CancellationToken ct) => inner.TrendAsync(s, f, t, c, ct); + } } diff --git a/tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs b/tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs index 598a582..9e6c8ce 100644 --- a/tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs +++ b/tests/HealthApp.AcceptanceTests/UpdateObservationTests.cs @@ -17,14 +17,19 @@ public sealed class UpdateObservationTests(ObservationApiFixture fixture) : ICla { using var patient = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Correction Example", dateOfBirth = "1980-01-01" + name = "Correction Example", + dateOfBirth = "1980-01-01" }); Assert.Equal(HttpStatusCode.Created, patient.StatusCode); var patientId = (await patient.Content.ReadFromJsonAsync())!.PatientId; using var response = await fixture.Client.PostAsJsonAsync($"/api/patients/{patientId}/observations", new { - measuredAt = "2026-09-12T08:00:00", systolic = 182, diastolic = 82, pulse = 68, - context = "Resting", note = "Before breakfast" + measuredAt = "2026-09-12T08:00:00", + systolic = 182, + diastolic = 82, + pulse = 68, + context = "Resting", + note = "Before breakfast" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); return (await response.Content.ReadFromJsonAsync())!; diff --git a/tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs b/tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs index 60713a8..a86e4fb 100644 --- a/tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs +++ b/tests/HealthApp.AcceptanceTests/UpdatePatientTests.cs @@ -14,7 +14,9 @@ public sealed class UpdatePatientTests(PatientApiFixture fixture) : IClassFixtur { using var createdResponse = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Steffen Example", dateOfBirth = "1980-01-01", contactInfo = "old@example.test" + name = "Steffen Example", + dateOfBirth = "1980-01-01", + contactInfo = "old@example.test" }); Assert.Equal(HttpStatusCode.Created, createdResponse.StatusCode); var created = (await createdResponse.Content.ReadFromJsonAsync())!; @@ -22,7 +24,8 @@ public sealed class UpdatePatientTests(PatientApiFixture fixture) : IClassFixtur using var response = await fixture.Client.PutAsJsonAsync(path, new { - name = "Steffen Updated", contactInfo = "new@example.test" + name = "Steffen Updated", + contactInfo = "new@example.test" }); Assert.Equal(HttpStatusCode.OK, response.StatusCode); var expected = created with { Name = "Steffen Updated", ContactInfo = "new@example.test" }; @@ -40,7 +43,8 @@ public sealed class UpdatePatientTests(PatientApiFixture fixture) : IClassFixtur var path = $"/api/patients/{Guid.NewGuid()}"; using var response = await fixture.Client.PutAsJsonAsync(path, new { - name = "Steffen Example", contactInfo = "new@example.test" + name = "Steffen Example", + contactInfo = "new@example.test" }); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Equal(countBefore, await db.Patients.CountAsync()); @@ -56,14 +60,17 @@ public sealed class UpdatePatientTests(PatientApiFixture fixture) : IClassFixtur { using var createdResponse = await fixture.Client.PostAsJsonAsync("/api/patients", new { - name = "Steffen Example", dateOfBirth = "1980-01-01", contactInfo = "old@example.test" + name = "Steffen Example", + dateOfBirth = "1980-01-01", + contactInfo = "old@example.test" }); Assert.Equal(HttpStatusCode.Created, createdResponse.StatusCode); var created = (await createdResponse.Content.ReadFromJsonAsync())!; var path = $"/api/patients/{created.PatientId}"; using var response = await fixture.Client.PutAsJsonAsync(path, new { - name, contactInfo = "new@example.test" + name, + contactInfo = "new@example.test" }); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); Assert.Equal(created, await fixture.Client.GetFromJsonAsync(path)); diff --git a/tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs b/tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs index 8e24ce8..1b520b8 100644 --- a/tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs +++ b/tests/HealthApp.AcceptanceTests/ViewObservationContextTests.cs @@ -28,16 +28,28 @@ public sealed class ViewObservationContextTests(ObservationApiFixture fixture) : await using var patients = fixture.CreateDbContext(); patients.Patients.Add(new Patient { - PatientId = patientId, AccountId = account, Name = "Retrieval patient", - DateOfBirth = new DateOnly(1980, 1, 1), CreatedAt = timestamp, UpdatedAt = timestamp + PatientId = patientId, + AccountId = account, + Name = "Retrieval patient", + DateOfBirth = new DateOnly(1980, 1, 1), + CreatedAt = timestamp, + UpdatedAt = timestamp }); await patients.SaveChangesAsync(); await using var observations = fixture.CreateObservationDbContext(); observations.Observations.Add(new BloodPressureObservation { - ObservationId = observationId, PatientId = patientId, MeasuredAt = timestamp, - Systolic = 128, Diastolic = 82, Pulse = 68, Context = legacyText, Note = "Saved note", - MeasurementContext = context ?? new(), CreatedAt = timestamp, UpdatedAt = timestamp + ObservationId = observationId, + PatientId = patientId, + MeasuredAt = timestamp, + Systolic = 128, + Diastolic = 82, + Pulse = 68, + Context = legacyText, + Note = "Saved note", + MeasurementContext = context ?? new(), + CreatedAt = timestamp, + UpdatedAt = timestamp }); await observations.SaveChangesAsync(); return new Saved(account, patientId, observationId); @@ -55,9 +67,14 @@ public sealed class ViewObservationContextTests(ObservationApiFixture fixture) : { var saved = await Seed(new MeasurementContext { - Setting = "Home", ActivityCondition = "AtRest", RestDurationMinutes = 5.5m, - BodyPosition = "Seated", MeasuredArm = "Right", DeviceDetails = "Recorded device", - CuffDetails = "Recorded cuff", AdditionalCircumstances = "Recorded circumstances" + Setting = "Home", + ActivityCondition = "AtRest", + RestDurationMinutes = 5.5m, + BodyPosition = "Seated", + MeasuredArm = "Right", + DeviceDetails = "Recorded device", + CuffDetails = "Recorded cuff", + AdditionalCircumstances = "Recorded circumstances" }, "Original context text"); await fixture.RestartHostsAsync(); var token = await AuthenticatedTestClient.LoginAsync(fixture.RawClient, saved.AccountId); @@ -135,8 +152,12 @@ public sealed class ViewObservationContextTests(ObservationApiFixture fixture) : [Fact] public async Task Assigned_professional_reads_the_same_context_as_the_owner() { - var saved = await Seed(new MeasurementContext { Setting = "Clinic", ActivityCondition = "AfterActivity", - AdditionalCircumstances = "Actual circumstances" }, "Original narrative"); + var saved = await Seed(new MeasurementContext + { + Setting = "Clinic", + ActivityCondition = "AfterActivity", + AdditionalCircumstances = "Actual circumstances" + }, "Original narrative"); fixture.AdditionalGatewayConfiguration["Access:ProfessionalAssignments:professional:0"] = saved.PatientId.ToString(); await fixture.RestartHostsAsync(); var patientToken = await AuthenticatedTestClient.LoginAsync(fixture.RawClient, saved.AccountId); diff --git a/tests/HealthApp.DeploymentTests/HealthApp.DeploymentTests.csproj b/tests/HealthApp.DeploymentTests/HealthApp.DeploymentTests.csproj new file mode 100644 index 0000000..ecb08b3 --- /dev/null +++ b/tests/HealthApp.DeploymentTests/HealthApp.DeploymentTests.csproj @@ -0,0 +1 @@ +net10.0trueenableenable diff --git a/tests/HealthApp.DeploymentTests/ProvisioningTests.cs b/tests/HealthApp.DeploymentTests/ProvisioningTests.cs new file mode 100644 index 0000000..0c3854a --- /dev/null +++ b/tests/HealthApp.DeploymentTests/ProvisioningTests.cs @@ -0,0 +1,51 @@ +using System.Diagnostics; +using System.Security.Cryptography.X509Certificates; +using System.Text.Json; +using HealthApp.Provisioning; +using Xunit; +namespace HealthApp.DeploymentTests; + +public sealed class ProvisioningTests +{ + [Fact] + public void Preparation_generates_scoped_protected_material_and_refuses_overwrite() + { + var root = Path.Combine(Path.GetTempPath(), "healthapp-b-prepare-" + Guid.NewGuid()); var plan = Path.Combine(root, "plan"); Directory.CreateDirectory(root); + try + { + Installation.Prepare(plan, "localhost", 5443, root, null, null, null); + using var json = JsonDocument.Parse(File.ReadAllText(Path.Combine(plan, "installation.json"))); var password = json.RootElement.GetProperty("CertificatePassword").GetString(); + using var cert = X509CertificateLoader.LoadPkcs12FromFile(Path.Combine(plan, "application.pfx"), password); Assert.True(cert.HasPrivateKey); + Assert.Equal(3, json.RootElement.GetProperty("Accounts").GetArrayLength()); Assert.DoesNotContain("Service-Key", json.RootElement.GetRawText()); + if (OperatingSystem.IsLinux()) Assert.Equal(UnixFileMode.UserRead | UnixFileMode.UserWrite, File.GetUnixFileMode(Path.Combine(plan, "installation.json"))); + Assert.Throws(() => Installation.Prepare(plan, "localhost", 5443, root, null, null, null)); + } + finally { Directory.Delete(root, true); } + } + [Theory] + [InlineData("debian", "12", false)] + [InlineData("debian", "12", true)] + [InlineData("fedora", "43", false)] + [InlineData("fedora", "43", true)] + [InlineData("manjaro", "rolling", false)] + [InlineData("manjaro", "rolling", true)] + public async Task Distribution_adapters_install_local_persistence_only_when_selected(string distribution, string version, bool local) + { + if (!OperatingSystem.IsLinux()) return; + var root = Path.Combine(Path.GetTempPath(), "healthapp-b-adapter-" + Guid.NewGuid()); Directory.CreateDirectory(root); + try + { + var executable = Path.Combine(root, "commands"); Directory.CreateDirectory(executable); var log = Path.Combine(root, "commands.log"); + foreach (var name in new[] { "apt-get", "dnf", "pacman", "systemctl", "install", "runuser", "pg_isready" }) + { var p = Path.Combine(executable, name); await File.WriteAllTextAsync(p, "#!/bin/bash\nprintf '%s\\n' \"${0##*/} $*\" >> \"$HEALTHAPP_ADAPTER_LOG\"\n"); File.SetUnixFileMode(p, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); } + var dotnet = Path.Combine(executable, "dotnet"); await File.WriteAllTextAsync(dotnet, "#!/bin/bash\necho 'Microsoft.AspNetCore.App 10.0.12 [/test]'\n"); File.SetUnixFileMode(dotnet, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute); + var os = Path.Combine(root, "os-release"); await File.WriteAllTextAsync(os, $"ID={distribution}\nVERSION_ID={version}\n"); + var repository = FindRoot(); var script = Path.Combine(root, "run.sh"); await File.WriteAllTextAsync(script, $"source '{repository}/deploy/installer/bootstrap.sh'\ndotnet='{dotnet}'\nmode={(local ? "local" : "remote")}\nfail() {{ exit 9; }}\nensure_dependencies\n"); + var start = new ProcessStartInfo("bash") { UseShellExecute = false, RedirectStandardError = true, RedirectStandardOutput = true }; start.ArgumentList.Add(script); start.Environment["PATH"] = executable + ":" + Environment.GetEnvironmentVariable("PATH"); start.Environment["HEALTHAPP_OS_RELEASE"] = os; start.Environment["HEALTHAPP_ADAPTER_LOG"] = log; + using var process = Process.Start(start)!; var output = process.StandardOutput.ReadToEndAsync(); var error = process.StandardError.ReadToEndAsync(); await process.WaitForExitAsync(); Assert.True(process.ExitCode == 0, await output + await error); + var commands = File.ReadAllText(log); Assert.Equal(local, commands.Contains("postgresql")); if (local) Assert.Contains("systemctl enable --now postgresql", commands); else Assert.DoesNotContain("pg_isready", commands); + } + finally { Directory.Delete(root, true); } + } + private static string FindRoot() { var d = new DirectoryInfo(AppContext.BaseDirectory); while (d is not null && !File.Exists(Path.Combine(d.FullName, "HealthApp.slnx"))) d = d.Parent; return d!.FullName; } +} diff --git a/tools/comparison/dataset.json b/tools/comparison/dataset.json new file mode 100644 index 0000000..73980e9 --- /dev/null +++ b/tools/comparison/dataset.json @@ -0,0 +1,11 @@ +{ + "version": "synthetic-comparison-1", + "profile": {"name": "Synthetic comparison patient", "dateOfBirth": "1980-01-01", "contactInfo": "comparison@example.test"}, + "observations": [ + {"measuredAt": "2026-09-10T08:00:00", "systolic": 150, "diastolic": 92, "pulse": 70, "measurementContext": {"setting": "Home", "activityCondition": "AtRest", "restDurationMinutes": 5, "bodyPosition": "Seated", "measuredArm": "Left", "deviceDetails": "Synthetic device", "cuffDetails": "Synthetic cuff"}}, + {"measuredAt": "2026-09-11T08:00:00", "systolic": 140, "diastolic": 88, "pulse": 68, "measurementContext": {"setting": "Home", "activityCondition": "AtRest", "restDurationMinutes": 5, "bodyPosition": "Seated", "measuredArm": "Left", "deviceDetails": "Synthetic device", "cuffDetails": "Synthetic cuff"}}, + {"measuredAt": "2026-09-12T08:00:00", "systolic": 160, "diastolic": 95, "pulse": 80, "measurementContext": {"setting": "Clinic", "activityCondition": "AtRest"}}, + {"measuredAt": "2026-09-13T08:00:00", "systolic": 145, "diastolic": 90, "pulse": 110, "measurementContext": {"setting": "Home", "activityCondition": "AfterActivity"}, "context": "After activity", "note": "Synthetic departure from routine"}, + {"measuredAt": "2026-09-14T08:00:00", "systolic": 130, "diastolic": 84, "pulse": 65, "context": "Synthetic historical text; setting unknown"} + ] +} diff --git a/tools/comparison/initialize.py b/tools/comparison/initialize.py new file mode 100644 index 0000000..c159fa9 --- /dev/null +++ b/tools/comparison/initialize.py @@ -0,0 +1,54 @@ +"""Initialize a fresh disposable comparison instance via the unchanged public API. +Never run on an existing Architecture A database/production deployment. +""" +import argparse +import hashlib +import json +import pathlib +import ssl +import urllib.request +import urllib.error + +parser = argparse.ArgumentParser() +parser.add_argument('--url', required=True) +parser.add_argument('--ca', required=True) +parser.add_argument('--account-file', required=True, help='Owner-only JSON with accountId/password') +parser.add_argument('--dataset', default=str(pathlib.Path(__file__).with_name('dataset.json'))) +parser.add_argument('--output', required=True, help='New manifest filename') +args = parser.parse_args() +output = pathlib.Path(args.output) +if output.exists(): + raise SystemExit('Output manifest already exists; refusing overwrite.') +if not args.url.startswith('https://'): + raise SystemExit('Verified HTTPS is required.') +credentials_path = pathlib.Path(args.account_file) +if credentials_path.stat().st_mode & 0o077: + raise SystemExit('Credentials file must be owner-only.') +credentials = json.loads(credentials_path.read_text()) +data_bytes = pathlib.Path(args.dataset).read_bytes() +data = json.loads(data_bytes) +context = ssl.create_default_context(cafile=args.ca) +token = None + +def request(path, payload): + headers = {'Content-Type': 'application/json'} + if token: + headers['Authorization'] = 'Bearer ' + token + query = urllib.request.Request(args.url.rstrip('/') + path, + data=json.dumps(payload).encode(), headers=headers) + with urllib.request.urlopen(query, context=context, timeout=30) as response: + return json.load(response) + +try: + token = request('/api/authentication/login', credentials)['accessToken'] + patient = request('/api/patients', data['profile']) + observations = [request('/api/patients/' + patient['patientId'] + '/observations', item) + for item in data['observations']] +except urllib.error.HTTPError as error: + raise SystemExit('Initialization stopped at HTTP ' + str(error.code) + + '; inspect the fresh test instance. No mutation retry or automatic cleanup performed.') +output.write_text(json.dumps({'datasetVersion': data['version'], + 'datasetSha256': hashlib.sha256(data_bytes).hexdigest(), + 'patientId': patient['patientId'], + 'observationIds': [item['observationId'] for item in observations]}, indent=2) + '\n') +print('Fresh synthetic dataset initialized; manifest written. No credentials recorded.') diff --git a/tools/native-install-test/Dockerfile b/tools/native-install-test/Dockerfile new file mode 100644 index 0000000..f97edb8 --- /dev/null +++ b/tools/native-install-test/Dockerfile @@ -0,0 +1,6 @@ +# Verification environment only; Architecture B is installed natively by systemd inside it. +FROM debian:12-slim +ENV container=docker +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y systemd systemd-sysv dbus ca-certificates curl procps && apt-get clean +STOPSIGNAL SIGRTMIN+3 +CMD ["/sbin/init"] diff --git a/tools/native-install-test/README.md b/tools/native-install-test/README.md new file mode 100644 index 0000000..b32c498 --- /dev/null +++ b/tools/native-install-test/README.md @@ -0,0 +1,7 @@ +# Native installer verification environments + +These optional test harnesses execute the real installer and systemd service in isolated Debian 12 environments. Docker is test infrastructure, not an application deployment requirement. Administrative Docker access and privileged containers are needed for systemd; no Architecture A resources or host data directories are mounted. + +Build a fresh release, then set `HEALTHAPP_RELEASE=/absolute/bundle` and run `python3 tools/native-install-test/local.py` and `python3 tools/native-install-test/remote.py`. The local harness builds the verification image first; run it before remote on a fresh machine. Both remove their own test containers. Remote also removes its own network/certificate volume and checks verified hostname rejection plus absence of local PostgreSQL. + +Evidence includes actual distribution/runtime, PID/DB/HTTPS/workflow/restart, protected config permissions, and no-overwrite checks. It does not validate bare-metal networking, every intended distribution, HA, clinical validity or energy efficiency. Package/runtime versions come from feeds and are recorded; they must be controlled separately in a measurement setup. diff --git a/tools/native-install-test/local.py b/tools/native-install-test/local.py new file mode 100644 index 0000000..712994a --- /dev/null +++ b/tools/native-install-test/local.py @@ -0,0 +1,35 @@ +import pathlib,subprocess,secrets,json,time +import os +root=pathlib.Path(__file__).resolve().parents[2] +bundle=pathlib.Path(os.environ['HEALTHAPP_RELEASE']).resolve() +name='healthapp-b-native-'+secrets.token_hex(4) +image='healthapp-b-systemd-test:debian12' +evidence=root/'ImplementationPlan/evidence';evidence.mkdir(exist_ok=True) +def run(args,check=True): + r=subprocess.run(args,capture_output=True,text=True) + if check and r.returncode:raise RuntimeError('Command failed: '+str(args[:3])+'\n'+(r.stdout+r.stderr)[-4000:]) + return r +run(['docker','build','-t',image,str(root/'tools/native-install-test')]) +run(['docker','run','--rm','-d','--privileged','--cgroupns=private','--tmpfs','/run','--tmpfs','/run/lock','--name',name,image]) +try: + for _ in range(60): + r=run(['docker','exec',name,'systemctl','is-system-running'],False) + if r.stdout.strip() in ('running','degraded'):break + time.sleep(.5) + else:raise RuntimeError('systemd did not start') + run(['docker','cp',str(bundle),name+':/release']) + result=run(['docker','exec',name,'bash','/release/install.sh','--host','localhost'],False) + (evidence/'native-debian12.log').write_text(result.stdout+result.stderr) + print((result.stdout+result.stderr)[-5000:]) + if result.returncode: + logs=run(['docker','exec',name,'journalctl','-u','healthapp-b','--no-pager','-n','40'],False) + print(logs.stdout[-4000:]);raise RuntimeError('native installation failed') + config_mode=run(['docker','exec',name,'stat','-c','%a %U %G','/etc/healthapp-b/appsettings.json']).stdout.strip() + if config_mode!='640 root healthapp-b':raise RuntimeError('runtime configuration permissions are incorrect') + before=run(['docker','exec',name,'sha256sum','/etc/healthapp-b/appsettings.json']).stdout + duplicate=run(['docker','exec',name,'bash','/release/install.sh','--host','localhost'],False) + if duplicate.returncode==0 or before!=run(['docker','exec',name,'sha256sum','/etc/healthapp-b/appsettings.json']).stdout:raise RuntimeError('existing installation was overwritten') + data={'environment':run(['docker','exec',name,'cat','/etc/os-release']).stdout,'runtime':run(['docker','exec',name,'dotnet','--list-runtimes']).stdout,'applicationPID':run(['docker','exec',name,'systemctl','show','healthapp-b','--property','MainPID','--value']).stdout.strip(),'databaseStatus':run(['docker','exec',name,'pg_isready']).stdout.strip(),'result':'passed','overwriteRejected':True,'runtimeConfigMode':config_mode,'isolation':'Disposable privileged systemd Linux container; native installer/unit/services executed; not physical-host or measurement evidence'} + (evidence/'native-debian12-summary.json').write_text(json.dumps(data,indent=2)+'\n') + print('Native Debian 12 installation passed.') +finally:run(['docker','stop',name],False) diff --git a/tools/native-install-test/remote.py b/tools/native-install-test/remote.py new file mode 100644 index 0000000..0f8e820 --- /dev/null +++ b/tools/native-install-test/remote.py @@ -0,0 +1,42 @@ +import pathlib,subprocess,secrets,json,time,tempfile +import os +root=pathlib.Path(__file__).resolve().parents[2] +bundle=pathlib.Path(os.environ['HEALTHAPP_RELEASE']).resolve() +identity=secrets.token_hex(4);name='healthapp-b-remote-app-'+identity;db='healthapp-b-remote-db-'+identity;network='healthapp-b-remote-net-'+identity;volume='healthapp-b-remote-cert-'+identity +password=secrets.token_hex(32);temporary=pathlib.Path(tempfile.mkdtemp(prefix='healthapp-b-remote-')) +evidence=root/'ImplementationPlan/evidence' +def run(args,check=True): + r=subprocess.run(args,capture_output=True,text=True) + if check and r.returncode:raise RuntimeError('Command failed: '+str(args[:3])+'\n'+(r.stdout+r.stderr).replace(password,'[redacted]')[-3500:]) + return r +run(['openssl','req','-x509','-newkey','rsa:2048','-nodes','-keyout',str(temporary/'server.key'),'-out',str(temporary/'server.crt'),'-subj','/CN=b-database','-days','2','-addext','subjectAltName=DNS:b-database']) +run(['docker','network','create',network]);run(['docker','volume','create',volume]) +try: + run(['docker','run','--rm','--user','0','--entrypoint','sh','-v',str(temporary)+':/input:ro','-v',volume+':/certs','postgres:18.6','-c','cp /input/server.key /input/server.crt /certs/ && chown 999:999 /certs/server.key /certs/server.crt && chmod 600 /certs/server.key']) + run(['docker','run','--rm','-d','--name',db,'--network',network,'--network-alias','b-database','--network-alias','wrong-b-database','-v',volume+':/certs:ro','-e','POSTGRES_PASSWORD='+password,'postgres:18.6','postgres','-c','ssl=on','-c','ssl_cert_file=/certs/server.crt','-c','ssl_key_file=/certs/server.key']) + for _ in range(60): + if run(['docker','exec',db,'pg_isready','-U','postgres'],False).returncode==0:break + time.sleep(.5) + else:raise RuntimeError('TLS database did not start') + run(['docker','run','--rm','-d','--privileged','--cgroupns=private','--tmpfs','/run','--tmpfs','/run/lock','--name',name,'--network',network,'healthapp-b-systemd-test:debian12']) + for _ in range(60): + if run(['docker','exec',name,'systemctl','is-system-running'],False).stdout.strip() in ('running','degraded'):break + time.sleep(.5) + run(['docker','cp',str(bundle),name+':/release']);run(['docker','cp',str(temporary/'server.crt'),name+':/root/db-ca.crt']) + admin=temporary/'admin.connection';admin.write_text('Host=b-database;Database=postgres;Username=postgres;Password='+password+';SslMode=VerifyFull;RootCertificate=/root/db-ca.crt');admin.chmod(0o600) + run(['docker','cp',str(admin),name+':/root/admin.connection']);run(['docker','exec',name,'chmod','600','/root/admin.connection']) + r=run(['docker','exec',name,'bash','/release/install.sh','--mode','remote','--host','localhost','--postgres-admin-file','/root/admin.connection'],False) + (evidence/'native-debian12-remote.log').write_text((r.stdout+r.stderr).replace(password,'[redacted]'));print((r.stdout+r.stderr).replace(password,'[redacted]')[-4500:]) + if r.returncode: + print(run(['docker','exec',name,'journalctl','-u','healthapp-b','--no-pager','-n','30'],False).stdout[-3000:]);raise RuntimeError('remote installation failed') + config_mode=run(['docker','exec',name,'stat','-c','%a %U %G','/etc/healthapp-b/appsettings.json']).stdout.strip() + if config_mode!='640 root healthapp-b':raise RuntimeError('runtime configuration permissions are incorrect') + noServer=run(['docker','exec',name,'sh','-c','! command -v postgres && ! command -v pg_isready'],False).returncode==0 + if not noServer:raise RuntimeError('remote mode installed local PostgreSQL') + run(['docker','exec',name,'sh','-c',"mkdir /root/wrong-name && sed 's/Host=b-database/Host=wrong-b-database/g' /var/lib/healthapp-b-installation/deployment/installation.json > /root/wrong-name/installation.json"]) + negative=run(['docker','exec',name,'dotnet','/release/provisioner/HealthApp.Provisioning.dll','verify-database','--plan','/root/wrong-name'],False) + if negative.returncode==0:raise RuntimeError('wrong TLS hostname was accepted') + summary={'environment':run(['docker','exec',name,'cat','/etc/os-release']).stdout,'runtime':run(['docker','exec',name,'dotnet','--list-runtimes']).stdout,'database':'PostgreSQL 18.6 separate container/host namespace; TLS certificate SAN b-database','sslMode':'VerifyFull','wrongHostnameRejected':True,'localPostgresInstalled':False,'result':'passed','runtimeConfigMode':config_mode,'isolation':'Separate disposable systemd app and TLS DB containers; no Architecture A database access; not measurement-host evidence'} + (evidence/'native-debian12-remote-summary.json').write_text(json.dumps(summary,indent=2)+'\n');print('Remote Debian 12 native installation passed; local PostgreSQL absent.') +finally: + run(['docker','stop',name],False);run(['docker','stop',db],False);run(['docker','volume','rm',volume],False);run(['docker','network','rm',network],False) diff --git a/tools/run-disposable-tests.py b/tools/run-disposable-tests.py new file mode 100644 index 0000000..5fe7949 --- /dev/null +++ b/tools/run-disposable-tests.py @@ -0,0 +1,49 @@ +"""Optional Docker-backed test harness; deployment itself remains native Linux/systemd.""" +import argparse +import json +import os +import pathlib +import secrets +import subprocess +import time + +parser = argparse.ArgumentParser() +parser.add_argument('--reference', action='store_true', help='Run the preserved B-local A baseline') +parser.add_argument('--image', default='postgres:18.6') +args = parser.parse_args() +repository = pathlib.Path(__file__).resolve().parents[1] +cwd = repository / 'Reference/ArchitectureA' if args.reference else repository +evidence = repository / 'ImplementationPlan/evidence' +evidence.mkdir(exist_ok=True) +label = 'reference' if args.reference else 'b' +name = 'healthapp-b-tests-' + secrets.token_hex(4) +password = secrets.token_hex(32) +container_env = dict(os.environ, POSTGRES_PASSWORD=password) +subprocess.run(['docker', 'run', '--rm', '-d', '--name', name, '-p', '127.0.0.1::5432', + '-e', 'POSTGRES_PASSWORD', args.image], env=container_env, + stdout=subprocess.DEVNULL, check=True) +try: + for attempt in range(60): + if subprocess.run(['docker', 'exec', name, 'pg_isready', '-U', 'postgres'], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0: + break + time.sleep(.5) + else: + raise RuntimeError('Disposable database did not start.') + ports = json.loads(subprocess.check_output( + ['docker', 'inspect', '--format', '{{json .NetworkSettings.Ports}}', name], text=True)) + port = ports['5432/tcp'][0]['HostPort'] + env = dict(os.environ, TEST_POSTGRES_CONNECTION='Host=127.0.0.1;Port=' + port + + ';Database=postgres;Username=postgres;Password=' + password) + dotnet = os.environ.get('HEALTHAPP_DOTNET', 'dotnet') + for stage, command in [('build', ['build', 'HealthApp.slnx', '-c', 'Release']), + ('tests', ['test', 'HealthApp.slnx', '-c', 'Release', '--no-build', + '--logger', 'trx', '--results-directory', str(evidence / (label + '-trx'))])]: + result = subprocess.run([dotnet, *command], cwd=cwd, env=env, capture_output=True, text=True) + output = (result.stdout + result.stderr).replace(password, '[redacted]') + (evidence / (label + '-' + stage + '.log')).write_text(output) + print(output[-5000:]) + if result.returncode: + raise SystemExit(result.returncode) +finally: + subprocess.run(['docker', 'stop', name], stdout=subprocess.DEVNULL, check=True)