Commit 07792ad
Make the planner-hook tests assert what their names claim
`test_with_extensions_threads_the_planner_through_in_order` never checked
an order: it asserted each hook recorded one fallback and that the second
was not None, both of which hold for a host that ran the hooks backwards.
`test_with_extensions_skips_a_planner_hook_returning_none` asserted only
that downstream ran, while its comment claimed the skipped hook had not
become downstream's fallback.
`_PlannerExtension` now takes an optional shared list the hooks append
themselves to, so order is observable. The threading test asserts that
list, plus that the second hook's fallback is not the object the first was
handed -- the host re-exports every return value before passing it on. A
capsule is opaque from Python, so that cannot separate a re-export of the
first planner from a fresh read of the session's; the comment says so and
points at the FFI suite's `test_with_extensions_nests_planners_in_argument_order`,
which pins the nesting by asserting the outer planner delegated.
The skip test records the skipped hook's fallback too, and asserts both
hooks ran, that downstream was handed a different capsule, and that the
resulting context still queries.
Each new assertion was mutation-tested: reversing the planner loop, dropping
the `if supplied is None: continue`, and replacing the re-export with a
straight pass-through each fail exactly one of these tests.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent d13787b commit 07792ad
1 file changed
Lines changed: 47 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
945 | | - | |
| 945 | + | |
946 | 946 | | |
947 | 947 | | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
948 | 951 | | |
949 | 952 | | |
| 953 | + | |
950 | 954 | | |
951 | 955 | | |
952 | 956 | | |
| |||
1053 | 1057 | | |
1054 | 1058 | | |
1055 | 1059 | | |
1056 | | - | |
| 1060 | + | |
| 1061 | + | |
1057 | 1062 | | |
1058 | 1063 | | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
1065 | 1079 | | |
1066 | 1080 | | |
1067 | 1081 | | |
| |||
1079 | 1093 | | |
1080 | 1094 | | |
1081 | 1095 | | |
1082 | | - | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1083 | 1102 | | |
1084 | 1103 | | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
1085 | 1107 | | |
1086 | | - | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1087 | 1113 | | |
| 1114 | + | |
1088 | 1115 | | |
1089 | | - | |
| 1116 | + | |
1090 | 1117 | | |
1091 | | - | |
1092 | | - | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
1093 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1094 | 1128 | | |
1095 | 1129 | | |
1096 | 1130 | | |
| |||
0 commit comments