| @@ -12,14 +12,10 @@ | ||
| 12 | 12 | |
| 13 | 13 | defined('ABSPATH') || exit; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Availability — the highest-value read in the whole surface, and the one with | |
| 17 | - * the tightest response budget. | |
| 18 | - * | |
| 19 | - * One tool, not two. A single-slot check ("is 2pm Tuesday free?") is the same | |
| 20 | - * question with a narrower answer, so it is a `start_time` parameter here | |
| 21 | - * rather than a second permanently-resident schema. | |
| 16 | + * Availability tools. A single-slot check is a `start_time` parameter on | |
| 17 | + * get-available-slots rather than a separate tool, to save schema budget. | |
| 22 | 18 | */ |
| 23 | 19 | class SlotTools |
| 24 | 20 | { |
| 25 | 21 | public static function definitions() |
| @@ -184,15 +180,11 @@ | ||
| 184 | 180 | |
| 185 | 181 | $startTime = sanitize_text_field((string) Arr::get($params, 'start_time', '')); |
| 186 | 182 | |
| 187 | 183 | if ($startTime) { |
| 188 | - // The same strict, DST-aware conversion create-booking uses. A bare | |
| 189 | - // strtotime() truthiness check accepted "2026-08-24" (silently | |
| 190 | - // meaning midnight, so the answer was "not available" and the agent | |
| 191 | - // concluded the day was closed) and "next tuesday" (resolved | |
| 192 | - // relative to now). Worse, it accepted strings create-booking then | |
| 193 | - // rejected, so an agent could be told a slot was free and be unable | |
| 194 | - // to book it with the same value. | |
| 184 | + // Same strict conversion create-booking uses, so a value reported | |
| 185 | + // as free can always be booked. strtotime() would accept a bare | |
| 186 | + // date or "next tuesday". | |
| 195 | 187 | $startUtc = MCPHelper::toUtc($startTime, $timezone); |
| 196 | 188 | |
| 197 | 189 | if (is_wp_error($startUtc)) { |
| 198 | 190 | return $startUtc; |
| @@ -237,10 +229,9 @@ | ||
| 237 | 229 | ], |
| 238 | 230 | $result |
| 239 | 231 | ); |
| 240 | 232 | |
| 241 | - // Only worth stating when it actually constrains the answer; on an | |
| 242 | - // indefinite range it is false and would just be noise. | |
| 233 | + // False on an indefinite range, so only included when it constrains. | |
| 243 | 234 | $maxLookup = $event->getMaxLookUpDate(); |
| 244 | 235 | |
| 245 | 236 | if ($maxLookup) { |
| 246 | 237 | $data['bookable_until'] = $maxLookup; |
| @@ -257,11 +248,10 @@ | ||
| 257 | 248 | |
| 258 | 249 | /** |
| 259 | 250 | * Load the event and confirm the caller may see it. |
| 260 | 251 | * |
| 261 | - * Slots are public information on the booking page, but reaching them | |
| 262 | - * through an authenticated operator tool implies acting on that calendar, so | |
| 263 | - * the same read gate the admin uses applies here. | |
| 252 | + * Slots are public, but this is an operator tool, so the admin read gate | |
| 253 | + * still applies. | |
| 264 | 254 | * |
| 265 | 255 | * @param array $params |
| 266 | 256 | * @return CalendarSlot|\WP_Error |
| 267 | 257 | */ |