Rule builder: relative-date operators ("in the last N days") (#176 follow-up) #435

Closed
opened 2026-07-18 01:50:36 +02:00 by timothy · 3 comments
Owner

Follow-up to #176 (PR #433). The builder only supports absolute date ranges — a relative "in the last N days" cannot be stored as relative in the compile-only Lucene string (a client-baked absolute date goes stale). Needs a query-time macro (the index already has released_inthelast-style helpers in CustomMultiFieldQueryParser — wire the builder to emit them and parse them back).

Done-when

  • adversarial review passed
  • relative-date operator compiles/parses round-trip; docs updated
Follow-up to #176 (PR #433). The builder only supports absolute date ranges — a relative "in the last N days" cannot be stored as *relative* in the compile-only Lucene string (a client-baked absolute date goes stale). Needs a query-time macro (the index already has `released_inthelast`-style helpers in `CustomMultiFieldQueryParser` — wire the builder to emit them and parse them back). ## Done-when - [x] adversarial review passed - [x] relative-date operator compiles/parses round-trip; docs updated
timothy added the enhancementpriority: lowfrontend labels 2026-07-18 01:50:36 +02:00
Author
Owner

🔗 Session bundle — rule builder (#176 follow-ups): #434, #435, #436, #437, #438

All frontend RuleBuilder follow-ups deferred from #176: facet-value typeahead (#434), relative-date operators (#435), deeper nesting (#436), inline adoption in ChannelBuilder & Auto-Tune (#437), input validation & polish (#438). One SPA component, one session.

When you claim any member, check this cluster for co-workable siblings and sweep the disjoint set in one session (per docs/handoffs/chicorytv-issue-queue.md → bundles).

🔗 **Session bundle — rule builder (#176 follow-ups):** #434, #435, #436, #437, #438 All frontend RuleBuilder follow-ups deferred from #176: facet-value typeahead (#434), relative-date operators (#435), deeper nesting (#436), inline adoption in ChannelBuilder & Auto-Tune (#437), input validation & polish (#438). One SPA component, one session. When you claim any member, check this cluster for co-workable siblings and sweep the disjoint set in one session (per docs/handoffs/chicorytv-issue-queue.md → bundles).
timothy added the in-progress label 2026-07-23 18:39:00 +02:00
Author
Owner

Claiming as part of a single-session RuleBuilder bundle sweep (#438 + #435 + #434). Building on one feature branch feat/rulebuilder-bundle (shared RuleBuilder.tsx makes splitting churny); #434 backend endpoint delegated to a parallel worktree. Design doc + spec to follow. Leaving #436 (deeper nesting, self-labeled YAGNI) and #437 (inline adoption) open.

Claiming as part of a single-session RuleBuilder bundle sweep (#438 + #435 + #434). Building on one feature branch `feat/rulebuilder-bundle` (shared `RuleBuilder.tsx` makes splitting churny); #434 backend endpoint delegated to a parallel worktree. Design doc + spec to follow. Leaving #436 (deeper nesting, self-labeled YAGNI) and #437 (inline adoption) open.
Author
Owner

Closing record

Outcome: Shipped in PR #577. Visual rule builder gains inLast/notInLast date operators + a day|week|month|year unit picker, compile/parse-mapped onto the pre-existing released_inthelast/added_inthelast (+notinthelast) CustomMultiFieldQueryParser macros. Frontend-only, no backend change. Strict /^\d+$/ operand validation.
Root cause: N/A (new feature). The relative-date macros already existed in the query parser but were only reachable by typing raw Lucene; #435 exposes them as first-class builder operators.
Decisions/conventions changed: added rulebuilder.relative-date-macros (docs/decisions.md).
Reusable knowledge: the backend already had relative-date query macros — this was a frontend exposure, not new query capability (recon-before-building). Strict digit-string validation is required because an HTML <input type="number"> accepts 1e2/7.0, which Number.isInteger passes but which break the compile→parse round-trip (released_inthelast:"7.0 day" doesn't parse back).
Verification: web 980/980 incl. round-trip property test (roundtrip.test.ts compares against normalizeGroup); live-E2E confirmed case-insensitive prefix on state/video_dynamic_range as the endpoint proxy.
Deferred: none.
Docs updated: docs/decisions.md (rulebuilder.relative-date-macros), docs/spa-conventions.md §12.

## Closing record **Outcome:** Shipped in PR #577. Visual rule builder gains `inLast`/`notInLast` date operators + a `day|week|month|year` unit picker, compile/parse-mapped onto the pre-existing `released_inthelast`/`added_inthelast` (+`notinthelast`) `CustomMultiFieldQueryParser` macros. Frontend-only, no backend change. Strict `/^\d+$/` operand validation. **Root cause:** N/A (new feature). The relative-date macros already existed in the query parser but were only reachable by typing raw Lucene; #435 exposes them as first-class builder operators. **Decisions/conventions changed:** added `rulebuilder.relative-date-macros` (`docs/decisions.md`). **Reusable knowledge:** the backend already had relative-date query macros — this was a frontend *exposure*, not new query capability (recon-before-building). Strict digit-string validation is required because an HTML `<input type="number">` accepts `1e2`/`7.0`, which `Number.isInteger` passes but which break the compile→parse round-trip (`released_inthelast:"7.0 day"` doesn't parse back). **Verification:** web 980/980 incl. round-trip property test (`roundtrip.test.ts` compares against `normalizeGroup`); live-E2E confirmed case-insensitive prefix on `state`/`video_dynamic_range` as the endpoint proxy. **Deferred:** none. **Docs updated:** `docs/decisions.md` (`rulebuilder.relative-date-macros`), `docs/spa-conventions.md` §12.
timothy removed the in-progress label 2026-07-23 21:18:01 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#435