You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(config): validate RIExchangeMode on PUT /api/config #1196
PUT /api/config unmarshals the body onto GlobalConfig wholesale, and GlobalConfig.Validate never constrains RIExchangeMode. So a typo, "" or "Auto" is stored as-is (see the armed() comment at internal/api/handler.go:570-580). The RI-exchange config endpoint does validate the mode (internal/api/handler_ri_exchange.go:2845, only manual or auto).
Today the scheduler routes every non-manual value to auto-execution. After LeanerCloud/cloud-commitments-go#578, RunAutoExchange fails closed on anything other than exactly auto or manual. A stored bad value then makes the scheduled run fail loudly instead of auto-executing. That is safer, but it surfaces a config the API should never have accepted.
Fix:
Validate RIExchangeMode (manual | auto) on PUT /api/config, preferably in GlobalConfig.Validate so every writer is covered, with the same error the RI-exchange endpoint returns.
Add tests for the typo, "" and "Auto" cases.
Once only manual and auto can be stored, update the armed() comment. Keep armed() itself fail-safe (!= "manual") for rows already stored with bad values.
Status update (2026-10-27, checked against main at 7b86e38): Waiting on a held PR.
Main still doesn't validate ri_exchange_mode on PUT /api/config. Since the go pin moved past go#578 (#1466/#1490), a stored bad value now fails the scheduled exchange run loudly instead of auto-executing. Held draft PR #1243 (D5) fixes it but currently has merge conflicts.
Left / blocked on: Held open PR #1243 (D5); needs a rebase (CONFLICTING).
Activity
IAmJSD commentedon Oct 22, 2026
Claiming: working on this
IAmJSD commentedon Oct 27, 2026
Status update (2026-10-27, checked against main at 7b86e38): Waiting on a held PR.
Main still doesn't validate ri_exchange_mode on PUT /api/config. Since the go pin moved past go#578 (#1466/#1490), a stored bad value now fails the scheduled exchange run loudly instead of auto-executing. Held draft PR #1243 (D5) fixes it but currently has merge conflicts.
Left / blocked on: Held open PR #1243 (D5); needs a rebase (CONFLICTING).
fix(config): validate ri_exchange_mode on PUT /api/config (#1243)