Repository navigation
feat: Flask route model for the test-session gates - #261
Merged
Merged
Conversation
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
ffroliva
marked this pull request as ready for review
November 21, 2026 03:43
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
Closes #75 for the test-session gates; the Flask console, request correlation and an example app continue in #260.
sharpit.flask: anAppIntrospectorfor Flask 2.3.3 and later overapp.url_map. Werkzeug parameters(
<id>,<int:id>,<path:p>,<uuid:u>,any(...), custom converters) become{id}; blueprint routes,blueprints registered twice under different names, the
staticendpoint and callable-object views are kept;views are never called.
inspect.getattr_static, the instance dictionary throughobject.__getattribute__)so it never runs host code: a Flask subclass's
__getattribute__and a rule's properties are not evaluated; a valuethat is a descriptor is treated as unreadable and degrades instead of crashing.
sys.modules(no sharpit module outsidesharpit.flaskimports Flask);--sharpit-appand autodetection recognise Flask applications. An application whose route map cannot be read isreported
UNKNOWNwith its reason, never as an empty pass.sharpit.flaskis added to the adapters and its import rule totests/engine/test_import_boundary.pyandAGENTS.md.strict_slashesand subdomain or host matching have no field in theroute model.
flaskstays in thetestextra only.PR #207 also edits
src/sharpit/pytest_plugin/apps.py; whichever merges second resolves the conflict.Tests
assert None is not None;assert [] == ['/ready']sharpit.flaskbitesassert [] == ["sharpit/engine/tools.py imports sharpit.flask.introspector"]test_routes_and_app_metadata_do_not_read_dynamic_flask_attributes,test_routes_do_not_evaluate_rule_properties['__dict__', '__dict__'] == [];['rule'] == []test_explicit_flask_app_with_unreadable_map_is_unknowntest_callable_view_with_explicit_endpoint_is_kept_without_calling_it[] == ['/callable']299 tests in
tests/flask,tests/flask_gate,tests/pytest_plugin, the import boundary and code shape pass onFlask 3.1.3; the Flask tests pass on Flask 2.3.3 with Werkzeug 2.3.8. Ruff, format and pyright pass.