test(learning): anchor the detector fixture calendar to today - #1148
Open
kavin-114 wants to merge 1 commit into
Open
test(learning): anchor the detector fixture calendar to today#1148kavin-114 wants to merge 1 commit into
kavin-114 wants to merge 1 commit into
Conversation
The mini-org fixture dated every row from a literal 2025-09-01. Five detectors scan a 12-month window, so from 2026-09-06 the oldest Work Orders fell out of mfg-default-bom-usage's window, the Widget habit dropped to 19 units under the n_min of 20, and shard 4 went red on develop and both hotfix lines. The other 12-month detectors were on the same slope with more headroom. _day(ordinal) is now anchor + ordinal days with the anchor fixed once per build() at today minus 11 months, so the dataset always sits 230..335 days back: inside the tightest window with a month of headroom, never in the future, and still older than the engine's 180-day dormant cutoff, which is the age class the literal dates had and test_orchestrator patches around. The Beta go-live burst and the _insert creation fallback ride the same anchor. The print-log tests keep their literal days on purpose: they assert exact periods and the watermark and are bucketed by print-log creation, not by these fixture dates. Claude-Session: https://claude.ai/code/session_01CkvbXsZAizy4UDh9ZWjn51
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shard 4 fails on develop and both hotfix lines from 2026-09-06 because the learning-detector fixture dated every row from a literal 2025-09-01, and that morning the oldest Work Orders aged out of the 12-month window that
mfg-default-bom-usagescans. Nobody notices in the product; this only unblocks CI. The same commit is cherry-picked onto the open #1142 backports (#1146, #1147), so the hotfix lines receive it there and this PR carries no backport labels.What changed
factory._day(ordinal)is now anchor plus ordinal days, with the anchor fixed once perbuild()at today minus 11 months._insertcreation fallback ride the same anchor.Risk and verification
Root cause
window_start = add_months(today, -12). The Widget Work Orders sit on_day(0..23)= 2025-09-01..24 and the gate isn_min = 20. On 2026-09-05 the window started at 2025-09-05, leaving indices 4..23 = 20 units, exactly at the gate. On 2026-09-06 it moved to 2025-09-06, leaving 19 units, soreduce_unitsproduced no candidate. The failing run loggedrows_scanned=40, raw_candidate_count=0: 19 Widget plus 21 Elec rows.Four more detectors use a 12-month window (
cfg-naming-series,cfg-default-vs-usage,cfg-custom-field-always-filled,role-doctype-routing) and one uses 24; they were on the same slope with more headroom, which is why the fix re-anchors the whole fixture instead of bumping one ordinal.Pre-merge checklist
testscheck on this PR passes (never merge on ❌)develop, orversion-N-hotfixfor a backport)version-N: this is the release PR fromversion-N-hotfix,__version__is bumped, andrelease-sourceis greenhttps://claude.ai/code/session_01CkvbXsZAizy4UDh9ZWjn51