Repository navigation
Instance endpoints need an obj_owner and are bounded in size (#30) - #31
Merged
Merged
Conversation
This was referenced Oct 13, 2026
thorwhalen
added a commit
that referenced
this pull request
Oct 13, 2026
…als/closures - obj_shrinkers: names still callable while an instance endpoint is over its limit, so a client can bring it back under (one client could otherwise lock everyone out). - bounded_deep_sizeof follows what bound methods, partials and closures hold. - Document what is not measured and the per-call cost; fix the 401/403 comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thorwhalen
added a commit
that referenced
this pull request
Oct 13, 2026
…, guarded traversal - obj_shrinkers: a str is refused, every name must be dispatched. - Measuring and setting/clearing the over-limit flag happen under one lock. - bounded_deep_sizeof follows MethodType.__func__, function attributes and defaults, static/class methods; an object whose attributes raise is measured plainly instead of failing the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An instance endpoint (an object exposed through attr_names) is one object every client shares. Like class endpoints (#29), it now needs obj_owner: a (request) -> owner hook that refuses unidentified requests, or the named opt-in obj_owner=shared_objects. Module endpoints are unchanged. max_obj_size / obj_sizeof bound it: checked when the service is built and after every call; once over, the object is kept and calls are refused until it is back under. AuthorizationError now maps to 401 (its subclasses ForbiddenError and OverwritesNotAllowed to 403) in the Bottle and aiohttp error handlers, which share one status table. The aiohttp handler resets current_request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…als/closures - obj_shrinkers: names still callable while an instance endpoint is over its limit, so a client can bring it back under (one client could otherwise lock everyone out). - bounded_deep_sizeof follows what bound methods, partials and closures hold. - Document what is not measured and the per-call cost; fix the 401/403 comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, guarded traversal - obj_shrinkers: a str is refused, every name must be dispatched. - Measuring and setting/clearing the over-limit flag happen under one lock. - bounded_deep_sizeof follows MethodType.__func__, function attributes and defaults, static/class methods; an object whose attributes raise is measured plainly instead of failing the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thorwhalen
force-pushed
the
fix/instance-endpoint-owner-and-size
branch
from
October 13, 2026 05:15
9eb671f to
a184a15
Compare
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.
Closes #30. Mirrors #29 (class endpoints) for instance endpoints: a handler whose
endpointis an object, dispatched throughattr_names.Change
obj_owner:(request) -> ownerhook, which refuses requests it does not identify (401);obj_owner=shared_objects(anyone).ValueErrornaming both options.max_obj_size(defaultDFLT_MAX_OBJ_SIZE) andobj_sizeof(defaultbounded_deep_sizeof) apply to the instance.AuthorizationErrornow maps to 401, and its subclassesForbiddenErrorandOverwritesNotAllowedto 403. Before, all three got 400. Bottle and aiohttp now share one status table (error_status).aiohttp_handle_requestnow resetscurrent_request.Breaking default
This is the same decision as #28, extended to instance endpoints: the safe default plus a named opt-in. The fleet has two such handlers, both in addaix/raglab_app and both exposing writes to anyone; an issue is filed there.
examples/object_dispatch.pynow passesobj_owner=shared_objects, with a comment.Gates
pytest --doctest-modules py2http: 136 passed.priv test-dependents py2http --transitive: py2http and extrude pass.Adversarial review
Two fresh Opus passes.
Pass 1: SHIP-WITH-FIXES. It found no way past the owner gate. Fixed:
obj_shrinkers, names still callable while it is over.bounded_deep_sizeofdid not follow bound methods, partials or closures.AuthorizationErrorsubclass gets 403.RuntimeError. Fixed in binary_loads passthrough for mk_cli and api_pkg_maker; the generated package compiles (#21) http2py#22, which maps 401 toAuthorizationError.obj_mutatorsperformance knob, module endpoints, andWWW-Authenticate.InputError(it was not changed to 507), so existing http2py clients keep gettingInputError.Pass 2, on those fixes: SHIP-WITH-FIXES. Fixed:
strpassed asobj_shrinkerswas split into letters, and unknown names were accepted. Both are now refused at build.MethodType.__func__, function__dict__and defaults, static and class methods) are now followed.__getattr__raisingKeyError) made the measurement raise. They are now measured plainly.Behaviour change for class endpoints: an object holding a bound method of another object is now charged that whole object, as holding the object itself already was. If that is not wanted, raise
max_obj_sizeor pass anobj_sizeof.🤖 Generated with Claude Code