Conversation
* Add ExecContext gates: analyzer rejects WASM-only nodes in flow statements, compiler rejects flow-only nodes in func blocks, LSP filters completions by execution context * Add flow representation for `time.now` (C++ and Go), making it the first ExecBoth node * Add optional `offset` parameter to `time.now` for both WASM and flow execution paths * Support negated literals in flow config values (e.g. `offset=-3h`) * Unit and integration tests across all layers * Gate exec context at call sites rather than the resolver, because resolver gating conflates wrong-context with undefined, requiring extra error plumbing to distinguish them and to avoid passing `ResolveAny` to 22 unrelated interfaces
…tion warnings for bare forms
…g in CompoundFactory Add status.set() as the preferred qualified form for set_status, with deprecation warning, LSP hover docs, and tests across Go and C++. Fix a latent bug in CompoundFactory/MultiFactory where qualified names with the same member (e.g. authority.set vs status.set) would collide after prefix stripping. Factories can now declare a module name so the dispatcher routes to the correct one.
…upport Move add, subtract, multiply, divide, mod, neg from op into math with deprecation warnings for bare forms. Symbols are ExecBoth, callable in both func blocks and flow statements. WASM host bindings added across all numeric types in Go and C++. pow remains ExecWASM only. Consolidate shared code for integration tests and hover.go
…s.set routing - Add SignedNumericConstraint kind that promotes unsigned types to wider signed equivalents (u8→i16, u16→i32, u32→i64, u64→f64) for math.neg - Add cross-type negate ops (NegateU8/U16/U32/U64) in telem/op - Handle promotion in both WASM compiler and flow constraint unifier - Fix CompoundFactory routing: move ModuleName() to Module so status nodes don't intercept authority.set - Restore status.set name config parameter - Check exec context before argument validation in analyzer
…improve error messages, and validate now() offset type
…since both are now internal. The `len` hover doc remains. The compiler dispatch for `string.len` stays since it's used internally when `len()` dispatches based on argument type.
c7d0401 to
120c35c
Compare
| # 0 - Summary | ||
|
|
||
| This RFC proposes a `ranges` module for the Arc programming language that exposes Synnax | ||
| range operations, initially `ranges.create` and `ranges.delete`, as first-class language |
There was a problem hiding this comment.
note: we should standardize on singular / plural for module names. Currently you have
status.set (singular) and ranges.create (plural). I think singular would make the
most sense here.
| ``` | ||
| ranges.create(name: string, start: timestamp, end: timestamp) -> string | ||
| ranges.create(name: string, start: timestamp, end: timestamp, color: string) -> string | ||
| ranges.create(name: string, start: timestamp, end: timestamp, color: string, parent: string) -> string |
There was a problem hiding this comment.
does this always have to be called in this exact order, even if i specify the arguments?
| | ------------------------- | ----------- | -------- | ------- | ------------------------------------------------------ | | ||
| | `name` | `string` | yes | | Human-readable range name | | ||
| | `start` | `timestamp` | yes | | Start time (nanosecond epoch, inclusive) | | ||
| | `end` | `timestamp` | yes | | End time (nanosecond epoch, inclusive) | |
There was a problem hiding this comment.
end should probably default to TimeStamp.MAX, which is what it would mean to create an
in-progress range
| | `color` | `string` | no | `""` | Hex color code (e.g., `"#FF0000"`) | | ||
| | `parent` | `string` | no | `""` | Parent range identifier (UUID key or range name) | | ||
| | `key` | `string` | no | auto | Pre-set UUID (server-generates if omitted). Flow-only. | | ||
| | `retrieve_if_name_exists` | `bool` | no | `false` | Return existing range if name matches. Flow-only. | |
There was a problem hiding this comment.
same comment as on statuses RFC: we should have same API for both Flow and WASM
| error. | ||
|
|
||
| Flow config values are static constants (not runtime expressions), so dynamic timestamps | ||
| like `time.now() - 1h` require the WASM form. |
|
|
||
| **Examples:** | ||
|
|
||
| ```go |
There was a problem hiding this comment.
you shouldn't call these go if they use the Arc syntax
| ``` | ||
|
|
||
| If multiple ranges share the parent name, the first match is used and a warning is | ||
| emitted. |
There was a problem hiding this comment.
This is another place where you might want to think more about safety vs usability.
Warning / erroring when there are multiple ranges means that the user will have to
think and specify what they want to do upfront, which is generally safer and means we
won't be doing anything "magic". However, the user needs to think about it before they
call, or we make it a general pattern to use when using Arc (like how Go has if err :=
...; err != nil { ... } )
| **Adaptations from client interface:** | ||
|
|
||
| - Arc uses separate `start` and `end` timestamps instead of a compound `TimeRange` | ||
| object because Arc has no struct or object types. |
There was a problem hiding this comment.
We might want to start thinking about how we could support an object / struct type in
Arc, especially for creating types like a range.Range type that we know has certain fields.
| | `core/pkg/service/arc/runtime/factory.go` | Add `Ranger *ranger.Service` to `FactoryConfig` | | ||
| | `core/pkg/service/arc/runtime/task.go` | Instantiate ranges module in WASM builder + `CompoundFactory` | | ||
| | `core/pkg/service/layer.go` | Wire `l.Ranger` into `FactoryConfig` | | ||
| | `arc/go/compiler/expression/compiler.go` | Add `compileBuiltinRangesCreate` for 3/4/5-arg dispatch | |
| | `parent` | `string` | no | `""` | Parent range identifier (UUID key or range name) | | ||
| | `key` | `string` | no | auto | Pre-set UUID (server-generates if omitted). Flow-only. | | ||
| | `retrieve_if_name_exists` | `bool` | no | `false` | Return existing range if name matches. Flow-only. | | ||
|
|
There was a problem hiding this comment.
should consider a way to set the stage of a range as well
Pull Request
SY-3961
Greptile Summary
This RFC defines the
rangesmodule for the Arc language, exposingranges.createandranges.deleteas dual-mode constructs (WASM host functions + Flow nodes). All concerns from the previous review round —colorshadowing, non-transactional batch delete counter, missing type definitions for all threecreatevariants,reportWarning/reportInfosignature ambiguity, Flow nodeNext()ignoringparent, and 3/4/5-arg dispatch description — have been addressed in this revision. The one remaining gap is the missing 4-argcreate_with_colorhost function snippet in Section 5.1.0.Confidence Score: 5/5
Documentation-only RFC; all previous blocking issues have been resolved and only a minor documentation gap remains.
All P0/P1 concerns from the prior round (color shadowing, non-transactional delete count, missing type definitions, reportWarning/reportInfo signatures, Flow node parent handling, dispatch arity description) have been addressed. The sole remaining finding is a P2 style gap (missing 4-arg snippet), which does not affect correctness.
No files require special attention beyond the minor snippet gap in Section 5.1.0.
Important Files Changed
rangesmodule (ranges.create/ranges.delete) with WASM host functions and Flow nodes; all prior review concerns resolved in this revision — one minor gap remains: the 4-argcreate_with_colorhost function snippet is missing from Section 5.1.0.Sequence Diagram
sequenceDiagram participant Arc as Arc Program (WASM) participant Host as Host Function (Go) participant RS as ranger.Service participant DB as Synnax Server Note over Arc,DB: ranges.create (3-arg) Arc->>Host: create(nameHandle, start, end) Host->>Host: strings.Get(nameHandle) → name Host->>Host: doCreate(name, start, end, "", zero ID) Host->>RS: w.Create(ctx, &rng) RS->>DB: persist range DB-->>RS: rng.Key (UUID) Host-->>Arc: strings.Create(key) → handle Note over Arc,DB: ranges.create (5-arg, with parent) Arc->>Host: create_with_color_parent(name,start,end,colorH,parentH) Host->>Host: resolveParent(parentStr) Host->>RS: NewRetrieve().WhereNames(parentStr) RS->>DB: query DB-->>RS: []ranger.Range Host->>RS: w.CreateWithParent(ctx, &rng, parentID) RS->>DB: persist range + ontology link DB-->>RS: rng.Key Host-->>Arc: handle Note over Arc,DB: ranges.delete (by name) Arc->>Host: delete(identifierHandle) Host->>RS: NewRetrieve().WhereNames(identifier) RS->>DB: query DB-->>RS: []ranger.Range loop for each matched range Host->>RS: w.Delete(ctx, rng.Key) RS->>DB: delete + cascade children end Host->>Host: reportInfo if deleted > 1Reviews (5): Last reviewed commit: "SY-3961: Update RFC" | Re-trigger Greptile