Skip to content

Sy 4427 refactor arc pluto console code for cleanliness and#2539

Merged
emilbon99 merged 301 commits into
rcfrom
sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and
Jun 28, 2026
Merged

Sy 4427 refactor arc pluto console code for cleanliness and#2539
emilbon99 merged 301 commits into
rcfrom
sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and

Conversation

@emilbon99

@emilbon99 emilbon99 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Go to the Preview tab and select the appropriate template for your pull request:

Greptile Summary

This PR moves Arc console code into the layered service and session structure. The main changes are:

  • New layered Arc editor, toolbar, import/export, palette, and layout exports.
  • New persisted Arc session slice for viewport, selection, editability, and toolbar state.
  • Scoped Pluto Arc hooks and editors that resolve the active Arc key from context.
  • Store, command, layout, ingester, and service registrations updated to the new Arc modules.

Confidence Score: 4/5

The Arc session cleanup path needs a small fix before merging.

  • Closed Arc layouts can leave persisted session entries behind.
  • Reopening the same Arc key can restore stale viewport, selection, and toolbar state.
  • No security issue was identified in the changed code.

console/src/store.ts and the Arc session middleware export.

Important Files Changed

Filename Overview
console/src/store.ts Registers the new Arc session reducer but drops the old Arc cleanup middleware from the root middleware list.
console/src/layered/session/arc/slice.ts Adds Arc UI session state for graph viewport, selected objects, editability, and toolbar tab.
console/src/layered/service/arc/imex/import.ts Moves legacy and current Arc import parsing into the layered Arc service.
pluto/src/arc/queries.ts Wraps Arc selectors and dispatch helpers around the new scoped Arc key.

Comments Outside Diff (1)

  1. console/src/store.ts, line 160-164 (link)

    P2 Arc Session State Persists Orphans

    Closing an Arc layout or switching projects no longer dispatches the Arc session remove cleanup that the old middleware handled. Because the new Arc session slice is persisted with an empty exclude list, stale state.arc.arcs entries can survive tab close/project switch and later restore old viewport, selection, and toolbar state for the same Arc key.

Reviews (1): Last reviewed commit: "checkpoint" | Re-trigger Greptile

Context used:

  • Context used - CLAUDE.md (source)

emilbon99 added 30 commits June 18, 2026 12:07
Fix graph.Node{Type,Config} literals in runtime/node and stl/* test
suites (channels, constant, control, math, op, selector, stable, time,
wasm). Full arc/go ginkgo suite (53 suites) passes.
The Ternaryf key was already the wire name; align the message text so both read
the schema's snake_case name (invalid label_level, not invalid LabelLevel).
The nullable change alters the positional orc layout (adds a presence byte), so
released value-color ranges can't be read by the new codec. Pin msgpack_to_orc to
the v0 (value-color) snapshot so it's deterministic, then add a range_color_nullable
migration that re-encodes value->pointer (zero color -> nil). Adds an optional deps
arg to gorp.NewEntryMigration to order it after the codec migration.
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3

Cascade-backmerge rc: adopt schema folder reorg (synnax/ + x/) and nested
import paths; keep part3 schema semantics (single optionality, defaults,
author purge). Resolve arc/ir, arc/types, project conflicts in favor of
part3's migration.
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
The generated Go ApplyDefaults and Validate methods were flat: they filled
and checked a struct's own scalar fields but never descended into nested
struct, slice, map, or union-variant fields, and were absent entirely on
container types whose own fields all default to the zero value. This diverged
from the cross-language model, where zod, pydantic, and C++ member init all
apply nested defaults during decode.

Make both methods recurse:

- Add a transitive needs-method predicate (typeNeedsMethod) over struct
  fields, slice/array elements, map values, and union variant payloads, with a
  visited guard for recursive types. Generic types and type parameters are
  excluded. A type now emits a method when it has an own fill/check or any
  reachable nested type does.
- Emit per-field recursion: value and nil-guarded pointer struct fields, slice
  and array elements, and map values.
- Emit per-variant ApplyDefaults/Validate for discriminated unions plus a
  wrapper method that dispatches on the active variant. Embedded payloads take
  no Validate path segment, since their fields are promoted to the variant.

Validate composes nested error paths via validate.PathedError with wire field
names and slice indices. PathedError previously collapsed a joined error to
its first member, dropping the rest; it now prefixes every member, backed by a
new errors.UnwrapMulti primitive in x/errors that looks through the stack
wrapper Join adds.
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
Propagate the base struct's generic type parameters onto the synthesized
New so a generic @create type derives a generic New, and fold defaulted
base fields into the concrete factory's partial set so defaults drive
optionality on the input type (the concrete path uses an optional.Optional
wrapper rather than z.input, which already handles this for the
non-concrete path).
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…types

The Go plugin emitted no @Validate constraints, so required/min/max checks were
hand-written per service (e.g. Device.Validate). The TypeScript plugin emitted
constraints but classified numeric/string by the surface type name, so it
skipped constraints on named types like a distinct Key over uint32.

- Add resolution.PrimitiveBase, which follows distinct-type and alias chains to
  the underlying primitive name.
- Generate Go constraint checks in Validate: required and min_length/max_length
  on strings, min/max on numbers, classified against the primitive base so a
  distinct numeric type validates as a number. A field carrying constraints now
  also makes its containing type emit Validate and parents recurse into it.
- TypeScript classifies named types by their primitive base too, so @Validate on
  a wrapped numeric/string emits the zod constraint instead of being dropped.
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…field names

- required on a numeric field now generates a non-zero check (Go validate.NonZero,
  TypeScript .refine((v) => v !== 0, ...)), so a required Key validates as set.
- Validation messages embed the raw snake_case field name instead of a
  capitalized human form ("first_name is required", not "First Name is required").
…nto sy-4379-oracle-default-and-validation-refactor-rfc-3
…aults

A field default written as a struct literal (e.g. `x1 Axis = { key = AxisKeyX1 }`)
was dropped by the Go plugin: ApplyDefaults only filled scalar zero-values and
recursed, never applying a whole-struct default assigned to a field. The nested
component (axis key) stayed empty and the generated Validate then rejected it.

goDefaultFills now walks a struct-literal default and emits one fill per non-zero
leaf component, keyed by a nested selector (X1.Key), before the recursion call so
the component is set first and recursion fills the remaining zero fields.
emilbon99 added 26 commits June 25, 2026 15:12
…pendencies' into sy-4416-separate-nav-slice-and-componentry-from-layout-in-console
…6-separate-nav-slice-and-componentry-from-layout-in-console
…in-console' of https://github.com/synnaxlabs/synnax into sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and
…6-separate-nav-slice-and-componentry-from-layout-in-console
Add direct specs for Cursor.useDrag and Cursor.useVirtualDrag, which
previously had no dedicated coverage. The specs install a faithful
pointer-capture implementation so the capture/release lifecycle is
asserted rather than mocked away.

Harden useVirtualDrag to match useDrag: guard against non-primary
buttons/pointers on press, filter moves and the terminating up by the
captured pointerId, and drop the once-only pointerup listener that a
stray second pointer could prematurely consume.
The controls toggle only renders on macOS/Windows, so on a Linux CI
runner the findByText("Controls") assertions timed out. Mock OS.use to
a fixed value so the controls tests are deterministic across hosts.
…omponentry-from-layout-in-console' into sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and
…in-console' of https://github.com/synnaxlabs/synnax into sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and
@emilbon99 emilbon99 merged commit 72898e1 into rc Jun 28, 2026
8 checks passed
@emilbon99 emilbon99 deleted the sy-4427-refactor-arc-pluto-console-code-for-cleanliness-and branch June 28, 2026 01:52
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.11950% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.13%. Comparing base (332e4af) to head (12d18c5).
⚠️ Report is 1 commits behind head on rc.

Files with missing lines Patch % Lines
console/src/layered/service/arc/editor/Graph.tsx 3.70% 26 Missing ⚠️
console/src/layered/service/arc/imex/import.ts 72.22% 17 Missing and 3 partials ⚠️
...yered/service/arc/editor/toolbar/graph/Toolbar.tsx 10.00% 17 Missing and 1 partial ⚠️
...ed/service/arc/editor/toolbar/graph/Properties.tsx 15.00% 15 Missing and 2 partials ⚠️
pluto/src/arc/graph/Editor.tsx 0.00% 9 Missing ⚠️
...onsole/src/layered/service/arc/editor/Controls.tsx 16.66% 5 Missing ⚠️
console/src/layered/service/arc/editor/Editor.tsx 42.85% 3 Missing and 1 partial ⚠️
...src/layered/service/arc/editor/toolbar/Toolbar.tsx 33.33% 3 Missing and 1 partial ⚠️
pluto/src/arc/text/Editor.tsx 20.00% 3 Missing and 1 partial ⚠️
...ayered/service/arc/editor/toolbar/text/Toolbar.tsx 25.00% 3 Missing ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##               rc    #2539      +/-   ##
==========================================
- Coverage   69.19%   69.13%   -0.06%     
==========================================
  Files        2627     2620       -7     
  Lines      129503   128716     -787     
  Branches     9264     9192      -72     
==========================================
- Hits        89606    88992     -614     
+ Misses      33207    33061     -146     
+ Partials     6690     6663      -27     
Flag Coverage Δ
console 35.59% <58.05%> (+0.39%) ⬆️
pluto 62.45% <64.70%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant