feat(fsrs): add srs-kit rescheduler - #426
Conversation
🦋 Changeset detectedLatest commit: 0747871 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0747871682
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| initialState: input.initialState, | ||
| }) as readonly MemoryStateOf<Scheduler>[] | ||
| const memoryState = | ||
| memoryStates.at(-1) ?? |
There was a problem hiding this comment.
Avoid Array.at in the ES2017 UMD path
When consumers run the UMD bundle in an ES2017 browser without Array.prototype.at, every call to reschedule() reaches this expression and throws a TypeError instead of returning the rebuilt state. The browser bundle explicitly targets ES2017 in packages/fsrs/tsdown.config.ts, and transpilation does not polyfill built-in prototype methods; use ordinary index access so the new API works across the configured target.
Useful? React with 👍 / 👎.
Summary
Reschedulerclass inpackages/fsrsthat accepts an existing srs-kit scheduler core{ rating, reviewTime }[], derive intervals through the configured chronology, and rebuild memory with onemodel.forward()callmemoryStateTemporal.Instantchronologies, validation, type inference, and empty-history behaviorVerification
pnpm --filter @open-spaced-repetition/srs-kit checkpnpm --filter @open-spaced-repetition/srs-kit test— 25 files, 201 tests passedpnpm --filter ts-fsrs checkpnpm --filter ts-fsrs typecheckpnpm --filter ts-fsrs test— 51 files passed, 425 passed, 1 skippedpnpm --filter ts-fsrs buildpnpm --filter ts-fsrs benchBenchmark
100-review replay on the local WSL environment:
model.forward: ~49,962 ops/sRescheduler.reschedule: ~33,029 ops/sThe rescheduler remains a single
model.forward()replay plus chronology-to-interval conversion.