Support multiple parents in bottle extends:
#268
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Today a bottle's
extends:accepts only a single parent (a string). It would be useful to extend from multiple bottles so that orthogonal concerns (e.g. abaseenv bottle, anetworking/egress bottle, anagent_providerbottle) can be composed independently rather than forced into one linear chain.Current behavior
bot_bottle/manifest_extends.pyreadsextends:as a single value and requires it to be a string:Passing a list (e.g.
extends: [base, networking]) dies with "extends must be a string". The only way to combine multiple bottles today is a linear chain (my-agent->networking->base), which couples the parents to each other and can't express true multiple inheritance.Proposed behavior
Allow
extends:to be either a string (current) or a list of bottle names:Parents are resolved and folded left-to-right, then the child is merged on top. Precedence: later parents win over earlier parents on conflict, and the child wins over all parents (last-wins, consistent with the existing child-wins rules).
Implementation sketch
The merge primitives in
manifest_extends.pyare already written as binaryparent (+) childoperations, so they compose for a fold:_resolve_one_bottle: acceptstr | list[str]; normalize to a list; resolve each parent (reusing the existing cycle detection across all parents in the chain); fold the resolved parents left-to-right into a single effective parent, then run the existing_merge_bottles(parent, child_raw, ...)._resolve_repos_raw: today folds parent repos with child repos; fold across the multiple parents first to get the combined parent repo set, then merge the child against that._merge_egress: route lists already concatenate; folding multiple parents concatenates their routes in declaration order before the child's.Open questions
Tests
extends:as a plain string still worksSee PRD 0025 (
docs/prds/0025-bottle-extends.md) for the original merge rules.