sillsdev / sillsdev/languageforge-lexbox
[claude] sync-harmony endpoint returns 200 when a project is blocked from syncing
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9
- Forks
- 8
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 49
Description
[Claude, autonomous]
POST /api/merge/sync-harmony returns 200 OK even when the project is blocked from syncing, so the caller can't tell that no sync actually happened.
Root cause
SyncHarmonyProject (backend/FwHeadless/Routes/MergeRoutes.cs) calls SyncWorker.ExecuteSync(onlyHarmony: true) but discards the returned SyncJobResult, then unconditionally returns TypedResults.Ok():
var syncWorker = ActivatorUtilities.CreateInstance<SyncWorker>(services, projectId);
await syncWorker.ExecuteSync(stoppingToken, onlyHarmony: true); // result ignored
return TypedResults.Ok();
ExecuteSync does detect the block and returns SyncJobResult(SyncJobStatusEnum.SyncBlocked, …) (backend/FwHeadless/Services/SyncHostedService.cs), but because the result is thrown away the endpoint still reports success. In the logs the worker logs Project ... is blocked from syncing, and the request immediately finishes 200.
Contrast with the sibling endpoint. ExecuteMergeRequest (/api/merge/execute) checks the same block status up front and returns 423 Locked. sync-harmony should behave consistently.
Impact
The LexBox-side caller FwHeadlessClient.SyncHarmony branches on response.IsSuccessStatusCode. A blocked project returns 200, so the caller treats a skipped sync as a completed one. The sync block is effectively invisible to this code path.
Suggested fix
Map the SyncJobResult to a status code in SyncHarmonyProject (return 423 Locked for SyncJobStatusEnum.SyncBlocked, and surface other non-success statuses like ProjectNotFound / UnableToAuthenticate rather than collapsing them to 200). Extend the response Results<...> union accordingly.
Test: backend/Testing/ApiTests/ProjectBlockingTests.cs is the natural home for a case asserting sync-harmony returns 423 for a blocked project.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in backend/FwHeadless/Routes/MergeRoutes.cs at SyncHarmonyProject and compare its response handling with ExecuteMergeRequest. Read SyncHostedService.cs for SyncJobResult statuses, then run the relevant tests in backend/Testing/ApiTests/ProjectBlockingTests.cs. Done means blocked syncs return 423 and other non-success results are not reported as 200.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100