Skip to content

fix: collect VDATE in one-page preflight#1179

Merged
chhoumann merged 2 commits intomasterfrom
1178-bug-vdate-breaks-one-page-input-modal-falls-back-to-sequential-prompts
May 4, 2026
Merged

fix: collect VDATE in one-page preflight#1179
chhoumann merged 2 commits intomasterfrom
1178-bug-vdate-breaks-one-page-input-modal-falls-back-to-sequential-prompts

Conversation

@chhoumann
Copy link
Copy Markdown
Owner

@chhoumann chhoumann commented May 4, 2026

Summary

  • collect VDATE variables as date requirements even when no explicit format is provided
  • default no-format VDATE to YYYY-MM-DD for preflight, prompts, and formatter output
  • add regression coverage for frontmatter VDATE, no-format VDATE, lowercase/whitespace syntax, and dropdown neighbors

Fixes #1178.

Validation

  • bun run test
  • bun run lint
  • bun run build
  • Obsidian dev vault E2E via obsidian vault=dev ...: validated explicit, no-format, and filename VDATE fixtures open one-page input and resolve output without dev errors

Summary by CodeRabbit

  • New Features
    • Date variables now support optional date format specifications that automatically default to YYYY-MM-DD when omitted, allowing for simpler and more intuitive declarations.
    • Parsing enhancements include case-insensitive pattern matching, improved whitespace tolerance, and better overall support for variations in date variable syntax formatting.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • bun.lockb is excluded by !**/bun.lockb

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ecbc0ae9-b186-4385-afb2-5d8e510f59d1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updated VDATE variable parsing to make the date format argument optional, defaulting to "YYYY-MM-DD" when omitted. The regex pattern now allows | in variable names and treats the format parameter as optional. Processing logic in formatters and requirement collectors was updated to handle missing formats uniformly throughout the codebase.

Changes

VDATE Format Argument Optionality

Layer / File(s) Summary
Regex Pattern
src/constants.ts
DATE_VARIABLE_REGEX relaxed: first capture group now allows |, and comma-separated format parameter (second group) is optional instead of required.
Core Processing
src/formatters/formatter.ts, src/preflight/RequirementCollector.ts
replaceDateVariableInString breaks only when variable name is missing; defaults dateFormat to "YYYY-MM-DD" when omitted. RequirementCollector.promptForVariable creates FieldRequirement even without explicit format, assigning default YYYY-MM-DD.
Integration / Wiring
src/formatters/completeFormatter.ts
VDATE branch now executes unconditionally (not gated on context.dateFormat); supplies context.dateFormat ?? "YYYY-MM-DD" to VDateInputPrompt.Prompt.
Tests / Validation
src/formatters/vdate-default.test.ts, src/preflight/RequirementCollector.test.ts
Added test cases verifying regex matches {{VDATE:Due Date}} without format, formatter resolves no-format VDATE with default, and requirement collector creates requirements with default date format. Includes tests for case-insensitive parsing and whitespace tolerance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • chhoumann/quickadd#1101: Related modifications to VDATE handling in src/formatters/formatter.ts for parsing and coercion of pre-seeded or missing date values.

Poem

🐰 A colon caused a YAML fright,
But format's now a choice, not might!
VDATE dances, comma-free,
Defaults paint the calendar spree.
One-page forms rejoice in sight! 🗓️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: collect VDATE in one-page preflight' directly describes the main change: enabling VDATE variable collection during one-page preflight, matching the core issue being resolved.
Linked Issues check ✅ Passed The PR addresses all primary requirements from issue #1178: VDATE tokens now work in one-page input modals, VDATE without format defaults to YYYY-MM-DD, regex parsing supports optional format, and comprehensive tests validate the fixes.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing VDATE handling: regex pattern updates, formatter logic adjustments, and test coverage for VDATE parsing with/without formats and optional whitespace.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1178-bug-vdate-breaks-one-page-input-modal-falls-back-to-sequential-prompts

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 4, 2026

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: f3e25bc
Status: ✅  Deploy successful!
Preview URL: https://80224dc4.quickadd.pages.dev
Branch Preview URL: https://1178-bug-vdate-breaks-one-pa.quickadd.pages.dev

View logs

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/constants.ts (1)

29-30: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

FORMAT_SYNTAX / FILE_NAME_FORMAT_SYNTAX missing no-format VDATE variants

The regex change in Line 100 makes the <date format> segment optional, but the suggestion arrays (used for autocomplete) still only list the two-argument form. Users inspecting the suggestion list won't discover that {{vdate:<variable name>}} is now valid.

📝 Proposed fix
 export const FORMAT_SYNTAX: string[] = [
     DATE_SYNTAX,
     "{{date:<dateformat>}}",
+    "{{vdate:<variable name>}}",
     "{{vdate:<variable name>, <date format>}}",
     "{{vdate:<variable name>, <date format>|<default value>}}",
 export const FILE_NAME_FORMAT_SYNTAX: string[] = [
     DATE_SYNTAX,
     "{{date:<dateformat>}}",
+    "{{vdate:<variable name>}}",
     "{{vdate:<variable name>, <date format>}}",
     "{{vdate:<variable name>, <date format>|<default value>}}",

Also applies to: 60-61

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/constants.ts` around lines 29 - 30, The suggestion arrays for date
formatting omit the one-argument VDATE variant even though FORMAT_SYNTAX and
FILE_NAME_FORMAT_SYNTAX regexes now allow omitting the <date format>; update the
suggestion entries used for autocomplete to include the no-format forms (e.g.,
add "{{vdate:<variable name>}}" alongside the existing "{{vdate:<variable name>,
<date format>}}" and "{{vdate:<variable name>, <date format>|<default value>}}")
wherever FORMAT_SYNTAX and FILE_NAME_FORMAT_SYNTAX suggestion lists are defined
so users can discover the valid single-argument form.
🧹 Nitpick comments (1)
src/formatters/formatter.ts (1)

553-650: 💤 Low value

Dead else { break; } branch — optional cleanup

After the explicit if (!variableName) break guard on lines 553–555, variableName is guaranteed to be a non-empty string when execution reaches line 557. The outer if (variableName) { ... } else { break; } wrapper is therefore dead code.

♻️ Proposed refactor
-        if (!variableName) {
-            break;
-        }
-
-        if (variableName) {
-            const existingValue = this.variables.get(variableName);
-            // ... (rest of processing block)
-            output = output.replace(match[0], formattedDate);
-        } else {
-            break;
-        }
+        if (!variableName) {
+            break;
+        }
+
+        const existingValue = this.variables.get(variableName);
+        // ... (rest of processing block)
+        output = output.replace(match[0], formattedDate);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/formatters/formatter.ts` around lines 553 - 650, The outer redundant
guard around the VDATE handling creates a dead else branch; remove the wrapping
"if (variableName) { ... } else { break; }" so the existing early check "if
(!variableName) break;" is the sole guard and the VDATE logic (references:
variableName, this.variables.get, this.promptForVariable, this.dateParser,
normalizeDateInput, parseDate, storedValue, formattedDate,
output.replace(match[0], ...)) is unwrapped one level inward — just delete the
else { break; } and its matching if(...) wrapper so the code inside executes
directly after the initial guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/constants.ts`:
- Around line 29-30: The suggestion arrays for date formatting omit the
one-argument VDATE variant even though FORMAT_SYNTAX and FILE_NAME_FORMAT_SYNTAX
regexes now allow omitting the <date format>; update the suggestion entries used
for autocomplete to include the no-format forms (e.g., add "{{vdate:<variable
name>}}" alongside the existing "{{vdate:<variable name>, <date format>}}" and
"{{vdate:<variable name>, <date format>|<default value>}}") wherever
FORMAT_SYNTAX and FILE_NAME_FORMAT_SYNTAX suggestion lists are defined so users
can discover the valid single-argument form.

---

Nitpick comments:
In `@src/formatters/formatter.ts`:
- Around line 553-650: The outer redundant guard around the VDATE handling
creates a dead else branch; remove the wrapping "if (variableName) { ... } else
{ break; }" so the existing early check "if (!variableName) break;" is the sole
guard and the VDATE logic (references: variableName, this.variables.get,
this.promptForVariable, this.dateParser, normalizeDateInput, parseDate,
storedValue, formattedDate, output.replace(match[0], ...)) is unwrapped one
level inward — just delete the else { break; } and its matching if(...) wrapper
so the code inside executes directly after the initial guard.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b32a389-ab15-4405-9a3d-62a4e8fd1723

📥 Commits

Reviewing files that changed from the base of the PR and between 5d63ee1 and 3754743.

📒 Files selected for processing (6)
  • src/constants.ts
  • src/formatters/completeFormatter.ts
  • src/formatters/formatter.ts
  • src/formatters/vdate-default.test.ts
  • src/preflight/RequirementCollector.test.ts
  • src/preflight/RequirementCollector.ts

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@chhoumann chhoumann merged commit 59232ff into master May 4, 2026
4 checks passed
@chhoumann chhoumann deleted the 1178-bug-vdate-breaks-one-page-input-modal-falls-back-to-sequential-prompts branch May 4, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] VDATE breaks one-page input modal, falls back to sequential prompts

1 participant