feat: [GH-74] Temporal-range key-bracket binding (foo[t1...t2])#77
Open
javierlores wants to merge 1 commit into
Open
feat: [GH-74] Temporal-range key-bracket binding (foo[t1...t2])#77javierlores wants to merge 1 commit into
javierlores wants to merge 1 commit into
Conversation
Extend the leaf key-bracket grammar so a key can bind to a half-open temporal interval [start, end) instead of a single instant, using the `...` range separator. Three forms are supported on flat leaf keys: foo[t1...t2] closed range [t1, t2) foo[...t2] open start (bounded on the end, exclusive) foo[t1...] open end (bounded on the start, inclusive) Grammar/AST/parse only; server-side evaluation of a range read is a separate concourse change. The canonical toString() renders both endpoints as resolved microseconds, making it a re-parseable cross-repo contract. - Refactor BracketedTimestamp() into a raw-string KeyBracketParameter() and centralize single-instant vs. range interpretation in Parsing.applyKeyBracket, leaving the single-instant and navigation paths unchanged. - Add TemporalRangeKeySymbol (sibling to TemporalKeySymbol): wraps a key plus optional start/end TimestampSymbols, rejects navigation and already-parameterized keys, requires at least one endpoint, and rejects backwards ranges (start > end). - Parse-time validation: reject fully-open foo[...], backwards ranges, double brackets, and content with more than one `...` separator (quote-aware so a quoted phrase containing `...` is not mis-split). - Range bindings reject on writes and audit/chronicle/diff for free via the existing requireNotParameterized guard. - Tests: matrix (closed/open/quoted/natural-language/round-trip and all rejection cases), node unit tests, and command acceptance/rejection. - Update CCL_REFERENCE.md section 8.4. Range bindings on navigation stops and scope prefixes remain out of scope. Part of the connector data-sync locking initiative; concourse must bump its ccl pin before the matching range-evaluation change lands.
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.
Closes #74.
What
Extends the leaf key-bracket grammar so a key can bind to a half-open temporal interval
[start, end)instead of a single instant, using the...range separator. Three forms are supported on flat leaf keys:foo[t1...t2][t1, t2)(start-inclusive, end-exclusive)foo[...t2]foo[t1...]This is grammar / AST / parse only. It defines the syntax, the AST node, and the canonical re-parseable string form. It does not decide what a range read returns — server-side evaluation (and the present-during vs. asserted-during choice) is a separate concourse change.
How
BracketedTimestamp()into a raw-stringKeyBracketParameter()and centralized single-instant vs. range interpretation inParsing.applyKeyBracket, leaving the single-instant and navigation-stop paths unchanged.TemporalRangeKeySymbol(sibling toTemporalKeySymbol): wraps a key plus optional start/endTimestampSymbols; rejects navigation and already-parameterized keys; requires at least one endpoint; rejects backwards ranges (start > end).isParameterized()istrue, so writes andaudit/chronicle/diffreject range bindings for free via the existingrequireNotParameterizedguard.toString()renders both endpoints as resolved microseconds (key[<m1>...<m2>]), making it a re-parseable cross-repo contract.Parse-time validation
foo[...](both endpoints omitted) → rejected.foo[t2...t1]witht2 > t1→ rejected.foo[t1][t2...t3](double bracket) → rejected.foo[t1...t2...t3](more than one separator) → rejected. Separator detection is quote-aware, so a quoted phrase that itself contains...is treated as a single endpoint rather than mis-split.Tests
BracketTimestampMatrixTest): closed / open-start / open-end, quoted-date and natural-language endpoints, round-trip of resolved endpoints, and all rejection cases (fully-open, backwards, double-bracket, multiple-separator).TemporalRangeKeySymbolTest): constructor guards, accessors,equals/hashCode, all threetoString()shapes.BracketTimestampCommandTest): range accepted onselect/get/find; rejected onaddandaudit.All parse-path and node tests pass locally, plus the existing
GrammarTest/JavaCCParserTest/CompilerJavaCCTestsuites (no regression). The parser regenerates cleanly fromgrammar.jjt.Scope / follow-ups
a[t1...t2].b) and scope prefixes; server-side evaluation.Keys.parseto re-parse the canonical rangetoString()produced here.Part of the connector data-sync locking initiative (cinchapi-server). Sibling grammar work: #75.