René's URL Explorer Experiment


Title: id(didit): count_periods Week branch panics at calendar boundaries — unchecked NaiveDate arithmetic (residual of #7766) · Issue #7771 · developing-today/code · GitHub

Open Graph Title: id(didit): count_periods Week branch panics at calendar boundaries — unchecked NaiveDate arithmetic (residual of #7766) · Issue #7771 · developing-today/code

X Title: id(didit): count_periods Week branch panics at calendar boundaries — unchecked NaiveDate arithmetic (residual of #7766) · Issue #7771 · developing-today/code

Description: Problem count_periods in pkgs/id/src/didit/eval.rs (lines 395–402 on main b64288a567) computes the Period::Week branch with unchecked chrono date arithmetic: let monday = today - Duration::days(i64::from(today.weekday().num_days_from_mon...

Open Graph Description: Problem count_periods in pkgs/id/src/didit/eval.rs (lines 395–402 on main b64288a567) computes the Period::Week branch with unchecked chrono date arithmetic: let monday = today - Duration::days(i64...

X Description: Problem count_periods in pkgs/id/src/didit/eval.rs (lines 395–402 on main b64288a567) computes the Period::Week branch with unchecked chrono date arithmetic: let monday = today - Duration::days(i64...

Opengraph URL: https://github.com/developing-today/code/issues/7771

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(didit): count_periods Week branch panics at calendar boundaries — unchecked NaiveDate arithmetic (residual of #7766)","articleBody":"## Problem\n\n`count_periods` in `pkgs/id/src/didit/eval.rs` (lines 395–402 on main `b64288a567`) computes the `Period::Week` branch with unchecked `chrono` date arithmetic:\n\n```rust\nlet monday = today - Duration::days(i64::from(today.weekday().num_days_from_monday()));\nlet start = midnight(tz, monday)?;\nlet end = midnight(tz, monday + Duration::days(7))?;\nlet previous_start = midnight(tz, monday - Duration::days(7))?;\n```\n\n`NaiveDate + Duration` / `NaiveDate - Duration` **panic** on overflow (chrono implements them as `checked_add_signed(...).expect(\"`NaiveDate + TimeDelta` overflowed\")`). For a `now` in the first or last week of the representable calendar, `monday + 7 days`, `monday - 7 days`, or the Monday offset subtraction itself runs off the end of `NaiveDate`'s range and the evaluator panics — in debug *and* release builds.\n\nThis is the residual door of #7766. That fix converted the `Period::Custom` branch to checked arithmetic with the comment that \"the Day/Week branches get [OutOfRange] from the calendar\" — true for `Day`, which uses `succ_opt()`/`pred_opt()` (eval.rs:388–394), but not for `Week`, which uses the panicking operators. `evaluate` is documented as a pure function that \"can be replayed for any past instant\" (eval.rs module docs / `didit/mod.rs`), so a calendar-boundary `now` must answer `EvalError::OutOfRange`, never panic.\n\nThe same unchecked-operator pattern survives once more in the same file: `resolve_local` (eval.rs:573) computes `naive + Duration::hours(1)` when a local time falls in a DST gap; `NaiveDateTime + Duration` panics the same way at the top of the representable range. Audit it in the same pass (a checked add that falls through to the existing UTC fallback is sufficient).\n\n## Evidence (verified this run, laptop, main `b64288a567`)\n\nProbe `~/git/fleet/probe-didit-week-overflow` (laptop): the Week/Day branches and their helpers copied verbatim from `eval.rs` (file md5 `592058f89673b9202523c586c80b36fc`), built against chrono 0.4.45 (the version in `pkgs/id/Cargo.lock`), run in **release** mode:\n\n```\nNaiveDate::MAX=+262142-12-31 weekday=Mon max_now=8210266833600\nNaiveDate::MIN=-262143-01-01 weekday=Thu min_now=-8334601185600\ncontrol week ordinary: Ok(((1699833600, 1700438400), (1699228800, 1699833600)))\ncontrol day  ordinary: Ok(((1699920000, 1700006400), (1699833600, 1699920000)))\nweek now=MAX-date noon: PANIC\nday  now=MAX-date noon: Err(OutOfRange)\nweek now=MIN-date noon: PANIC\nday  now=MIN-date noon: Err(OutOfRange)\n```\n\nSame instants, same function: `Day` returns `OutOfRange`, `Week` panics at both calendar ends. Ordinary-input controls pass for both branches.\n\n## Why it matters\n\n- A panic in the pure evaluator aborts whatever projection/app pass called `evaluate` — the exact failure mode #7766 fixed for `Custom`, one branch over.\n- The #7766 fix comment now actively misdocuments the Week branch as calendar-guarded, so the residual is likely to survive future audits that trust the comment.\n\n## Acceptance criteria\n\n- [ ] `count_periods` `Period::Week` uses checked date arithmetic (`checked_add_signed` / `checked_sub_signed` or `succ_opt`-style stepping) and returns `EvalError::OutOfRange` when the week's Monday, its +7d end, or its −7d previous start is unrepresentable.\n- [ ] `resolve_local`'s `+ Duration::hours(1)` shift is checked or otherwise panic-free at the representable boundary.\n- [ ] Regression test mirroring `custom_period_extreme_anchor_is_out_of_range_not_a_panic_or_wrapped_window`: a Week-period expectation evaluated at a `now` on `NaiveDate::MAX` and on `NaiveDate::MIN` returns `Err(EvalError::OutOfRange)` (test fails — panics — pre-fix); an ordinary Week expectation still evaluates.\n- [ ] The #7766 comment in the `Custom` branch is corrected if it still claims the Week branch is calendar-guarded.\n- [ ] `cargo test` for the `didit` module passes.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-08T17:48:26Z","url":"https://github.com/developing-today/code/issues/7771"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a043fe41-98d5-98e5-21e7-74b9e4b4c0f5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA32C:197E15:40D3C8:5A09D5:6B073408
html-safe-nonce4d0f22711b7d1d49f54f1c7fa293d7dd3eb7d6d37c5d513b0ef0c40a0d4f5c51
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzJDOjE5N0UxNTo0MEQzQzg6NUEwOUQ1OjZCMDczNDA4IiwidmlzaXRvcl9pZCI6IjUzMjg3MjcyNDExNzIzOTkxMTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca0e4c2b6238e0f9aecc0e6c53926f9ff73fd7289a1f16cd3392967e2cc061581
hovercard-subject-tagissue:6273789189
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7771/issue_layout
twitter:imagehttps://opengraph.githubassets.com/eefcbdc2eee34e01451d2d0d43d92d2c41e4d21613b96f27b7ba8d3c7262d6a1/developing-today/code/issues/7771
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/eefcbdc2eee34e01451d2d0d43d92d2c41e4d21613b96f27b7ba8d3c7262d6a1/developing-today/code/issues/7771
og:image:altProblem count_periods in pkgs/id/src/didit/eval.rs (lines 395–402 on main b64288a567) computes the Period::Week branch with unchecked chrono date arithmetic: let monday = today - Duration::days(i64...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedezren39
hostnamegithub.com
expected-hostnamegithub.com
None2a60952cad7efb2604ea85e500208f51c1ec1943aa260ac605c13eb46a1ed83b
turbo-cache-controlno-preview
go-importgithub.com/developing-today/code git https://github.com/developing-today/code.git
octolytics-dimension-user_id26439447
octolytics-dimension-user_logindeveloping-today
octolytics-dimension-repository_id627308783
octolytics-dimension-repository_nwodeveloping-today/code
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627308783
octolytics-dimension-repository_network_root_nwodeveloping-today/code
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release345c27626db08417fdfc84278a4415ae9a48d8f3
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/developing-today/code/issues/7771#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F7771
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F7771
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=developing-today%2Fcode
Reloadhttps://github.com/developing-today/code/issues/7771
Reloadhttps://github.com/developing-today/code/issues/7771
Reloadhttps://github.com/developing-today/code/issues/7771
developing-todayhttps://github.com/developing-today
codehttps://github.com/developing-today/code
Codehttps://github.com/developing-today/code
Issues1.1k (1.1k)https://github.com/developing-today/code/issues
Pull requests197 (197)https://github.com/developing-today/code/pulls
Discussionshttps://github.com/developing-today/code/discussions
Actionshttps://github.com/developing-today/code/actions
Projectshttps://github.com/developing-today/code/projects
Wikihttps://github.com/developing-today/code/wiki
Security and qualityhttps://github.com/developing-today/code/security
Insightshttps://github.com/developing-today/code/insights
https://github.com/developing-today/code
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7771
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7771
#7773https://github.com/developing-today/code/pull/7773
id(didit): count_periods Week branch panics at calendar boundaries — unchecked NaiveDate arithmetic (residual of #7766)https://github.com/developing-today/code/issues/7771#top
#7773https://github.com/developing-today/code/pull/7773
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
effort/xshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fxs%22
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
status/donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fdone%22
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
https://github.com/dezren39
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#issue-6273789189
#7766https://github.com/developing-today/code/issues/7766
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
dezren39https://github.com/dezren39
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505000931
https://github.com/apps/developing-today
developing-todayhttps://github.com/apps/developing-today
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#issuecomment-6724918013
developing.todayhttps://kaneo.security.cab
CODE-2310https://kaneo.security.cab/dashboard/workspace/6oQgIkST0YGrCcxrnhbHPOUCfgdD3cqE/project/pfcq432h349r20up18gttfv4/task/nnkeo6svth2g6g65oucqyi8x
dezren39https://github.com/dezren39
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
effort/xshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fxs%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505001759
https://github.com/dezren39
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#issuecomment-6724923268
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
fix(id/didit): checked arithmetic in count_periods Custom branch (#7766) #7769https://github.com/developing-today/code/pull/7769
https://github.com/dezren39
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#issuecomment-6724928014
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
dezren39https://github.com/dezren39
work/self-assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fself-assigned%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505049609
developing-todayhttps://github.com/apps/developing-today
status:in-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Ain-review%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505437690
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505460391
Merge pull request #7773 from developing-today/creator-a/7771-didit-w…https://github.com/developing-today/code/commit/00ca41860980985d37347c7c67bd3c526382a455
#7773https://github.com/developing-today/code/pull/7773
00ca418https://github.com/developing-today/code/commit/00ca41860980985d37347c7c67bd3c526382a455
dezren39https://github.com/dezren39
completedhttps://github.com/developing-today/code/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#7773https://github.com/developing-today/code/pull/7773
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505460499
developing-todayhttps://github.com/apps/developing-today
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
status:in-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Ain-review%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505473518
https://github.com/apps/developing-today
developing-todayhttps://github.com/apps/developing-today
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#issuecomment-6725045104
developing.todayhttps://kaneo.security.cab
id(didit): count_periods Custom branch overflows on extreme anchors — panics in debug, silently fabricates/drops windows in release #7766https://github.com/developing-today/code/issues/7766
fix(id/didit): checked NaiveDate arithmetic in count_periods Week branch (#7771) #7773https://github.com/developing-today/code/pull/7773
00ca418https://github.com/developing-today/code/commit/00ca41860980985d37347c7c67bd3c526382a455
00ca418https://github.com/developing-today/code/commit/00ca41860980985d37347c7c67bd3c526382a455
fix(id/didit): checked NaiveDate arithmetic in count_periods Week branch (#7771) #7773https://github.com/developing-today/code/pull/7773
00ca418https://github.com/developing-today/code/commit/00ca41860980985d37347c7c67bd3c526382a455
developing-todayhttps://github.com/apps/developing-today
status/donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fdone%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
work/self-assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fself-assigned%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7771#event-35505559732
Sign up for freehttps://github.com/signup?return_to=https://github.com/developing-today/code/issues/7771
Sign in to commenthttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7771
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
effort/xshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fxs%22
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/normalhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Fnormal%22
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
status/donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fdone%22
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.