Commit Graph
491 Commits
Author SHA1 Message Date
Admin 695f4378c6 refactor(api): OpenAPI response metadata, cached user sync, ProblemDetails
- Document every endpoint's responses (Produces<T>/status codes/validation)
  so the generated OpenAPI/Scalar docs carry response schemas and status codes
  instead of empty responses
- Cache recently-synced user ids (IMemoryCache, 15 min) in the JWT
  TokenValidated handler so user provisioning no longer hits the DB on every
  authenticated request
- Add ProblemDetails + UseExceptionHandler for consistent RFC7807 errors
- Add ToCreatedResult ErrorOr helper and use it in the create endpoints
- Normalize the playlists route to lowercase (/playlists)

Verified: booted the Api against RabbitMQ + Postgres in Docker and inspected
/openapi/v1.json — operations now expose response schemas/status codes and the
route is /playlists.

Build: 0 warnings, 0 errors.
2026-07-05 21:04:15 +02:00
Admin c4f5e6754c feat(deploy): consolidated dev stack with auto-provisioned Zitadel
Single docker-compose stack for local development (Postgres, Zitadel,
RabbitMQ, SeaweedFS + bucket init, Jaeger) plus an optional overlay to run
the .NET apps in Docker. up.ps1 orchestrates the full bootstrap: stack up,
stream-ticket keys, EF Core migrations and Zitadel provisioning.

- Zitadel is provisioned automatically (service-account PAT -> project +
  OIDC app with JWT access token); the generated ClientId is wired into
  Musify.Api user-secrets and .env. No manual console steps.
- ZITADEL_EXTERNAL_DOMAIN=host.docker.internal so token validation works
  both with local apps and full-docker.
- App Dockerfiles copy AppSettings*.json to lowercase so config loads on
  case-sensitive Linux; Worker image ships ffmpeg.
- Scripts split by responsibility (common/stream-keys/migrate/provision);
  apps overlay de-duped via YAML anchors.
- Remove the superseded standalone seaweedfs compose; point docs/development
  at the unified stack.
2026-07-05 20:32:40 +02:00
Admin a37dcc1b45 Formatting 2026-07-05 16:04:53 +02:00
Admin b1010b0bb5 refactor(infra): register auditable interceptor via DI
Register AuditableEntityInterceptor as a singleton and attach it through the
AddDbContext options callback instead of newing it up inside
Database.OnConfiguring. The interceptor is stateless, so a single shared
instance is reused across contexts and its wiring lives in the DI layer.
The design-time factory keeps working (interceptor is runtime-only, irrelevant
for migrations).

Verified: build + ef migrations list (design-time context) OK; the Worker host
builds and validates the full DI graph (reaches endpoint configuration) with no
captive-dependency or interceptor error.

Build: 0 warnings, 0 errors.
2026-07-05 15:14:03 +02:00
Admin 6e4b8fad56 refactor(infra): S3 client singleton, ffmpeg pipe ordering, tidy streams/jobs
- Register IAmazonS3 as a singleton instead of scoped: the AWS SDK client is
  thread-safe and manages its own connection pool, so one instance per DI scope
  (per request / per job iteration) was wasteful and risked socket exhaustion
- AudioTranscoderService: start reading stdout/stderr before writing stdin to
  remove the latent pipe-buffer deadlock shape
- Dispose the resized-picture MemoryStream in ResizePictureActivity
- Background jobs use PeriodicTimer instead of while + Task.Delay

Verified: Worker boots against RabbitMQ + Postgres in Docker with no captive-
dependency error (dev scope validation) and both jobs start.

Build: 0 warnings, 0 errors.
2026-07-05 15:07:49 +02:00
Admin 93ee8be0cd feat(infra): playlist processing saga + generalize fault handling (phase 3)
Adds the PlayList picture-processing lifecycle saga (correlated by PlayListId)
mirroring the track one, and generalizes the failure plumbing:
- Rename the track fault translator to ProcessingSlipFaultConsumer and use a
  generic Workflow.SubjectId variable + ProcessKind; it now emits typed
  Track{Picture,Audio}/PlayListPicture ProcessingFailed events for all slips
- PlayListProcessingStateMachine (+ EF-persisted PlayListProcessingState,
  migration): starts on CreatePlayListResourcesEvent, finalizes on
  PlayListPictureProcessed, and on failure marks the playlist Failed and
  removes the orphaned final picture (PlayListProcessingFailedConsumer +
  MarkPlayListAsFailedActivity)
- UpdatePlayListPictureActivity publishes PlayListPictureProcessed on success
- Picture slip carries SubjectId + PlayListPicture kind + fault subscription

Verified end-to-end in Docker (RabbitMQ + migrated Postgres): both saga
endpoints, the fault translator and cleanup consumers configure, and an
addressing cross-check confirms all 21 activity execute queues the builders
address exist (caught + fixed a kebab mismatch on mark-play-list-as-failed).

Build: 0 warnings, 0 errors.
2026-07-05 14:55:40 +02:00
Admin 6e5755039f feat(infra): track saga failure handling + cleanup (phase 2)
On definitive failure of the picture or audio slip, the saga now reaches a
Failed state and recovers end-to-end:
- Picture/audio track slips carry TrackId + ProcessKind variables and a
  subscription to a fault translator (TrackProcessingSlipFaultConsumer) that
  turns RoutingSlipFaulted into a typed Track{Picture,Audio}ProcessingFailed
- The saga stores the final object keys from the start event and, on failure,
  transitions to Failed and publishes TrackProcessingFailed
- TrackProcessingFailedConsumer runs a cleanup slip that removes the orphaned
  final picture/audio copies and marks the track LifeCycleStatus=Failed
  (MarkTrackAsFailedActivity) — the track stays as a visible, recoverable record
- Migration for the new saga columns

Verified: Worker boots against RabbitMQ + Postgres in Docker; the new
endpoints (fault translator, failed consumer, mark-track-as-failed) configure
and the bus starts clean.

Build: 0 warnings, 0 errors.
2026-07-05 14:49:33 +02:00
Admin 97855d9094 feat(infra): add Track processing saga (state machine, phase 1)
Introduce a MassTransit saga state machine that correlates by TrackId and
tracks the two parallel processing slips (picture + audio):
- TrackProcessingStateMachine + EF-persisted TrackProcessingState
  (pessimistic concurrency, EntityFrameworkRepository), migration added
- Starts on CreateTrackResourcesEvent; UpdateTrack{Picture,Audio}Activity now
  publish TrackPictureProcessed / TrackAudioProcessed on success; when both
  arrive the saga finalizes (Ready). Failure transitions to a Failed state
  (cleanup wired in the next phase)
- Add LifeCycleStatus.Failed and the four outcome events

Verified: booted the Worker against RabbitMQ + migrated Postgres in Docker;
the saga endpoint 'track-processing-state' is configured and the bus starts
clean.

Build: 0 warnings, 0 errors.
2026-07-05 14:41:19 +02:00
Admin ee3e457dde refactor(infra): auto-configure MassTransit endpoints via ConfigureEndpoints
Replace ~240 lines of hand-written per-endpoint wiring with MassTransit's
ConfigureEndpoints + KebabCaseEndpointNameFormatter, and apply retry + EF
outbox globally through AddConfigureEndpointsCallback. Adding a consumer or
activity is now a single AddConsumer/AddActivity line.

- Normalize the 4 mismatched activity endpoint names to kebab-case so the
  routing-slip addressing keeps resolving (update-play-list-picture,
  delete/mark/publish play-list variants); cleanup consumer queue is now
  routing-slip-clean-up
- Drop the now-unused QueueName consts from event consumers and trim
  EndpointHelper / delete the manual endpoint-config partial

Verified end-to-end: booted the Worker against RabbitMQ in Docker and
confirmed all 38 endpoints are configured with the exact names the builders
address (19 execute queues + compensations + consumers + routing-slip-clean-up).

Build: 0 warnings, 0 errors.
2026-07-05 14:22:26 +02:00
Admin b3ff1b6516 fix(infra): repair TransferFiles compensation + tidy MassTransit consistency
Fix (recoverability bug):
- TransferFilesToBucketActivity returned Completed() with no log, so its
  compensation could never delete the transferred files (orphaned objects on
  fault). IStorageService.TransferFilesAsync now returns the real uploaded
  keys; the activity logs them so Compensate can remove them. Also drops the
  Path.Combine key recomputation (produced backslash keys on Windows).

Consistency / DRY:
- Normalize all courier activities to internal + folder-based namespaces
  (several were public and in the flat .Activities namespace)
- Extract the duplicated exponential retry into UseStandardRetry
- Unify endpoint-name logic into a single EndpointHelper (remove the parallel
  MassTransitEndpointNames helper)

Build: 0 warnings, 0 errors.
2026-07-05 04:58:27 +02:00
Admin 4386d4eb7e refactor(application): fold Pagination into Shared, rename assembly marker
- Move PaginatedResponse from the single-file Pagination/ folder into Shared/
  (namespace Musify.Application.Pagination -> Musify.Application.Shared)
- Rename MusifyApplication.cs -> AssemblyInfo.cs (it only holds the
  [assembly: MediatorOptions] attribute)

Build: 0 warnings, 0 errors.
2026-07-05 04:38:12 +02:00
Admin c84e29ed54 refactor(di): add AddApplication entry point and generic AddValidatedOptions
- Add Musify.Application.AddApplication(services, config) as the layer's DI
  entry point: registers Mediator, UploadIntentValidator and all app configs
- Collapse the 5 near-identical AddXConfiguration methods into a single
  generic AddValidatedOptions<T>(config, section)
- Move UploadIntentValidator registration out of Infrastructure into the
  Application layer (fixes layering leak); Infra config binding now uses the
  generic helper
- Api calls AddApplication; Worker uses AddValidatedOptions for its configs

Build: 0 warnings, 0 errors.
2026-07-05 04:36:46 +02:00
Admin db38740139 refactor(application): co-locate each command/query with its handler
One file per use case under the feature folder (Tracks/PlayLists/Users),
dropping the Commands/Queries/Handlers sub-folders and their namespaces.
Each file now holds the record and its handler in namespace
Musify.Application.<Feature>; external usings updated accordingly.

Build: 0 warnings, 0 errors.
2026-07-05 04:12:59 +02:00
Admin bf3b5ceedb refactor: replace Ardalis.Result with ErrorOr across the app
Ardalis Result<T> carried incoherent success sub-statuses and a clunky
generic converter; ErrorOr models success-or-errors cleanly.

- Application: all commands/queries/handlers now return ErrorOr<T>
  (non-generic Result -> ErrorOr<Success>); errors via Error.NotFound/
  Conflict/Validation/Unauthorized/Failure; success via value or new Success()
- Drop ResultExtensions.As<>(): error propagation is now just return .Errors
- Rewrite HTTP mapping (ErrorOrHttpExtensions) off Error.Type; success maps
  to 200 (value) or 204 (Success); Created still built in the endpoints
- Endpoints/gateway middleware: !IsSuccess -> IsError
- Swap Ardalis.Result package for ErrorOr 2.1.1 (remove unused ref from Worker)

Build: 0 warnings, 0 errors.
2026-07-05 04:05:43 +02:00
Admin 3b98a05c3b chore(backend): install AI agent skills for the .NET stack
Run autoskills in backend/: detects .NET/C#/ASP.NET Core/Minimal API and
installs 13 skills for universal (.agents) and claude-code (.claude) agents,
with backend/skills-lock.json. Adds ASP.NET Core, Minimal API + OpenAPI,
file-upload and containerization skills on top of the prior C#/.NET set.
Removes the stale root skills from the old layout.
2026-07-05 03:48:31 +02:00
Admin f2933caa90 chore: group .NET into backend/ and drop non-.NET test artifacts
- Move all .NET (6 projects, solution, Directory.*.props, nuget.config)
  into backend/ so the monorepo root can host non-.NET projects later
- Remove throwaway test artifacts: player.html, pl.json
- Trim dead Flutter rules from .gitignore

Build from backend/Musify.slnx: 0 warnings, 0 errors.
2026-07-05 03:43:52 +02:00
Admin c7fcf2d289 refactor: central package management, shared build props, security fix
- Add Directory.Packages.props (CPM): all package versions centralized,
  remove Version attributes from every PackageReference
- Add Directory.Build.props: shared TargetFramework/Nullable/ImplicitUsings
- Drop redundant per-project RootNamespace/AssemblyName (default = project name)
  and stale NuGet metadata (PackageId/Version/Authors/RepositoryUrl)
- Bump Microsoft.OpenApi to 2.9.0 (CVE-2026-49451, was transitive 2.0.0);
  add explicit reference in Musify.Api which uses it directly
- Add repo-scoped nuget.config pinning nuget.org for reproducible restore

Build: 0 warnings, 0 errors.
2026-07-05 03:40:05 +02:00
Admin 3be31a6378 refactor: standardize project names to Musify.* and flatten layout
- Flatten nested per-repo folders into flat Musify.* projects at root
- Rename assemblies/csproj: Domain->Musify.Domain, Application->Musify.Application,
  Infrastructure->Musify.Infrastructure, WebApi->Musify.Api, Worker->Musify.Worker,
  StreamingGateway->Musify.StreamingGateway
- Rename WebApi.* namespaces to Musify.Api.*
- Update all ProjectReference paths and the solution file
- Consolidate stray per-repo dotfiles; add root .gitattributes
- Move flutter client out to _archive
2026-07-05 03:32:48 +02:00
Admin 638e446bef chore: move flutter client out of monorepo into _archive 2026-07-05 03:26:36 +02:00
Admin 7a931d2d6f chore: bring flutter client, docs, deploy and tools into monorepo 2026-07-05 03:22:24 +02:00
Admin fcc81e2a74 feat: add unified Musify solution spanning all projects
Groups Domain/Application/Infrastructure under Core and
WebApi/Worker/StreamingGateway under Hosts. Removes the per-repo
.slnx files now superseded by the single solution.
2026-07-05 03:21:32 +02:00
Admin fa3a687cc5 chore: import Musify.StreamingGateway into monorepo (preserving history)
git-subtree-dir: Musify.StreamingGateway
git-subtree-mainline: 28426571e6
git-subtree-split: a8ff05892d
2026-07-05 03:20:50 +02:00
Admin 61c07c8190 chore: import Musify.Worker into monorepo (preserving history)
git-subtree-dir: Musify.Worker
git-subtree-mainline: c3cdd3bc0f
git-subtree-split: 868860fff9
2026-07-05 03:20:48 +02:00
Admin fc109ca384 chore: import Musify.WebApi into monorepo (preserving history)
git-subtree-dir: Musify.WebApi
git-subtree-mainline: 9d433868cc
git-subtree-split: ca8750c3b4
2026-07-05 03:20:47 +02:00
Admin 882c35d2fa chore: import MusifyBackend into monorepo (preserving history)
git-subtree-dir: MusifyBackend
git-subtree-mainline: 6829e769ed
git-subtree-split: ed7b00c2cc
2026-07-05 03:20:43 +02:00
Admin d1c6e0ae0b chore: initialize Musify monorepo 2026-07-05 03:20:11 +02:00
Admin 108e63c7c2 chore: preserve local dev config before monorepo import 2026-07-05 03:19:56 +02:00
Admin 43c5061fac Adjust 2026-06-03 00:32:37 +02:00
Admin c89645564d Set Content-Type on transferred objects so .m4a is served as audio/mp4 2026-06-02 19:26:45 +02:00
Admin 48305ff052 Serve audio .m4a by range; remove DASH manifest rewriting 2026-06-02 19:05:19 +02:00
Admin 809f16530b Point streaming config to single .m4a; drop DASH ffmpeg settings 2026-06-02 19:05:18 +02:00
Admin c1d57098b1 Migrate audio transcoding from DASH to a single AAC (.m4a) file 2026-06-02 19:05:11 +02:00
Admin be8fbbbcdc Fix bugs 2026-06-01 22:48:42 +02:00
Admin 6da1e8d5cd Simplify user sync: rely on EF change tracking instead of manual hasChanges flag 2026-06-01 22:11:48 +02:00
Admin e70ccb8e58 Auto-set CreatedAt/UpdatedAt via EF interceptor; standardize timestamp names across entities 2026-06-01 22:04:52 +02:00
Admin 8d87d59889 Changes 2026-06-01 20:50:46 +02:00
Admin 0e30167526 Remove checks 2026-06-01 20:41:34 +02:00
Admin 06c13cf522 Link created track to its owner via UserHasTrack 2026-06-01 19:07:33 +02:00
Admin d4eac95ced Add endpoint to list paginated tracks of a playlist 2026-06-01 18:54:26 +02:00
Admin e1e1c161db Add paginated query for tracks of a playlist; make PlayListHasTrack.Track navigation non-nullable 2026-06-01 18:54:25 +02:00
Admin 42122c65fc Extract storage key building into a shared StorageKey helper 2026-06-01 16:45:37 +02:00
Admin 9f8abb2b6c Sync user profile (incl. picture) from token claims on validation 2026-06-01 01:47:47 +02:00
Admin 11af429ecd Add user profile picture URL synced from the identity provider on login 2026-06-01 01:47:47 +02:00
Admin b11e945a29 Add playlist endpoints to add and remove tracks 2026-06-01 01:20:18 +02:00
Admin 7c44e6aa73 Add and remove tracks from playlists (commands + handlers with ownership checks) 2026-06-01 01:20:17 +02:00
Admin 842b1ffd08 Cleanup 2026-06-01 00:24:41 +02:00
Admin aba042b8b3 Initial commit: Musify.Worker background worker (MassTransit consumers for picture/audio processing) 2026-06-01 00:19:45 +02:00
Admin 539899741d Remove unused usings 2026-05-31 19:28:08 +02:00
Admin ceda236e9e Allow any CORS origin in Development 2026-05-31 19:25:15 +02:00
Admin ad9080be66 Return 400 for validation errors without identifier and enable permissive CORS in Development 2026-05-31 19:25:15 +02:00