Repository navigation
fix: say when a date filter or task date names a day the calendar lacks #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a563eee
fix: say when a date filter or task date names a day the calendar lacks
aliasunder 5d1bd22
style: clarify the date-check comments, name the task date check asse…
aliasunder 5be28ee
test: cover the scheduled and start date checks and match date errors…
aliasunder a97ce2c
test: cover the created.after date check in vault_search's filters
aliasunder fd3c110
test: match every task-mutation and hybrid-search error message exactly
aliasunder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { describe, expect, it } from "vitest" | ||
| import { classifyIsoDate } from "../classify-iso-date.js" | ||
|
|
||
| describe("classifyIsoDate", () => { | ||
| it.each([ | ||
| { label: "an ordinary day", text: "2026-07-03" }, | ||
| { label: "February 29 in a leap year", text: "2024-02-29" }, | ||
| ])("classifies $label as a calendar date", ({ text }) => { | ||
| expect(classifyIsoDate(text)).toBe("calendar-date") | ||
| }) | ||
|
|
||
| it.each([ | ||
| { label: "February 30", text: "2026-02-30" }, | ||
| { label: "February 29 outside a leap year", text: "2025-02-29" }, | ||
| { label: "month 13", text: "2026-13-01" }, | ||
| { label: "month 00", text: "2026-00-10" }, | ||
| { label: "day 00", text: "2026-02-00" }, | ||
| ])("classifies $label as not a calendar date", ({ text }) => { | ||
| expect(classifyIsoDate(text)).toBe("not-a-calendar-date") | ||
| }) | ||
|
|
||
| it.each([ | ||
| { label: "a single-digit month and day", text: "2026-7-3" }, | ||
| { label: "a timestamp", text: "2026-07-03T10:30:00" }, | ||
| { label: "a five-digit year", text: "20260-01-01" }, | ||
| { label: "slashes", text: "2026/07/03" }, | ||
| { label: "a month name", text: "March 10" }, | ||
| { label: "surrounding whitespace", text: " 2026-07-03" }, | ||
| { label: "an empty string", text: "" }, | ||
| ])("classifies $label as malformed", ({ text }) => { | ||
| expect(classifyIsoDate(text)).toBe("malformed") | ||
| }) | ||
| }) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { DateTime } from "luxon" | ||
|
|
||
| type IsoDateClass = "calendar-date" | "malformed" | "not-a-calendar-date" | ||
|
|
||
| /** Classifies text by whether it names a real day in YYYY-MM-DD form. The two failures: | ||
| * - "malformed": not in that form, such as "2026-7-3", "March 10" or a timestamp | ||
| * - "not-a-calendar-date": in that form, but the month or day doesn't exist, | ||
| * such as 2026-02-30 or 2026-13-01 | ||
| * They stay apart so an error message can name the failure: a client told only | ||
| * "use YYYY-MM-DD" sends 2026-02-30 again, since it already used that form. */ | ||
| export const classifyIsoDate = (text: string): IsoDateClass => { | ||
| const parsedDate = DateTime.fromFormat(text, "yyyy-MM-dd") | ||
|
|
||
| if (parsedDate.isValid) return "calendar-date" | ||
|
|
||
| // Luxon checks the form first ("unparsable" when it doesn't match), then the | ||
| // calendar ("unit out of range" for a month or day that doesn't exist) | ||
| if (parsedDate.invalidReason === "unit out of range") return "not-a-calendar-date" | ||
|
|
||
| return "malformed" | ||
| } | ||
4 changes: 2 additions & 2 deletions
4
src/vault-mcp/mcp-core/__tests__/__snapshots__/tool-surface/default.json
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/vault-mcp/mcp-core/__tests__/__snapshots__/tool-surface/disabled-tools.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.