Two Linux/Mono server fixes: dead REST API + login username case#106
Merged
Conversation
app.UseAutofacMiddleware / UseAutofacWebApi register Autofac.Integration.Owin's per-request lifetime-scope injector, which disposes the scope via `await using` → IAsyncDisposable.DisposeAsync(). 7D2D's Mono runtime doesn't implement that method, so it threw MissingMethodException at JIT in front of the whole pipeline — taking down EVERY /api/* request on Linux/Mono. Rely instead on Web API's own AutofacWebApiDependencyResolver (already set), which creates + disposes the per-request scope SYNCHRONOUSLY via IDisposable.Dispose() (which Mono has). InstancePerRequest registrations still resolve correctly (same RequestLifetimeScopeTag). Verified live: authed GET /api/users → 200. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
UserController.Create stores username as Trim().ToLowerInvariant(), but HandleLogin passed the raw typed username to GetByUsername, and SQLite compares TEXT case-sensitively — so a username created/typed as "KCAdmin" was stored "kcadmin" and never matched at login (presented as the admin password "rotating" / not working). Normalize the login username the same way. Verified: "KCAdmin" → 200. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Two independent server-side fixes for the 7D2D Mono/Linux runtime, found and verified live during this session (orphaned in the working tree — lifting them into a PR so they aren't lost). Two scoped commits.
1.
fix(web)— the entire REST API was dead on Monoapp.UseAutofacMiddleware/UseAutofacWebApiregister Autofac's per-request lifetime-scope injector, which disposes viaawait using→IAsyncDisposable.DisposeAsync(). 7D2D's Mono runtime doesn't implement that method →MissingMethodExceptionat JIT in front of the whole pipeline → every/api/*request 500'd on Linux. Removed those two calls; Web API's ownAutofacWebApiDependencyResolver(already set) disposes the per-request scope synchronously viaIDisposable.Dispose(), which Mono has.InstancePerRequestregistrations still resolve (sameRequestLifetimeScopeTag).Verified: authed
GET /api/users→ 200.2.
fix(auth)— mixed-case usernames couldn't log inUserController.Createstoresusername.Trim().ToLowerInvariant(), butHandleLoginpassed the raw typed username toGetByUsername, and SQLite compares TEXT case-sensitively — so"KCAdmin"was stored"kcadmin"and never matched (looked like the admin password "rotating" / not working). Normalize the login username the same way.Verified:
"KCAdmin"→ 200.🤖 Generated with Claude Code