- NT8StrategyBase.cs: persist MicroUpgradeThreshold advisory state per account - NT8StrategyBaseMicroUpgradeTests.cs: add source guards for persistence, corrupt files, and Account-null behavior - SPRINT_BOARD.md and decisions.md: record Option A and verification evidence Build: clean | Tests: 550 passing; Core 461 passing | Dual-deployed: no - skipped per operator instruction
4.6 KiB
TASK: GAP-051 — MicroUpgradeThreshold advisory re-fires every restart
Staged: 2026-08-18 (v7.0 review, "raised, not yet prompted"), evidenced 2026-08-23/24
Sprint: Stage 1 — housekeeping, zero trading-behaviour risk (advisory-only)
Owner: Kilocode
─────────────────────────────────────────────────────────────────
THE DEFECT
MonitorMicroAccountUpgrade() (NT8StrategyBase.cs ~851-869) is meant to
suggest, once, that the operator review RiskTier after account balance
crosses MicroUpgradeThreshold (default $5,000.00):
if (_microUpgradeSuggested || Account == null || MicroUpgradeThreshold <= 0.0 || State != State.Realtime)
return;
...
if (balance >= MicroUpgradeThreshold)
{
_microUpgradeSuggested = true;
string message = string.Format("TIER_UPGRADE_SUGGESTED: Balance={0:F2} crossed threshold={1:F2}; review RiskTier setting.", balance, MicroUpgradeThreshold);
Print(message);
FileLog(message);
}
_microUpgradeSuggested is reset to false in the State.SetDefaults
branch (~line 522), which runs on every strategy enable — i.e. every
restart. Any account already above MicroUpgradeThreshold gets the
TIER_UPGRADE_SUGGESTED message again on every single restart (recompiles,
connection recovery, manual stop/start), not once per account lifetime.
Same defect class as GAP-055 (MaxDailyTrades not surviving a restart),
applied to an advisory message instead of the daily trade cap.
IMPACT
Advisory-only. Print/FileLog only — never touches order flow, sizing,
risk, or REJECT/SIGNAL behavior. The impact is log/output noise on
repeated restarts of an account already above threshold, not a trading
defect.
READ-FIRST
- Read
NT8StrategyBase.cs~851-869 (MonitorMicroAccountUpgrade) and ~515-525 (State.SetDefaults, where_microUpgradeSuggestedresets). - Read how GAP-055 persisted
MaxDailyTrades(SimpleORBStrategy.cs, commit6658d2d) — the pattern (JSON file keyed by account/strategy name, rehydrate onState.Realtime, degrade to a safe default on missing/corrupt file, skip entirely whenAccount == null) is directly reusable here if persistence is the chosen fix.
THE CHANGE — pick one, and say which and why in your writeback
Option A — persist the suggested-state, so the advisory only ever fires
once per account lifetime (or once per calendar period, if that reads
better — your call, but state the semantics explicitly). Reuse GAP-055's
persistence pattern rather than inventing a new one; a small dedicated file
(e.g. {LogDirectory}/micro_upgrade_suggested_<AccountName>.json) is
preferable to overloading GAP-055's own file with an unrelated field.
Option B — leave it as an intentional per-session reminder. If you
conclude the current behavior is defensible (an operator restarting the
strategy might reasonably want to be re-reminded, unlike a hard trading
limit like MaxDailyTrades), say so explicitly with reasoning, and instead
just improve the REJECT/log-noise concern some other way (e.g. only
re-print once per calendar day even across restarts, using the same
trading-date logic GAP-055 established, without full cross-restart
persistence).
Do not silently pick one without explaining the tradeoff in your writeback.
DO NOT
- Do not change any order flow, sizing, or risk-validation logic.
- Do not change the
TIER_UPGRADE_SUGGESTEDmessage format if you keep it. - Do not touch
MaxDailyTradespersistence itself (GAP-055) — reuse its pattern, don't modify its file or logic.
TESTS (required)
- If persisting: same-restart-suggested-already → no second message. New qualifying period (however you define it) → message fires again. Missing/corrupt persistence file → safe default (message fires, consistent with "advisory, better to over-remind than silently suppress forever on a corrupt file"), logged, no exception.
Account == null(backtest/Strategy Analyzer) → no file I/O, unchanged behavior either way.
VALIDATION (operator)
None required for correctness — this is advisory/log-noise only. If you want visual confirmation, restart the strategy twice on an account above threshold and confirm the message behavior matches whichever option was implemented.
GOVERNANCE
Track as [GAP-051] in SPRINT_BOARD.md. Update docs/00-governance/decisions.md
DEC-20260823-06 status to implemented with an implementation note stating
which option was chosen and why.
Reference: this task, DEC-20260823-06.