FEAT: Redesign Status/Codes taxonomy and lookup - #402
Merged
Conversation
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.
Overview
Rewrites
kiit-codes(Status.kt,Codes.kt,StatusException.kt) with a corrected taxonomy, a new bidirectional HTTP-code lookup abstraction, and fixes to two bugs. The changes here are only forkiit-codes, I'm not making changes tokiit-result, which depends on it, this will be a subsequent step.Ticket(s)
n/a
Example
Dependencies
None — self-contained within
src/core/codes.Design
Statusis asealed interfacewith all subtypes enumerated in the same file.Ignoredremoved as a type, merged intoFilteredFilteredcreated, withCodes.SKIPPEDvsCodes.DISCARDED)FILTERED/IGNOREDcode collision (both were200204).Informationadded as a fourthPassedcategory forABOUT/VERSION( was succeeded before)Unknownrenamed/re-scoped toUnserviceableDeniednarrowed to strictly security/access-control codes (UNAUTHENTICATED,UNAUTHORIZED);FORBIDDENmoved toErrored.Codes.toHttp/Codes.toStatus/Codes.ofCode/Codes.containsCodeLookupinterface (toCode/toStatus, direction-explicit), aCodesToHttpwhenover categories + a small overrides map,toStatusderived fromtoCodeso the two directions can never drift apart), and aCompositeLookupfor client extension via composition rather than subclassing.Codesnow has aninitblock that fails fast if any two registered codes collide — a structural fix for the class of bug that caused the originalFILTERED/IGNOREDcollision.Notes
Status.ofCode's operator-precedence bugsuccesshoisted ontoPassed/Faileddirectly as aget()Status.toType'swhenis now genuinely exhaustive (noelse)README.mdupdated to match the new taxonomy, including a new "HTTP Conversion"Pending
kiit-result, which depends onkiit-codes, has not yet been updated for the renamed/removed typesTests
ktlintCheck,detekt, andjvmTest.