feat(protocols): declare WebServiceRules protocol for validate_business_rules - #106
Merged
marlon-costa-dc merged 3 commits intoSep 26, 2026
Merged
Conversation
…ss_rules V8 slice S4 member lane (bead flext-4jtcb.10, consumers-first). Before flext-core trims the truthful p.Service surface, flext-web declares its own local protocol for the phantom validate_business_rules() member that its six real service classes already implement. - Add p.Web.WebServiceRules (@runtime_checkable Protocol extending p.Base, not p.Service, since p.Service still carries unimplemented members that would make it structurally unsatisfiable today) in _protocols/lifecycle.py, declaring only validate_business_rules. - FlextWebApp/Auth/Entities/Handlers/Health/Services.validate_business_rules already implement it (unchanged bodies). - Add a behavioral test proving isinstance(web, p.Web.WebServiceRules) is True through a protocol-typed static helper (avoids a pyright reportUnnecessaryIsInstance false trigger from narrowing on the concrete FlextWeb facade type). - make upg/make gen refreshed the lock and toolchain-generated docs projections in the same commit. make mod: 0 actionable findings; 21 pre-existing detection-only ban-test-tautology findings remain in files this PR does not touch (tests/unit/test_constants.py, test_fields.py, test_models.py). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # uv.lock
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
marlon-costa-dc
deleted the
feat/v8-s4-declare-own-service-capabilities
branch
September 26, 2026 19:11
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.



Slice / bead
V8 slice S4 (bead
flext-4jtcb.10), member lane 2/3, consumers-first: before flext-core trimsp.Serviceto (settings, container, context, logger, track, execute), this member declares its own local protocol for the phantomvalidate_business_rules()member that its six real service classes already implement.What / why
src/flext_web/_protocols/lifecycle.py: addp.Web.WebServiceRules, a@runtime_checkableProtocol declaring onlyvalidate_business_rules(self) -> p.Result[bool]. It extendsp.Base, notp.Service, becausep.Servicecurrently still carries unimplemented members (service_info,ok,fail_op) that would make any protocol extending it structurally unsatisfiable by a real service today.FlextWebApp,FlextWebAuth,FlextWebEntities,FlextWebHandlers,FlextWebHealth,FlextWebServices(all six realp.Service-based service classes) already implementvalidate_business_rules; bodies unchanged.tests/unit/test_services.py: new behavioral testtest_web_satisfies_its_own_service_rules_protocolprovingisinstance(web, p.Web.WebServiceRules)isTrueagainst the real composedFlextWebfacade singleton, and.validate_business_rules()is callable with its real result. The isinstance check runs through a@staticmethodhelper typed(candidate: p.Base) -> boolso pyright does not narrow the argument to the concreteFlextWebtype and flag the check asreportUnnecessaryIsInstance.make upg/make genrefresheduv.lock,pyproject.toml,Makefile,.gitignore,mkdocs.ymland toolchain-generated docs projections in the same commit.Runtime proof (E3, before/after)
Before this change,
p.Web.WebServiceRulesdid not exist.Gate exits
make upgmake setupmake gen(x2, fixed point)make fixdocs/configuration/README.md:11(````pythonmalformed fence), a known defect covered by the separatefix/markdown-fences-compilebranch per this session's brief. Confirmed withmd_fence_scan.py: onlydocs/configuration/README.md:76fails, a file this PR does not touch.make fmtmake checkmake modban-test-tautologyfindings in files this PR does not touch:tests/unit/test_constants.py,test_fields.py,test_models.py)make testConsumer table
No downstream member in this fleet currently declares a sub-protocol over
p.Web.WebServiceRules; this PR is additive-only (new protocol + new test), zero call-site changes.LOC delta
+108 / -40 across 11 files (mostly toolchain-generated: lock, docs projections). Hand-authored delta:
_protocols/lifecycle.py+15/-0,tests/unit/test_services.py+9/-1.DO NOT MERGE.
🤖 Generated with Claude Code
Summary by cubic
Adds
p.Web.WebServiceRules, a runtime-checkable protocol declaringvalidate_business_rules(), soflext-webdeclares its own service-rules capability beforeflext-coretrims the currently-unimplementedp.Servicesurface. The change is additive-only: all six real service classes already implement the method, and no call sites change.Details
p.Base, notp.Service, becausep.Servicestill carries unimplemented members (service_info,ok,fail_op) that would make it structurally unsatisfiable.FlextWebfacade satisfies the protocol andvalidate_business_rules()resolves toTrue; the isinstance check runs through ap.Base-typed static helper to avoid a pyrightreportUnnecessaryIsInstancefalse positive.make upg/make gen: the lockfile now pins S2/S3/S5 integration tips,pyproject.tomldrops thefail_undercoverage floor, and a Git hook validation script plus regenerated docs landing pages arrived with the toolchain refresh.Written for commit 48b684e. Summary will update on new commits.