docs(core): state the dateRange end offset as a derived property, not a typed count - #17607
Merged
os-musk merged 1 commit intoSep 11, 2026
Merged
Conversation
… a typed count The docblock above `PRESET_WINDOW_TOKENS` explained why the table states its own ends instead of reading `DATE_RANGE_PRESET_MACRO_WINDOWS`: the spec table is written for `$between`, whose bare-day upper bound covers the whole day, so its end names one day earlier. The clause carried a hand-typed census -- "the eight period presets" -- and went false when the spec corrected `today` and `yesterday` to close on their own last day. Re-measured from code at this head over the declared vocabulary: 13 presets, 10 with a prescribed (non-null) end and 3 with the open arm; for all 10 the prescription's end is exactly one CALENDAR day before this table's end token, across 32 reference cells each. No exception, and no new disagreement. So the sentence no longer carries a digit at all: it states the predicate, and the test derives the calendar/rolling split from the spec table so an eleventh preset reds the pin instead of rotting the prose. The pin also fixes the unit -- a Pacific/Chatham DST Sunday makes `this_week`'s prescribed last day 25 hours long, which a millisecond-shaped "one day" would get wrong. Claude-Session: https://claude.ai/code/session_01RuoNSXUbBoWHkNS4AknTrM Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift Check
What this run could not see
Coarse fallback — 24 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
os-musk
marked this pull request as ready for review
September 11, 2026 03:35
os-musk
enabled auto-merge
September 11, 2026 03:35
os-musk
deleted the
claude/issue-17341-date-range-preset-count-sentence
branch
September 11, 2026 04:04
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.
Fixes #17341
Clause-②: no
The docblock above
PRESET_WINDOW_TOKENSinpackages/core/src/utils/analytics-date-range.tsrecords why this table states its own ends instead of reading the spec's prescription pair —
and it ended on a hand-typed census: "so its ends are one day earlier for the eight period
presets." That count was correct when written and went false when #17338 corrected
todayand
yesterdayto close on their own last day. The sentence is load-bearing (it is the recordedreason the design is what it is), so the fix is the census, not the digit.
The census — population, method, reading
Population: the declared vocabulary
DATE_RANGE_PRESETS(packages/spec/src/data/date-range-presets.ts),read at this head — 13 names.
packages/spec/**was read only; nothing in it is edited here.Method: executable, at
00b994374. For each preset, resolve the spec's prescribed end(
DATE_RANGE_PRESET_MACRO_WINDOWS[p][1], unwrapped) through the one resolver(
resolveFilterToken) to a calendar day, takenextUtcCalendarDayof it, render that day'sstart in the reference zone, and compare with the
endthis module actually returns. Swept over8 reference instants × 4 zones = 32 cells per preset — the instants include both DST
transition days and both year edges, the zones include
Pacific/Chatham(+12:45) andAmerica/New_York.Reading:
DATE_RANGE_PRESETS)todayyesterdaythis_weeklast_weekthis_monthlast_monththis_quarterlast_quarterthis_yearlast_yearnull(rolling open arm)last_7_dayslast_30_dayslast_90_daysSo the split at this head is ten / three, which is what the card predicted — but it is now
measured rather than typed, and the prose no longer carries the digit at all: it states the
predicate ("every calendar preset, with no remainder") and the test derives the split from the
spec table. An eleventh preset now reds the pin instead of rotting the sentence.
One thing the census corrected in the card's own terms: "one day earlier" is a calendar
day, not 86_400_000 ms.
Pacific/Chathamleaves DST on the first Sunday of April, so2026-04-05 — exactly the day
this_week's prescription names as its last — is 25 hours longthere. An elapsed-milliseconds reading of the same sentence measures 1.0416… days on that cell
and is wrong. The implementation was always right (every boundary here is a macro token); only
the wording was ambiguous, and the pin now fixes the unit.
Hard stop, checked and clear: the census shows all ten agreeing in one uniform way. There is
no new disagreement between this table's ends and the spec's prescription, so this stayed a
comment fix and did not become a defect report.
Does the justification still hold? (asked, answered, not dropped)
Yes, and it is stronger than before: the offset used to be irregular (two presets were not "one
day earlier" at all), and is now uniform across all ten. ⛔ But uniform is not derivable, and the
docblock now says so — deriving the ends from the spec's would mean shifting a resolved day by
one in this file, i.e. calendar arithmetic performed here, which is the second implementation
the module header exists to refuse. That is the risk the newly-uniform table creates for the next
reader, so it is recorded rather than left to be rediscovered.
The pin, and proof it can fail
New
describe('#17341 …')block inanalytics-date-range.test.ts. It counts nothing: bothfamilies are read off
DATE_RANGE_PRESET_MACRO_WINDOWS, the open-arm family is asserted equal tothis module's
ROLLING, and a vacuity control asserts both families are non-empty.Ablation (one-shot, on the committed state, restored):
this_weekend tokennext_week_start→week_end4f6d4829→af99f042git checkout HEAD -- path4f6d4829,git diff HEADemptyThe mutated leg is the point: under a wrong end token every pre-existing assertion in the file
still passed. Nothing in the resolution path goes through
dist(the test imports the modulerelatively, inside its own package), so no build step stands between the mutation and the run.
Verification
pnpm --filter '@objectstack/core^...' buildpnpm --filter @objectstack/core testpnpm --filter @objectstack/core typecheckcheck:test-typecheck: 4 files / 4 errors, ledger held)node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack→ 53 commandsGate derivation ran against the actual changed files (2 paths, three-dot vs merge base
82cb69fed) and was reconciled with--ran.pnpm check:type-check-debtfirst exited 3(PREREQUISITE NOT MET — OOM at the 4096 MB cap this container prefixes, which the gate itself
named as the tighter of the two ceilings); re-run at 8192 MB it exits 0 — "5 ledger entries
re-measured in 102.6s, 55 raw tsc errors total, none above its recorded number". Two other gates
(
check:dual-build-cjs-loads,check:lean-entry-closure) exited 3 on an unbuilt tree and exit 0after
turbo run buildover all 72 workspace packages. ⛔ No exit 3 is reported here as a pass.Release declaration —
skip-changeset, measuredThis diff publishes nothing, and that is a measurement rather than a judgement.
@objectstack/coreships
files: ["dist","README.md","CHANGELOG.md"]. Built at this head:Chatham0 dist files,86_400_0000;resolveAnalyticsDateRangePreset4, the moduleheader's
STOPS BEFORE2, the exported interface's own TSDocthe ten calendar presets2(so exported-symbol and module-header comments do reach
dist/*.d.ts; this docblock sits on amodule-private const and does not);
dist/index.js.maphassourcesContent: false, so no source text ships through the maps either.The other changed file is a test. ⇒ route 2 of the Check Changeset job ("it releases nothing →⚠️ The dispatch order asked for a
apply the
skip-changesetlabel", marked PREFERRED there).changeset; this is the one place this PR departs from it, on the measurement above, and it is
flagged in the report rather than chosen silently.
Acceptance notes
the ten CALENDAR presets/the three ROLLING) and theResolvedAnalyticsDateRangedocblock still carry typed counts. Both are true at this head —the census confirms 10 and 3 — so they are not defects and are not filed. They are also no
longer unguarded: the new pin asserts the spec-derived open-arm family equals this module's
ROLLINGand that every spec-derived calendar preset isendExclusive, so the PR that adds aneleventh preset reds here and is routed to this file. Noted, not filed.
endExclusive, the three rollinglast_N_dayspresets and every START are untouched, asanalytics-date-range.tssays the spec's prescription ends are "one day earlier for the eight period presets" — PR #17338 makes it ten, and makes that sentence false #17341said they would be. The "STARTS agree exactly" half of the sentence was re-checked and is still
true; its pin already existed and is unchanged.
Generated by Claude Code
Generated by Claude Code