Harden runtime and add portable releases - #5
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens rtlmux’s runtime behavior (upstream connection lifecycle, protocol framing, logging safety, cleanup, signal handling, and port validation) and adds portable release artifacts (multi-arch static binaries, Docker images, and GitHub Actions CI/release automation), with new integration/regression tests to lock in the expected behavior.
Changes:
- Added Python integration tests covering delayed handshakes, fragmented commands, clean reconnect shutdown, port validation, and delayed restarts.
- Hardened core runtime: safer logging formatting, more robust upstream/client lifecycle handling, improved cleanup paths, and stricter config validation.
- Modernized build and release pipeline: refreshed Makefile, multi-stage Docker builds (static + scratch), removed GitLab CI config, and added GitHub Actions workflows for CI/releases/Docker publishing.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration.py | New integration regression suite for handshake framing, command fragmentation, port validation, reconnect shutdown, and restart behavior. |
| slog.c | Replaces unsafe sprintf/vsprintf with bounded snprintf/vsnprintf. |
| rtlmux.h | Uses sig_atomic_t for exit flag and fixed-width types for protocol command framing. |
| rtlmux.c | Refactors upstream connect/reconnect, client readiness handling, safer logging callback formatting, improved allocation/error checks, and cleanup flow. |
| main.c | Improves signal handler setup and thread lifecycle error handling; switches exit flag type. |
| config.c | Adds validation for port ranges and non-empty host; converts validated values to uint16_t. |
| Makefile | Modernizes flags, dependency tracking (.d), adds static, test, install, and generate targets. |
| Dockerfile | Multi-stage build for static multi-arch artifacts and scratch runtime image. |
| README.md | Updates quick-start, LAN safety note, build, Docker, and release documentation; replaces obsolete CI references. |
| .github/workflows/ci.yml | Adds GitHub Actions CI to build, run tests, and verify static artifact build. |
| .github/workflows/release.yml | Adds tag-driven multi-arch binary builds, GitHub releases, and conditional Docker Hub publishing. |
| .gitlab-ci.yml | Removes obsolete GitLab CI configuration. |
| .gitignore | Adds *.d dependency file ignores. |
| .dockerignore | Excludes git metadata and build outputs from Docker build context. |
Suppressed comments (3)
tests/integration.py:195
- This helper thread is non-daemon, and addCleanup(thread.join, 2) only waits briefly. If upstream.accept() blocks due to a test failure, the thread can keep the Python process alive and hang CI.
thread = threading.Thread(target=serve)
thread.start()
self.addCleanup(thread.join, 2)
tests/integration.py:139
- This helper thread is non-daemon, and addCleanup(thread.join, 2) only waits briefly. If upstream.accept() blocks due to a test failure, the thread can keep the Python process alive and hang CI.
thread = threading.Thread(target=serve)
thread.start()
self.addCleanup(thread.join, 2)
tests/integration.py:227
- This helper thread is non-daemon, and addCleanup(thread.join, 4) only waits briefly. If upstream.accept() blocks due to a test failure, the thread can keep the Python process alive and hang CI.
thread = threading.Thread(target=serve)
thread.start()
self.addCleanup(thread.join, 4)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
make test