Ship owner Z.ai peak-hour blackout policy (Mon–Fri 14:00–18:00 Asia/Singapore) as selector-policy configuration #66

Closed
opened 2026-09-12 00:15:51 +00:00 by kilo · 0 comments
Member

Task

Provide the owner's Z.ai peak-hour avoidance policy as configuration, using the existing D-026 weekly blackout mechanism. Desired behavior: do not select Z.ai / GLM models Monday–Friday 14:00–18:00 Singapore time (Asia/Singapore, UTC+8). Outside those hours the neutral policy behavior is unchanged.

Why

The D-026 blackout mechanism exists and is tested (WeeklyBlackoutRule, evaluate_blackouts), but no concrete owner schedule ships with the product, so scarcity-select / scarcity_select currently run with the neutral policy that has no blackouts. The documented first concrete requirement for the mechanism was exactly this personal rule ("preserve Z.ai for off-peak use", docs/selection-policy.md, "Provider schedules and peak-hour policy").

This is configuration, not a hard-coded vendor peak schedule — consistent with docs/selection-policy.md ("The user's desired schedule therefore belongs in configuration and must carry an explicit timezone and deterministic boundary semantics") and the neutral_selector_policy() docstring (no checked-in personal quota policy as default; the file is opt-in via --selector-policy / inline MCP selector_policy).

Proposed change

  1. Add examples/selector-policy.json: a SelectorPolicy document identical to the neutral policy plus one weekly blackout rule:
    • rule_id: zai-peak-hours-sgt
    • target: {"provider": "zai"} (provider-only target → covers GLM-5.3 and GLM-5.3-Flash; no wildcard syntax involved)
    • timezone: Asia/Singapore (fixed UTC+8, no DST)
    • weekdays: mon–fri
    • start_local: 14:00, end_local: 18:00 (half-open [start, end): 14:00 blocked, 18:00 not blocked)
    • reason_code: preserve_zai_offpeak
  2. Document usage: CLI --selector-policy examples/selector-policy.json; MCP/REST callers pass the same document inline as selector_policy.
  3. Add a behavior-focused test that loads the checked-in file through load_selector_policy and verifies: z.ai blocked inside the window on weekdays, not blocked at 13:59/18:00, not blocked on weekends, and openai candidates unaffected.

No product/code changes are expected — the mechanism is complete.

Acceptance

  • The file validates through SelectorPolicy.from_dict.
  • Boundary semantics verified by test (half-open interval, weekday list, timezone conversion).
  • Full validation gate passes: uv sync --only-dev, make check, uv run basedpyright, git diff --check.
  • One feature branch from develop, one PR targeting develop, left open for human review.
## Task Provide the owner's Z.ai peak-hour avoidance policy as configuration, using the existing D-026 weekly blackout mechanism. Desired behavior: **do not select Z.ai / GLM models Monday–Friday 14:00–18:00 Singapore time (Asia/Singapore, UTC+8)**. Outside those hours the neutral policy behavior is unchanged. ## Why The D-026 blackout mechanism exists and is tested (`WeeklyBlackoutRule`, `evaluate_blackouts`), but no concrete owner schedule ships with the product, so `scarcity-select` / `scarcity_select` currently run with the neutral policy that has no blackouts. The documented first concrete requirement for the mechanism was exactly this personal rule ("preserve Z.ai for off-peak use", `docs/selection-policy.md`, "Provider schedules and peak-hour policy"). This is configuration, not a hard-coded vendor peak schedule — consistent with `docs/selection-policy.md` ("The user's desired schedule therefore belongs in configuration and must carry an explicit timezone and deterministic boundary semantics") and the `neutral_selector_policy()` docstring (no checked-in personal quota policy as *default*; the file is opt-in via `--selector-policy` / inline MCP `selector_policy`). ## Proposed change 1. Add `examples/selector-policy.json`: a `SelectorPolicy` document identical to the neutral policy plus one weekly blackout rule: - `rule_id`: `zai-peak-hours-sgt` - `target`: `{"provider": "zai"}` (provider-only target → covers GLM-5.3 and GLM-5.3-Flash; no wildcard syntax involved) - `timezone`: `Asia/Singapore` (fixed UTC+8, no DST) - `weekdays`: `mon`–`fri` - `start_local`: `14:00`, `end_local`: `18:00` (half-open `[start, end)`: 14:00 blocked, 18:00 not blocked) - `reason_code`: `preserve_zai_offpeak` 2. Document usage: CLI `--selector-policy examples/selector-policy.json`; MCP/REST callers pass the same document inline as `selector_policy`. 3. Add a behavior-focused test that loads the checked-in file through `load_selector_policy` and verifies: z.ai blocked inside the window on weekdays, not blocked at 13:59/18:00, not blocked on weekends, and openai candidates unaffected. No product/code changes are expected — the mechanism is complete. ## Acceptance - The file validates through `SelectorPolicy.from_dict`. - Boundary semantics verified by test (half-open interval, weekday list, timezone conversion). - Full validation gate passes: `uv sync --only-dev`, `make check`, `uv run basedpyright`, `git diff --check`. - One feature branch from `develop`, one PR targeting `develop`, left open for human review.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Creatidy/scarcity-router#66
No description provided.