Summary #
Reject concurrent POST /import requests targeting a canonical path that already has an active or queued dry_run: false import — or an overlapping ancestor/descendant path — with 409 Conflict before opening an SSE stream.
Changes #
- Active-path tracking & ancestor/descendant overlap (
internal/server/server.go,internal/server/import.go):- Track admitted
dry_run: falsecanonical import paths inServer.activePathsunderactivePathsMutex, releasing each path and pending slot on pipeline completion or failure. - Check path equality and strict ancestor/descendant overlap (
pathsOverlap) during admission inadmitImportRequestprior to429 Too Many Requestsslot acquisition so409 Conflicttakes precedence over queue saturation without leaking slots. - Reject
dry_run: truepreviews against active or queueddry_run: falsepaths with409 Conflictwhile leavingdry_run: truepaths out ofactivePaths, preserving concurrent candidate previews on idle paths and immediatedry_run: falseimports while a preview is in flight.
- Track admitted
- Tests (
internal/server/import_test.go,internal/server/server_test.go):- Behavioral tests covering exact and symlink-aliased duplicate paths (including
409precedence whenMaxPendingImportsis full), ancestor/descendant vs. sibling-prefix paths,dry_runoverlap rules, and path release after failed or completed imports.
- Behavioral tests covering exact and symlink-aliased duplicate paths (including