The server maintains two near-duplicate receive state machines: receive_files() in src/server/server.c:55-166 and receive_thread() in src/shared/multiprocessing.c:169-276. Both decode the same statuses, incremental checks, chunk batches, manifests, and FINISHED handling, but have diverged in validation and error/cancellation behavior. valid_batch_path() is also duplicated at server.c:32-35 and multiprocessing.c:17-19. Future protocol changes must be made twice and can produce inconsistent single-threaded versus multithreaded behavior.
Scope
Extract shared status dispatch/receive helpers with explicit callbacks or a receiver context for enqueueing versus immediate writing. Keep transport/thread synchronization outside the protocol core and preserve existing error semantics.
Acceptance criteria
Single-threaded and multithreaded receiving use the same protocol dispatch implementation.
There is one shared implementation of batch-path validation.
Unit/integration coverage exercises both modes, including incremental, chunk, manifest/delete, abort, malformed input, and FINISHED/error paths.
Tests demonstrate equivalent protocol outcomes between the two receive modes.
Severity
medium
Category
quality
Automated maintainability audit; no source changes were made.
## Summary
The server maintains two near-duplicate receive state machines: `receive_files()` in `src/server/server.c:55-166` and `receive_thread()` in `src/shared/multiprocessing.c:169-276`. Both decode the same statuses, incremental checks, chunk batches, manifests, and FINISHED handling, but have diverged in validation and error/cancellation behavior. `valid_batch_path()` is also duplicated at `server.c:32-35` and `multiprocessing.c:17-19`. Future protocol changes must be made twice and can produce inconsistent single-threaded versus multithreaded behavior.
## Scope
Extract shared status dispatch/receive helpers with explicit callbacks or a receiver context for enqueueing versus immediate writing. Keep transport/thread synchronization outside the protocol core and preserve existing error semantics.
## Acceptance criteria
- Single-threaded and multithreaded receiving use the same protocol dispatch implementation.
- There is one shared implementation of batch-path validation.
- Unit/integration coverage exercises both modes, including incremental, chunk, manifest/delete, abort, malformed input, and FINISHED/error paths.
- Tests demonstrate equivalent protocol outcomes between the two receive modes.
## Severity
medium
## Category
quality
---
_Automated maintainability audit; no source changes were made._
Fixed. The two receiver state machines are unified: receiver_process_pending() in src/server/receiver.c is now the single protocol core used by both the single-threaded path (receiver_receive_files) and the multithreaded path (receive_thread in receiver_pipeline.c). valid_batch_path() is now the single utils_valid_batch_path() (src/shared/utils.c). Single- vs multi-threaded integration tests assert equivalent outcomes. Closing as completed.
Fixed. The two receiver state machines are unified: `receiver_process_pending()` in `src/server/receiver.c` is now the single protocol core used by both the single-threaded path (`receiver_receive_files`) and the multithreaded path (`receive_thread` in `receiver_pipeline.c`). `valid_batch_path()` is now the single `utils_valid_batch_path()` (`src/shared/utils.c`). Single- vs multi-threaded integration tests assert equivalent outcomes. Closing as completed.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The server maintains two near-duplicate receive state machines:
receive_files()insrc/server/server.c:55-166andreceive_thread()insrc/shared/multiprocessing.c:169-276. Both decode the same statuses, incremental checks, chunk batches, manifests, and FINISHED handling, but have diverged in validation and error/cancellation behavior.valid_batch_path()is also duplicated atserver.c:32-35andmultiprocessing.c:17-19. Future protocol changes must be made twice and can produce inconsistent single-threaded versus multithreaded behavior.Scope
Extract shared status dispatch/receive helpers with explicit callbacks or a receiver context for enqueueing versus immediate writing. Keep transport/thread synchronization outside the protocol core and preserve existing error semantics.
Acceptance criteria
Severity
medium
Category
quality
Automated maintainability audit; no source changes were made.
Fixed. The two receiver state machines are unified:
receiver_process_pending()insrc/server/receiver.cis now the single protocol core used by both the single-threaded path (receiver_receive_files) and the multithreaded path (receive_threadinreceiver_pipeline.c).valid_batch_path()is now the singleutils_valid_batch_path()(src/shared/utils.c). Single- vs multi-threaded integration tests assert equivalent outcomes. Closing as completed.