Deterministic time-window eligibility engine for GuildPass rules - #407
Merged
Lakes41 merged 3 commits intoAug 30, 2026
Merged
Conversation
…amantine-guild#380) Adds packages/time-window, a pure rule-evaluation primitive with explicit boundary semantics: inclusive/exclusive edges, UTC-normalized comparisons, any/all multi-window evaluation, a pure merge helper, injectable clock, and safe rejection of reversed/invalid dates. 47 unit tests covering all acceptance criteria; no domain or persistence dependencies. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Contributor
|
This PR cannot be merged automatically because it has merge conflicts. Please update the branch with the latest base branch and resolve the conflicts. After the conflicts are resolved and checks pass, the automation can review it again. |
…w-engine # Conflicts: # pnpm-lock.yaml
Upstream tsconfig.base.json pins types to ["node"], which dropped the jest globals in test files. Declare ["node", "jest"] locally. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
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.
Closes #380
Summary
Implements
packages/time-window, a pure, dependency-free time-window evaluator for GuildPass rules, per the issue's independence requirement (no membership/reward/governance/persistence integration).What's included
TimeWindowwith explicitstartInclusive/endInclusiveboundary flagsInvalidTimeWindowError); zero-length windows allowedisWithinWindow— single-window evaluation with exact boundary semanticsisWithinWindows— multi-window evaluation with documentedany(default) andallmodesisWindowActive— current-time evaluation with an injectable clock (no real-time sleeps in tests)mergeWindows— pure helper merging overlapping/touching windows; inclusive edge wins; input order irrelevant; output sorted.getTime()), never local-time stringsAcceptance criteria coverage (47 unit tests)
Date.UTC,-04:00offset, offset-defined window edges) evaluate identicallypnpm typecheck/pnpm build/pnpm testpass in the packageTest plan
pnpm --filter @guildpass/time-window typecheckpnpm --filter @guildpass/time-window buildpnpm --filter @guildpass/time-window test(47/47 pass)🤖 Generated with Codebuff