Host HTTP servers on the omnyhub framework (v1.12.0) - #17
Merged
Conversation
HubServer and ContentServer now run on an OmnyHub instead of a hand-wired
shelf/shelf_router pipeline, removing duplicated transport boilerplate.
- Routing via omnyhub RouterService (native path params), keeping the exact
routes/methods.
- The per-server _guard error handler → one shared driveErrorMapper middleware
mapping DomainException to the {success,error} envelope (and anything else to
500).
- JsonResponse envelope factory → omnyhub successEnvelope/errorEnvelope; deleted
json_response.dart.
- Dropped direct shelf/shelf_router deps in favour of omnyhub ^1.1.0.
Wire protocol unchanged (routes, status codes, JSON envelopes, gzip negotiation,
bearer auth), so the client SDK and HTTP consumers are unaffected. serve() now
returns the running OmnyHub (stop with hub.stop()); tests/examples updated.
242 tests pass (incl. the full http round-trip gzip/exception gate + a new
driveErrorMapper unit test). format/analyze/dependency_validator green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Cover the seams the migration rerouted through omnyhub's middleware, router and envelope helpers — the code most likely to regress: - success envelopes + status codes (200/201/204) for version, enroll, auth, drive registration. - bearer auth parsing (_authenticate0): missing header, non-bearer scheme, unissued token, case-insensitive scheme — all 401 with the unauthorized envelope. - driveErrorMapper status mapping over real HTTP: 404 drive_not_found, 400 invalid_json (empty / malformed / non-object body). - omnyhub router: unknown route -> 404, wrong method -> 405. - content server routing/status: <path|.*> tail capture for nested reads and writes, 204 on write, 403 read_only_violation, 409 stale-hash copy, 404 for an unserved drive. 18 new tests; full suite 260 pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
HubServerandContentServernow run on an omnyhubOmnyHubinstead of a hand-wiredshelf/shelf_routerpipeline — removing duplicated transport boilerplate while keeping the wire protocol byte-for-byte.What changed
RouterService(native path parameters —/drives/<endpoint>/<name>/files/<path|.*>), preserving every route and method._guard(duplicated verbatim across both servers) → one shareddriveErrorMappermiddleware mappingDomainExceptionto the{success, error}envelope at its status code, and anything else to500.JsonResponsefactory → omnyhub'ssuccessEnvelope/errorEnvelope;json_response.dartdeleted.shelf+shelf_routerin favour ofomnyhub: ^1.1.0.serve()now returns the runningOmnyHub(stop withhub.stop()); tests and examples updated accordingly.Unchanged (by design)
The wire protocol — routes, status codes, JSON envelopes, gzip content negotiation, bearer auth, the server-side-copy
409-on-hash-drift contract — is identical, so the client SDK (HttpDriveHub/HttpContentSource) and any HTTP consumer are unaffected. Domain logic,ContentCompression,DomainException, and the CLI are unchanged.Tests
All 242 tests pass, including the full
http_round_tripgate (raw gzip wire assertions, domain-exception types reconstructed client-side), the CLI exit-code tests, and a newdriveErrorMapperunit test.dart analyze --fatal-infos --fatal-warningsanddependency_validatorare green.🤖 Generated with Claude Code