Repository navigation
{$now} param marker: dispatch-time dates with optional day offset - #16
Merged
Merged
Conversation
Mutations against real graphs carry timestamp params by convention
(update_issue_status($slug,$status,$actor,$at: Date) in the dev graph) —
but notebook YAML had no way to say "today" without going stale or
forcing a manual session-date control.
{ $now: date } resolves at dispatch/read time to "YYYY-MM-DD";
{ $now: datetime } to full ISO 8601. Optional offset_days shifts the
instant — before: { $now: date, offset_days: -60 } gives a sliding
60-days-ago threshold for stale-style queries. Resolved in resolveExpr,
so it works in mutation params AND query params (both read paths).
validate treats $now like $row/$input: reliably present at dispatch, no
"can't confirm it will be set" warning, and a marker object is never
mistaken for a literal param value.
Proven live against the dev graph (graph.modernrelay.ai): a priority
round-trip carried at=<today>, and the Triage stale list reads via
before={$now,offset_days:-60}.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TrhtF1SiJghJASMWECzBh
Greptile: (1) toISOString().slice(0,10) yielded the UTC calendar date — wrong "today" for anyone west of UTC in the evening; date form now uses local date components (datetime stays ISO/UTC — instants are tz-agnostic). (2) Unrecognized $now values (e.g. "Date") silently fell through to the date form; they now resolve to undefined so the server's required-param check surfaces the typo instead of a subtly wrong value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011TrhtF1SiJghJASMWECzBh
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.
Real-graph mutations carry timestamp params by convention (
update_issue_status($slug, $status, $actor, $at: Date)in the dev graph), but notebook YAML had no way to say "today" — a literal date goes stale; a manual session-date control is user ritual.The marker:
{ $now: date }resolves at dispatch/read time toYYYY-MM-DD;{ $now: datetime }to full ISO 8601. Optionaloffset_daysshifts the instant —before: { $now: date, offset_days: -60 }is a sliding 60-days-ago threshold for stale-style queries. Resolved centrally inresolveExpr, so it works in mutation params and query params alike.Validate:
$nowis treated like$row/$input— reliably present at dispatch (no spurious "can't confirm it will be set" warning) and never mistaken for a literal param value.Verified live against the dev graph (
graph.modernrelay.ai): a priority-edit round-trip carriedat=<today>through the server's required-params contract, and a Triage stale list reads withbefore={$now, offset_days:-60}(58 truly-stale rows vs 227 unfiltered).Tests: +2 (marker resolution date/datetime; offset window) — core at 116.
🤖 Generated with Claude Code
https://claude.ai/code/session_011TrhtF1SiJghJASMWECzBh
Greptile Summary
Introduces a
{ $now: "date" | "datetime", offset_days?: number }param marker that resolves at dispatch/read time to the local calendar date or a full UTC ISO-8601 instant, with an optional day offset for sliding-window thresholds. Previous review feedback has been addressed: thedateform uses local date components instead of UTC, and any value other than"date"/"datetime"now resolves toundefinedso the server's required-param check surfaces typos.resolve.ts: New branch inresolveExprhandles$nowbefore the plain-object recursion; usesgetFullYear/getMonth/getDate(local) for"date"andtoISOString()(UTC) for"datetime". Theoffset_daysmultiplier shifts by whole millisecond-equivalent days.validate.ts:$nowis classified as a "reliably present" dynamic source (same treatment as$row/$input) so no spurious "can't confirm it will be set" warning is emitted, andcontainsStateExprrecognises it so nested markers are detected correctly.index.test.ts: Three new suites cover date/datetime resolution against local wall-clock, the typo-guard, and the offset window (59–62 day bounds).Confidence Score: 5/5
Safe to merge; all logic is additive, the previous round's timezone and typo-guard concerns are addressed, and the new code is well-tested.
The change is a clean, self-contained addition to
resolveExprwith no modifications to existing branches. The local-date fix and theundefined-for-typos guard are correctly implemented and covered by tests. The only item worth a second look is theisFinitegap onoffset_days, which only affects obscure YAML edge cases (.nan,.inf) and does not touch any production path used today.No files require special attention. The
resolve.tsisFinitenote is a minor hardening suggestion.Important Files Changed
$nowmarker resolution inresolveExpr: local date components for"date", UTC ISO string for"datetime", optionaloffset_daysshift, and anundefinedguard for unrecognized format values.$nowas a "reliably present" dynamic source inliteralForValidationand adds it tocontainsStateExpr, eliminating spurious "can't confirm it will be set" warnings.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant YAML as Notebook YAML participant Validate as validate.ts participant Runtime as resolveExpr participant Server as OmniGraph Server YAML->>Validate: "param: { $now: "date", offset_days: -60 }" Validate->>Validate: "literalForValidation → {kind:"dynamic", source:"input"}" Note over Validate: No spurious "can't confirm" warning YAML->>Runtime: "dispatch("mutate", { params: { before: { $now: "date", offset_days: -60 } } })" Runtime->>Runtime: "$now" in value → resolve Runtime->>Runtime: "offsetDays = -60" Runtime->>Runtime: "d = new Date(Date.now() - 60d)" Runtime->>Runtime: local components → "YYYY-MM-DD" Runtime->>Server: "resolvedParams: { before: "2026-05-05" }" Server-->>Runtime: ok%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant YAML as Notebook YAML participant Validate as validate.ts participant Runtime as resolveExpr participant Server as OmniGraph Server YAML->>Validate: "param: { $now: "date", offset_days: -60 }" Validate->>Validate: "literalForValidation → {kind:"dynamic", source:"input"}" Note over Validate: No spurious "can't confirm" warning YAML->>Runtime: "dispatch("mutate", { params: { before: { $now: "date", offset_days: -60 } } })" Runtime->>Runtime: "$now" in value → resolve Runtime->>Runtime: "offsetDays = -60" Runtime->>Runtime: "d = new Date(Date.now() - 60d)" Runtime->>Runtime: local components → "YYYY-MM-DD" Runtime->>Server: "resolvedParams: { before: "2026-05-05" }" Server-->>Runtime: okReviews (2): Last reviewed commit: "$now: local calendar date + typo guard" | Re-trigger Greptile