Repository navigation
volume-mount: FieldCheck equipment inspections, with persistence you can prove from the dashboard - #2273
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Attachment validation misses the database filename limit, Kestrel rejects permitted multi-file uploads, and production API errors return HTML instead of ProblemDetails.
3 open issues
2 files not reviewed
samples/volume-mount/VolumeMount.Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs: Generated filesamples/volume-mount/VolumeMount.Data/Migrations/20261123102653_InitialInspections.Designer.cs: Generated file
What changed in this PR
This PR turns the persistent-volume sample into FieldCheck, an equipment-inspection tracker that demonstrates SQL Server and Blob Storage persistence through Aspire.
Changes:
- Replaces Identity with inspection records, attachments, and Blazor pages.
- Adds API documentation, domain telemetry, and structured logs.
- Adds dashboard commands for seeding and checking persisted data.
Paths below are relative to samples/volume-mount/.
| File | Description |
|---|---|
| VolumeMount.ServiceDefaults/Extensions.cs | Registers domain telemetry. |
| VolumeMount.MigrationService/Program.cs | Registers inspection migration services. |
| VolumeMount.MigrationService/InspectionDbInitializer.cs | Applies migrations and logs persisted counts. |
| VolumeMount.MigrationService/ApplicationDbInitializer.cs | Removes Identity initializer. |
| VolumeMount.Data/VolumeMount.Data.csproj | Removes Identity dependency. |
| VolumeMount.Data/Migrations/InspectionDbContextModelSnapshot.cs | Adds inspection model snapshot. |
| VolumeMount.Data/Migrations/ApplicationDbContextModelSnapshot.cs | Removes Identity snapshot. |
| VolumeMount.Data/Migrations/20261123102653_InitialInspections.Designer.cs | Adds inspection migration metadata. |
| VolumeMount.Data/Migrations/20261123102653_InitialInspections.cs | Creates inspection and attachment tables. |
| VolumeMount.Data/Migrations/00000000000000_CreateIdentitySchema.cs | Removes Identity migration. |
| VolumeMount.Data/InspectionDbContext.cs | Configures inspection persistence. |
| VolumeMount.Data/Inspection.cs | Defines inspection entities. |
| VolumeMount.Data/ApplicationUser.cs | Removes Identity user model. |
| VolumeMount.Data/ApplicationDbContext.cs | Removes Identity context. |
| VolumeMount.BlazorWeb/wwwroot/favicon.svg | Adds FieldCheck branding. |
| VolumeMount.BlazorWeb/VolumeMount.BlazorWeb.csproj | Replaces Identity with API documentation dependencies. |
| VolumeMount.BlazorWeb/Program.cs | Configures inspection services and API. |
| VolumeMount.BlazorWeb/Log.cs | Adds structured inspection logs. |
| VolumeMount.BlazorWeb/Inspections/SampleData.cs | Generates inspections and attachments. |
| VolumeMount.BlazorWeb/Inspections/InspectionTelemetry.cs | Defines domain traces and metrics. |
| VolumeMount.BlazorWeb/Inspections/InspectionService.cs | Coordinates SQL records and blobs. |
| VolumeMount.BlazorWeb/Inspections/InspectionsApi.cs | Adds inspection and storage endpoints. |
| VolumeMount.BlazorWeb/Inspections/Contracts.cs | Defines validated inputs and responses. |
| VolumeMount.BlazorWeb/Inspections/AttachmentRules.cs | Defines attachment validation. |
| VolumeMount.BlazorWeb/Components/Routes.razor | Removes authentication-aware routing. |
| VolumeMount.BlazorWeb/Components/Pages/Weather.razor | Removes weather demo. |
| VolumeMount.BlazorWeb/Components/Pages/NotFound.razor | Updates branding and navigation. |
| VolumeMount.BlazorWeb/Components/Pages/NewInspection.razor | Adds multipart inspection form. |
| VolumeMount.BlazorWeb/Components/Pages/InspectionDetails.razor | Displays inspections and attachments. |
| VolumeMount.BlazorWeb/Components/Pages/Error.razor | Updates error-page branding. |
| VolumeMount.BlazorWeb/Components/Pages/Auth.razor | Removes authentication demo. |
| VolumeMount.BlazorWeb/Components/Layout/NavMenu.razor.css | Removes old navigation styles. |
| VolumeMount.BlazorWeb/Components/Layout/NavMenu.razor | Removes Identity navigation. |
| VolumeMount.BlazorWeb/Components/Layout/MainLayout.razor.css | Removes old layout styles. |
| VolumeMount.BlazorWeb/Components/Layout/MainLayout.razor | Adds FieldCheck navigation and footer. |
| VolumeMount.BlazorWeb/Components/Layout/AuthLayout.razor | Removes authentication layout. |
| VolumeMount.BlazorWeb/Components/Format.cs | Adds display-formatting helpers. |
| VolumeMount.BlazorWeb/Components/App.razor | Updates theme and removes obsolete assets. |
| VolumeMount.BlazorWeb/Components/Account/Shared/StatusMessage.razor | Removes Identity status messages. |
| VolumeMount.BlazorWeb/Components/Account/Shared/ShowRecoveryCodes.razor | Removes recovery-code display. |
| VolumeMount.BlazorWeb/Components/Account/Shared/RedirectToLogin.razor | Removes login redirect. |
| VolumeMount.BlazorWeb/Components/Account/Shared/PasskeySubmit.razor.js | Removes passkey browser logic. |
| VolumeMount.BlazorWeb/Components/Account/Shared/PasskeySubmit.razor | Removes passkey submission component. |
| VolumeMount.BlazorWeb/Components/Account/Shared/ManageNavMenu.razor | Removes account navigation. |
| VolumeMount.BlazorWeb/Components/Account/Shared/ManageLayout.razor | Removes account layout. |
| VolumeMount.BlazorWeb/Components/Account/Shared/ExternalLoginPicker.razor | Removes external-login picker. |
| VolumeMount.BlazorWeb/Components/Account/PasskeyOperation.cs | Removes passkey operation enum. |
| VolumeMount.BlazorWeb/Components/Account/PasskeyInputModel.cs | Removes passkey input model. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ResetPasswordConfirmation.razor | Removes password-reset confirmation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ResetPassword.razor | Removes password-reset page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ResendEmailConfirmation.razor | Removes confirmation-email resend page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/RegisterConfirmation.razor | Removes registration confirmation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Register.razor | Removes registration page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/TwoFactorAuthentication.razor | Removes two-factor settings. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/SetPassword.razor | Removes password setup. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/ResetAuthenticator.razor | Removes authenticator reset. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/RenamePasskey.razor | Removes passkey renaming. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/PersonalData.razor | Removes personal-data page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/Passkeys.razor | Removes passkey management. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/Index.razor | Removes account profile page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/GenerateRecoveryCodes.razor | Removes recovery-code generation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/ExternalLogins.razor | Removes external-login management. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/EnableAuthenticator.razor | Removes authenticator setup. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/Email.razor | Removes email management. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/Disable2fa.razor | Removes two-factor disable page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/DeletePersonalData.razor | Removes account deletion. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/ChangePassword.razor | Removes password changes. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Manage/_Imports.razor | Removes account authorization imports. |
| VolumeMount.BlazorWeb/Components/Account/Pages/LoginWithRecoveryCode.razor | Removes recovery-code login. |
| VolumeMount.BlazorWeb/Components/Account/Pages/LoginWith2fa.razor | Removes two-factor login. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Login.razor | Removes login page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/Lockout.razor | Removes lockout page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/InvalidUser.razor | Removes invalid-user page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/InvalidPasswordReset.razor | Removes invalid-reset page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ForgotPasswordConfirmation.razor | Removes recovery confirmation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ForgotPassword.razor | Removes password recovery. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ExternalLogin.razor | Removes external-login flow. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ConfirmEmailChange.razor | Removes email-change confirmation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/ConfirmEmail.razor | Removes email confirmation. |
| VolumeMount.BlazorWeb/Components/Account/Pages/AccessDenied.razor | Removes access-denied page. |
| VolumeMount.BlazorWeb/Components/Account/Pages/_Imports.razor | Removes authentication-page imports. |
| VolumeMount.BlazorWeb/Components/Account/IdentityRedirectManager.cs | Removes Identity redirect helper. |
| VolumeMount.BlazorWeb/Components/Account/IdentityNoOpEmailSender.cs | Removes placeholder email sender. |
| VolumeMount.BlazorWeb/Components/Account/IdentityComponentsEndpointRouteBuilderExtensions.cs | Removes Identity endpoints. |
| VolumeMount.BlazorWeb/Components/_Imports.razor | Imports inspection types. |
| VolumeMount.BlazorWeb/appsettings.json | Removes LocalDB settings; adjusts logging. |
| VolumeMount.BlazorWeb/appsettings.Development.json | Removes redundant development settings. |
| VolumeMount.AppHost/AppHost.cs | Wires persistent storage and dashboard actions. |
Review effort: Balanced
Adam Ratzman (adamint)
left a comment
There was a problem hiding this comment.
Reviewed against the CONTRIBUTING.md quality bar (#2238). Checked the ~65k deleted lines: they're the vendored Bootstrap, Identity components/migrations, and old pages and screenshots, and nothing still references them. The VolumeMount.Inspections meter, [LoggerMessage] logs, dev-only seed, and an SVG attachment endpoint hardened with CSP sandbox and nosniff all look good. No issues found.
|
Converted the volume-mount C# AppHost and migration worker to file-based apps, updating Aspire settings and sample documentation. Added shared build/restore support for file-based C# apps, test-factory discovery for file-based AppHosts, and applied the canonical shared Build.proj fix for empty sample/candidate lists. The exact head (152b1cd) passes Ubuntu build/test, Windows build/test, CI Gate, and license/CLA; all three existing inline review threads are resolved. |
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Prior-head hosted run 47458848227 passed mount-model checks and SQL/Azurite startup with GET smoke. The current head only changes devcontainer SDK setup; its CI is still running. Neither the hosted assertions nor an independent local run verified an inspection and its uncached attachment bytes across a restart.
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Verified that the single-instance seed lock covers the full run and rejects overlapping retries without blocking routine inspections. The endpoint harness covers overlapping requests and resulting row and blob counts. CI passed on this commit.
…through, OpenAPI/Scalar, domain telemetry, and dashboard commands - Replace the Identity demo with FieldCheck: inspection records in SQL Server and photo/document attachments in Azure Blob Storage, both on data volumes - Add Seed sample data and Check persisted data HTTP commands, Scalar/OpenAPI URLs, and a health check - Add the inspection.create span across blob uploads and SQL inserts, the VolumeMount.Inspections meter, and [LoggerMessage] logs - Add a responsive Blazor SSR UI with dark mode, and a README walkthrough for restarting sqlserver and seeing the data persist - Replace screenshots with light/dark captures of the app, dashboard volume details, trace, metrics, and Scalar Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
- Reject attachment file names longer than the 260-character FileName column with a validation error - Allow request bodies up to six 10 MB attachments plus form overhead on POST /api/inspections and the New inspection form - Return problem details for /api errors and empty status codes instead of the HTML error and not-found pages Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- List the sample's local-development defaults and what to change before deploying it Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the AppHost identity, service graph, launch profiles, and existing integration cases; add container-free resource-model coverage and update run instructions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- VolumeMount.AppHost are now file-based apps, so their .csproj files no longer exist and .github/for.dependabot.only.sln failed to load. Remove their project, configuration and nesting entries. - Dependabot can't update #:package versions in file-based apps yet (dependabot/dependabot-core#12057), so those versions need manual bumps. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lidate outcome - Only delete uploaded blobs after a failed save once a fresh query confirms no attachment row references them; keep them (and log a warning) if a commit may have succeeded or the check itself fails. - Seed sample data skips assets that already have an inspection, so a retry after a partial failure only adds the missing ones, and the total is computed instead of re-queried after the inserts. - Serve attachments with Cache-Control: no-store so the persistence walkthrough always shows bytes read from Blob Storage. - Reject undefined numeric Outcome values with [EnumDataType] (400 from the API, a validation message in the form). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- SampleData.TrySeedAsync holds a process-wide SemaphoreSlim for the whole seed, so a retry that overlaps a still-running seed can't read the same missing assets and insert them (and their blobs) twice - POST /api/dev/seed returns 409 "A seed is already running" instead of waiting; documented in OpenAPI - The home page's seed button reloads the page if a seed is already running - README: mention the one-at-a-time behavior and that the in-process lock covers a single blazorweb instance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
f7313cc to
ebae372
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
152b1cd8b159dfd49186dea9c26f284926d88becvalidate.ps1passed before the latest maintainer commits; the routes the integration tests probe return 200.↑ All 3 review threads fixed and resolved, each reproduced first: long file names return a 400 validation error, 6 × 10 MB attachments are accepted by the API and the form (7 × 10 MB returns 413), and
/apierrors outside Development return problem details.↑ Data survived a SQL Server container restart and a full AppHost stop and start (inspections, attachments and Azurite blobs).
↑ README ends with a Security considerations section that matches the code.
↑ Maintainer commits convert the AppHost and the migration worker to file-based apps.
↑ CI passes on Ubuntu and Windows on this head, including the integration tests.
↓ The full integration-test project wasn't re-run after these commits.
↓ The file-based migration is covered by CI and the maintainer's own checks; my local runs predate it.
Summary
This PR re-themes the Persistent Volume sample from an ASP.NET Core Identity login demo into FieldCheck, an equipment-inspection tracker. Inspection records go to SQL Server and photo and document attachments go to Azure Blob Storage (Azurite). Both use Docker data volumes, so the sample's point is the same: the data survives container restarts and re-creation. The difference is that you can now see it happen.
Screenshots
Captured from the running sample. Each image follows your GitHub light or dark theme; select one to open it at full size.
FieldCheck home page showing SQL Server and Blob Storage volume cards and a grid of inspections with nameplate photos
Inspection detail page with the inspector, findings, SQL table, and attachments stored in Blob Storage
Aspire dashboard resources with the blazorweb actions menu open on Seed sample data and Check persisted data
sqlserver resource details with the Volumes card showing the data volume mounted at /var/opt/mssql
Trace for a new inspection: inspection.create spanning two Blob Storage uploads and the SQL Server inserts, with the span attributes
inspections.attachment.size histogram for blazorweb with P50, P90, and P99 lines and exemplars
Scalar API reference showing the Record an inspection multipart operation with its schema and a curl example
Feature highlights
sqlserverfrom the dashboard (the container is re-created and mounts the same volume) and seeing the start time change while the data stays./var/opt/mssql(pictured).POST /api/dev/seed): a week of realistic inspections, each with a generated nameplate SVG and a CSV of readings.GET /api/storage/status): counts, blob bytes, andsqlServerStartedAtas JSON./health.inspection.create(ActivitySourceVolumeMount.Inspections) wrapsBlobClient.Upload(with its HTTPPUTto storage) for each attachment and the EFINSERTs into sqldb, all in one trace.attachment.uploadedandinspection.savedevents.Migrating databasespan.VolumeMount.Inspectionsmeter has these instruments, all with low-cardinality tags:inspections.records.createdinspections.attachment.size(a bytes histogram)inspections.attachment.uploads.failedinspections.attachment.uploads.active[LoggerMessage]source-generated logs in blazorweb (8 events) and the migration service.AddValidation), and multipart upload. It's served with Scalar in Development.Re-theme notes
ApplicationUser/ApplicationDbContext, the Identity migrations, Bootstrap underwwwroot/lib, the Weather and Auth pages,UserSecretsId, and the old login and registration screenshots.InspectionandInspectionAttachmentinInspectionDbContext.ApplicationDbInitializerwas renamed toInspectionDbInitializer.Storage→storage.BlobConnection(blobs) → theattachmentsblob container (inspection-attachments), usingAddAzureBlobContainerClient.sqlserver,sqldb,migration, andblazorwebare unchanged.tests/SamplesIntegrationTests/AppHostTests.cs: no change needed. The blazorweb routes/alive,/health, and/are the same, and it still waits formigrationto finish.Review feedback and deployment notes
POST /api/inspectionsand the New inspection form accept the advertised 6 × 10 MB of attachments;/apirequests get problem details for errors and empty status codes, while pages keep the HTML error and not-found pages.saconnection, local-only credentials, data that outlives the app, and the Development-only endpoints.build/Build.projto the candidate filters and the solution, C# AppHost and TypeScript AppHost lists; it is shared by the feature-highlights branches.Validation
dotnet build VolumeMount.slnx -warnaserror --no-incremental: succeeded with 0 warnings.aspire runsmoke test: all resources were healthy and migration finished with exit code 0. The following all worked:/openapi/v1.jsonaspire resource sqlserver restartre-created the container with a new container ID. The counts stayed the same (11 inspections, 21 attachments, 21 blobs), whilesqlServerStartedAtchanged.inspection.create→ 2×BlobClient.Upload→PUTplus 2×INSERT, all in one trace (8 spans).dotnet build VolumeMount.slnx --no-incremental(warnings as errors): 0 warnings, 0 errors.aspire start --isolatedon Docker Desktop: every resource healthy andmigrationfinished. Seed sample data and Check persisted data ran throughaspire resource blazorweb <command>, and two inspections (CT-05 and CWP-2, each with a JPEG photo and a CSV of readings) were recorded through the Blazor form.aspire resource sqlserver restartre-created the container (8fff09eabc9d→c8ba9c1167fa) on the samevolumemount.apphost-…-sqlserver-datavolume. Check persisted data returned the same 22 inspections, 44 attachments, and 44 blobs (228,017 bytes) before and after, whilesqlServerStartedAtmoved from 03:58:08 to 04:01:56 UTC.aspire stopandaspire start, Azurite ran in a new container and all 22 inspections and 44 blobs were still there. A JPEG attachment streamed back byte-for-byte (80,515 bytes).inspection.create→ 2×BlobClient.Upload→PUT201, then 2×INSERT.SamplesIntegrationTestsfor VolumeMount).Capture caveats
aspire startof this branch. No stubs were used. The data comes from the Seed sample data command plus two inspections recorded through the UI form.POST /api/inspections, so P50, P90, and P99 separate.sqlserverlogs one expectedInspectionDbContexthealth-check error in blazorweb while SQL Server is down. It was opened in Structured logs, which clears the dashboard's unread-error badge, before the dashboard captures.Follow-ups
AttachmentRulestags CSV uploads withattachment.kind=data, but the README metrics table lists onlyimageanddocument. Separately, the single-rowsys.dm_os_sys_infoandsys.database_filesqueries inGetStorageStatusAsynctrigger EF Core's "First/FirstOrDefault without OrderBy" warning log.