fix: resolve hardcoded Admin role + Users logging Constitution violations#144
Merged
antosubash merged 3 commits intomainfrom May 3, 2026
Merged
Conversation
….Admin
Replace 22 RequireRole("Admin") literal strings across Admin, PageBuilder,
and OpenIddict modules with the WellKnownRoles.Admin constant from
SimpleModule.Core.Authorization. Eliminates the magic-string violation of
Constitution section 8 ("Never hardcode permission strings — always use the
permission constants") while preserving exact runtime semantics.
…gerMessage]
Replace 19 direct logger.LogInformation/LogWarning calls across the Users
module's account endpoints with [LoggerMessage]-decorated static partial
methods. Aligns with Constitution section 12 ("Use source-generated logging
via [LoggerMessage] attribute for all log messages") and matches the
existing pattern used in UserService and PageBuilderService.
Deploying simplemodule-website with
|
| Latest commit: |
9310f41
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e3d51dfc.simplemodule-website.pages.dev |
| Branch Preview URL: | https://claude-find-constitution-vio.simplemodule-website.pages.dev |
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
Fixes two categories of Constitution violations surfaced by the audit run on this branch:
"Admin"role string (Constitution §8) — 22 occurrences ofpolicy.RequireRole("Admin")across Admin, PageBuilder, and OpenIddict modules replaced withpolicy.RequireRole(WellKnownRoles.Admin). The constant already existed inframework/SimpleModule.Core/Authorization/WellKnownRoles.cs(used byClaimsPrincipalExtensions), so the fix is mechanical and preserves identical semantics.logger.Log*calls in Users module (Constitution §12) — 19 calls across 11 endpoint files inmodules/Users/src/SimpleModule.Users/{Pages,Endpoints}/Account/converted to source-generated[LoggerMessage]static partial methods, matching the pattern already used inUserServiceandPageBuilderService. Endpoint classes were promoted topartial.Files changed
Pages/Admin/*,Endpoints/Admin/*), PageBuilder Pages (Editor,Manage,ViewerDraft), OpenIddict Pages (Clients,ClientsCreate,ClientsEdit).RegisterEndpoint,LoginEndpoint,LoginWith2faEndpoint,LoginWithRecoveryCodeEndpoint,LogoutEndpoint,ExternalLoginEndpoint,Manage/ChangePasswordEndpoint,Manage/DeletePersonalDataEndpoint,Endpoints/Account/AccountSecurityEndpoint,Endpoints/Users/DownloadPersonalDataEndpoint.Verification
dotnet build SimpleModule.slnx— succeeds with 0 warnings, 0 errors (TreatWarningsAsErrors is on globally).--no-build):Out of scope (still pending Constitution violations)
[NoDtoGeneration](Agents, AuditLogs, BackgroundJobs, Chat, Orders, PageBuilder, Products, RateLimiting)validate-framework-scope.mjsfor Phase 3/4 absorption)framework/.allowed-projects(in-flight per Constitution §13)@inertiajs/reactpeer depTest plan
Generated by Claude Code