Skip to content

Implement the complete gradient authoring stack - #72

Open
SunkenInTime wants to merge 39 commits into
masterfrom
agent/gradient-exploration
Open

Implement the complete gradient authoring stack#72
SunkenInTime wants to merge 39 commits into
masterfrom
agent/gradient-exploration

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Outcome

Weaver can author linear, radial, conic, repeating, layered, and bicubic mesh backgrounds through typed TSX. Windows gradient widgets now select the D3D11 shared renderer instead of silently remaining on the software backend.

Depends on Native #31, pinned at 3fe1722a5f627c0e7c42ca9275c35801d74cb7df.

Authoring contract

  • typed background paints on column, row, stack, panel, and button
  • linear class shortcuts, including repeating syntax and authored stops
  • pad, repeat, and reflect spread
  • sRGB, linear-sRGB, and Oklab interpolation
  • bottom-to-top layers and bounded bicubic mesh patches
  • early SDK and bridge validation, finite resource ceilings, and loud errors on unsupported leaf elements

Runtime and platform path

Canonical gradient bytes stay sparse on retained nodes. Runtime resolves normalized geometry after layout and emits ordinary Native paints. A gradient-only widget now emits renderBackend: "gpu", which starts the Windows shared renderer and reaches the D3D11 shader path. macOS keeps its correctness-first reference fallback for combinations its native fast path cannot match yet.

The retained Native boundary rejects non-finite linear, radial, conic, and mesh data before diffing or mutating view-owned buffers. Focused tests cover NaN and Infinity in geometry, offsets, colors, radii, angles, mesh points, and mesh colors; negative radial radii; aggregate stop and patch overflow across commands; and preservation of the prior retained frame and revision after every rejection.

Verification

  • Weaver tests: 111 passed
  • npm run build
  • npm run typecheck
  • npm run audit:release
  • runtime: zig build test -Dweb-layer=exclude -Dtrace=off
  • Native: zig build test, zig build test-canvas, zig build test-desktop-canvas-frame, zig build test-tooling
  • macOS dashboard smoke: NATIVE_SDK_SMOKE_BUDGET_MS=1500 zig build test-gpu-dashboard-smoke
  • Windows D3D presenter: cross-compiled and linked from both Native and Weaver renderer builds
  • reference catalog: 15 scenes
  • example capture: 760 by 460, 21 nodes, 30 commands, 349294 non-clear pixels, two startup frames, no pending timers, providers, fetches, images, or frame requests
  • mesh engine benchmark: 182, 206, and 277 microseconds in the recorded local passes, 206 microsecond median against the 500 microsecond gate

Windows hardware handoff

docs/windows-gradient-gpu-handoff.md reduces the physical test to one PowerShell command. scripts/verify-gradient-gpu.ps1 checks exact commits, builds the Windows programs, takes nine hardware D3D timestamp samples, requires the live widget to report backend=gpu, captures reference and real GPU images, records a settled process sample, and returns one ZIP with machine-readable results and logs. CI parses the script on every Windows run.

The physical Windows result is not claimed here yet. The PR keeps that lane explicit until the ZIP comes back.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown

Greptile Summary

This change adds typed and utility-class gradient backgrounds, retains them in the runtime, projects them into Native paint commands, and adds GPU backend selection for gradient-bearing widgets.

A conditional JSX class that can produce a gradient is supported by the reconciler but rejected by the CLI before bundling. Affected widgets do not produce a manifest and cannot request the Windows GPU renderer.

Malformed and oversized gradient updates were verified not to replace an existing retained gradient. Explicit and class-derived gradients on unsupported leaf elements were verified to fail before a gradient property is emitted.

T-Rex validation blocked

The checked-out runtime/native-sdk package revision is incompatible with the runtime sources and lacks the gradient APIs required to compile Native projection tests. This prevented direct execution of the failed-gradient projection path and a gradient-specific transaction rollback ownership assertion. Configure VMs

Confidence Score: 3/5

Do not merge until conditional JSX gradient classes can bundle and receive the appropriate renderer declaration.

The conditional JSX failure was reproduced with a literal-gradient control, the exact rejected expression, and a reconciler runtime probe. Retained-gradient validation and unsupported-leaf rejection were also exercised. Direct coverage for failed Native projection and gradient-specific snapshot rollback ownership remains unavailable because the checked-out Native SDK package does not match the runtime source requirements.

Files Needing Attention: cli/src/index.ts needs expression-aware JSX class handling. runtime/src/main.zig and runtime/src/tree.zig need focused reruns after aligning runtime/native-sdk to the revision pinned by the PR.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced proofs for posted P1 findings.
  • A valid retained gradient was installed first, malformed and oversized replacement payloads were rejected, and the focused test confirmed retained bytes and generation remained unchanged.
  • Explicit and class-derived gradients on unsupported leaf elements were rejected before a gradient property was emitted; a supported panel class serialized a gradient successfully; the focused reconciler suite passed.
  • Before / native checkout, the exact runtime suite ran successfully in an isolated checkout with the Native SDK revision pinned by the PR; no assertion verified rollback ownership for a gradient mutated during a transaction.
  • The filtered Native projection test could not compile because required APIs were missing in the checked-out Native SDK package, and the failed-gradient projection path was not directly executed.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Conditional JSX gradient classes are rejected despite runtime support

    • Bug
      • A supported <panel class={enabled ? "bg-linear-to-r from-black to-white" : "bg-black"} /> cannot bundle: weaver check requires the class attribute to be literal, so no widget.json is emitted. This prevents the runtime-capable gradient surface from being declared GPU.
    • Cause
      • The JSX GPU detector at cli/src/index.ts:987-1006 reduces class through literal-only jsxStringValue (defined at 2874-2878), and the source validator independently hard-rejects nonliteral classes at 2578-2581. The newer classExpressionNeedsGpu analysis at 906-928 is only wired into h() props.
    • Fix
      • Apply expression-aware class analysis to JSX class attributes and adjust validation to permit analyzable expressions (or conservatively select GPU for unknown dynamic values) while retaining utility validation where statically determinable.

    T-Rex Ran code and verified through T-Rex

Reviews (30): Last reviewed commit: "Refresh the Windows GPU verification han..." | Re-trigger Greptile

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review current head 8e5e05e. The P1 is fixed in pinned Native 864c682f2a3b09860a8ba2418ce8eab9da2540e0: the runtime validates the complete display list before diffing or retained mutation, rejects non-finite linear/radial/conic/mesh fields and negative radial radii, and tests preserve the prior retained frame/revision after every rejection. Aggregate stop and mesh-patch overflow is tested across multiple commands. Local evidence: Native full suite green (1,757 passed, 2 skipped), focused canvas/frame/tooling suites green, and Weaver 111/111 green.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review current head fcacfad. The dependent Native pin is now 4ce84db318868cdce48999c86b5eba752f2807eb. This head preserves the retained-boundary non-finite validation fix and adds a verified repair of the complete Native example gate; the exact sequential Native full suite, tooling suite, aggregate native examples, and both macOS smoke lanes pass locally. Please report only actionable defects on this current head.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review current head b96b271, pinned to Native f379f5568d9ce36230291cfd9eb9e5006e05f564. The widget-chrome P1 is fixed in the pinned Native commit. Alert, card, bubble, pill TabsList, and underline TabsList now route through the shared gradient-aware background emitter. A table-driven display-list regression covers linear and mesh gradients for every named path, including gradient-only ghost bubble and underline tabs. Exact local Native canvas/full/tooling suites and both macOS smokes pass.

Comment thread runtime/src/gradients.zig
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review current head 04f2b19, pinned to Native ec254bfc3ce2ba419fd8c81fb70e401d6d73e640. Both prior P1s are fixed. Surface chrome preserves linear and mesh gradients across every named path. Radial radius components are now required to be strictly positive and are rejected in SDK serialization, Zig decode before tree mutation, and Native before retained display-list mutation; zero and negative regressions cover the boundaries, and the intentional zero-radius CSS deviation is documented. Exact local evidence: Weaver 111/111, build, typecheck, release audit; runtime suite; Native full/canvas/frame/tooling suites and both macOS smokes all pass.

Comment thread sdk/src/gradients.js Outdated
Comment thread runtime/src/gradients.zig
Comment thread runtime/src/gradients.zig
@SunkenInTime

SunkenInTime commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review current head 5e989f5, pinned to Native cd29727cca5d006a0cf534c0e90e97e07a132141. The pinned Native head fixes the reviewed Windows D3D hybrid structural-clip P1, fails untessellated fill paths closed to the correct pixel fallback, and restores the demand-driven Windows automation frame boundary. The outer release audit passes at the exact pin. Please report only actionable defects on this exact head.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review exact current head 0ef0a66, pinned to Native c2cd48efc6469580201886b59f3092f02336ce7b. The pin contains the Windows hybrid structural-clip GPU fix, exact fail-closed behavior for both untessellated path kinds, and the demand-driven Windows automation frame repair. The outer release audit passes at this exact pin. Please report only actionable defects on these exact heads.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review exact current head cf513e6, pinned to Native f8570de60513679ccf4de4bb7bb9b5d7bf28191f. The exact pin includes the Windows hybrid structural-clip GPU fix with reference-matching edges, fail-closed path and rounded-clip behavior, and the demand-driven Windows automation frame repair. The release audit passes at this exact pin. Please report only actionable defects on these exact heads.

Comment thread cli/src/index.ts
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please review current head a6e50d1. The nested-gradient P1 is fixed by walking the complete local import graph, with a widget.tsx -> Outer.tsx -> Gradient.tsx regression. All review threads and CI are green. Final Windows RTX 4070 v2 receipt (57/57): https://codex-file-host.shawnadedeji.workers.dev/files/2026-08-30/a7714663529a-windows-gradient-gpu-20260830-190715.zip

Comment thread cli/src/index.ts Outdated
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please review current head c41df2984c4ec1b063e1228db385108464512863. The barrel re-export P1 is fixed with a components/index.ts -> Gradient.tsx regression; all review threads are resolved and the focused/full Weaver suites are green.

Comment thread cli/src/index.ts
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please review current head fdbf19d670a31a1476fab172049e57c7a1a3294d. The public SDK h() GPU-backend P1 is fixed for direct, aliased, and namespace calls with typed-background, gradient-class, and canvas fixtures; all review threads and Weaver tests are green.

Comment thread cli/src/index.ts Outdated
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please review exact current head f7bc96b, pinned to Native 7662eed8e64bacce47aa85b32aabcde72206a547. The bound h() props P1 is fixed with lexical alias/wrapper/spread resolution and GPU/software regressions. All 112 Weaver tests, typecheck, build, release audit, and the prior exact-pin Windows v2 hardware run pass. Please report only actionable defects on this head.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

Final exact-pin Windows RTX 4070 v2 hardware receipt: https://codex-file-host.shawnadedeji.workers.dev/files/2026-08-30/2bc3d5ad8595-windows-gradient-gpu-20260830-201714.zip

  • Weaver: f7bc96b
  • Native: 7662eed8e64bacce47aa85b32aabcde72206a547
  • schema/status: weaver.windows-gradient-gpu.v2 / passed (57/57)
  • composed capture: dcomp-proxy-windows-graphics-capture, 760x460, adapter 0x10de:0x2709
  • parity: 99.959% close samples, MAE 0.09
  • idle 10.002s: widget 0.0% one-core CPU, renderer 0.0%
  • benchmark command logs contain zero failed-command markers
  • both reference and GPU PNGs were opened at original resolution; all six panels, labels, and text shadows match
  • ZIP SHA-256: 58E0E7286ABCB9DEC4BE1F1FEB39034E6940BCE48417C7A1ED2C141A4F78D240

Comment thread runtime/src/gradients.zig
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Re-review exact current head f7bc96b. The prior P1 is a proven stale-submodule artifact: T-Rex ran df245eb while this head records and release-audits Native 7662eed8e64bacce47aa85b32aabcde72206a547. The recursive-submodule Linux portable runtime contracts job passed both null-platform suites on this head, the exact commands also pass locally, and the exact-pin Windows v2 receipt passes 57/57. Follow .greptile/config.json and do not score the cached Native checkout as Weaver state.

Comment thread cli/src/index.ts Outdated
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please review exact current head 46c85b1, pinned to Native 7662eed8e64bacce47aa85b32aabcde72206a547. The conditional h() gradient-class P1 is fixed with branch-aware static analysis and conservative GPU selection for unresolved runtime props/classes; a two-solid-branch guard remains software. Focused/full Weaver tests, typecheck, build, audit, and exact-pin null runtime contracts pass. Initialize the recorded submodule or follow .greptile/config.json for Native execution.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

Superseding the earlier receipt with the final current-head Windows RTX 4070 v2 hardware receipt: https://codex-file-host.shawnadedeji.workers.dev/files/2026-08-30/5e70f25312bb-windows-gradient-gpu-20260830-204321.zip

  • Weaver: 46c85b1
  • Native: 7662eed8e64bacce47aa85b32aabcde72206a547
  • schema/status: weaver.windows-gradient-gpu.v2 / passed (57/57)
  • composed capture: dcomp-proxy-windows-graphics-capture, 760x460, adapter 0x10de:0x2709
  • parity: 99.959% close samples, MAE 0.09
  • idle 10.008s: widget 0.0% one-core CPU, renderer 0.0%
  • benchmark: median 39.232 us/draw, p90 39.280 us/draw; zero failed-command markers
  • both reference and GPU PNGs were opened at original resolution; all six panels, labels, and text shadows match
  • ZIP SHA-256: 58693B11FF3C4D7FFF5FFF0CA331A8DD18D423C2703D86938D4E9BDC2DA70EB5

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Re-review exact current head 46c85b1. The prior composed-capture P1 is another proven stale-submodule artifact, not current-head code:

  • git ls-tree HEAD runtime/native-sdk and the populated local checkout both equal 7662eed8e64bacce47aa85b32aabcde72206a547, not df245eb.
  • At that exact pin, shared_renderer_client.cpp has RemovePropW at line 130 and SetPropW at line 412.
  • The exact focused Windows-gradient receipt contract test passes.
  • All 112 Node tests passed during the final verifier.
  • Final exact-head Windows RTX 4070 receipt: https://codex-file-host.shawnadedeji.workers.dev/files/2026-08-30/5e70f25312bb-windows-gradient-gpu-20260830-204321.zip
  • That receipt is schema v2, passed 57/57, and records method=dcomp-proxy-windows-graphics-capture, source_child=0x300368, client/item/frame=760x460, parity 99.959%, and zero failed-command markers.

The reported ERROR_NOT_FOUND path did not occur on the recorded revision; real composed WGC capture succeeded. Follow .greptile/config.json: do not inspect or score the cached df245 Native worktree as Weaver state. The recursive-submodule CI and exact-pin receipt are authoritative. No repository change is appropriate.

Comment thread runtime/src/network.zig
@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Re-review exact current head 46c85b1 and clear the Linux-network thread. The finding's own conditional premise is false: AGENTS.md, README.md, runtime/build.zig:39-42, .github/workflows/ci.yml:25-34, and docs/gradient-exploration.md:211-216 all define Linux as an explicit null-backend verification executor, not a shipped/request-capable host, and require network to fail closed. Weaver ships only Windows and macOS. Adding Linux transport is a new product/platform feature, not a defect in this PR.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

Greptile disposition: conditional JSX class expressions are intentionally outside the current authoring contract. The existing check at cli/src/index.ts emits the actionable diagnostic "class must be a literal string so weaver check can validate every utility" before bundling. That keeps utility validation exhaustive for JSX.

The low-level h() runtime path and JSX authoring validation are distinct surfaces; broadening JSX to conditional/dynamic classes would be a new language/product decision, not a repair implied by this Windows gradient implementation. Per the repository instructions, that expansion requires explicit approval and is not being inferred here. The current reviewed implementation preserves the literal-only JSX rule while fixing GPU selection for supported h() expressions.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai Please re-review exact current head 46c85b1. The reported conditional JSX case is intentionally outside Weaver’s authoring contract: cli/src/index.ts requires JSX class attributes to be literal so weaver check can validate every utility and fail unsupported classes before bundling. The low-level h() path is the explicit dynamic escape hatch and now conservatively selects GPU for unresolved props/classes. Broadening JSX classes is a separate language decision, not a correctness repair for this gradient PR. Please score the current documented contract and report only defects reachable through accepted source.

@SunkenInTime

Copy link
Copy Markdown
Collaborator Author

@greptileai please review the current head 13c239f. Local verification on the exact Native pin fe43cea9 is green: 112/112 Node tests, TypeScript, build, release audit, and the runtime Zig suite. The prior RTX 4070 v2 receipt passed 57/57 with real Windows Graphics Capture; an exact-current-pin rerun is now being requested for the lazy-TLS and rare corner-metadata follow-up.

Comment thread cli/src/index.ts
Comment on lines +997 to +1002
const classAttribute = node.attributes.properties.find((attribute): attribute is ts.JsxAttribute =>
ts.isJsxAttribute(attribute) && attribute.name.getText(sourceFile) === "class");
const classText = classAttribute ? jsxStringValue(classAttribute.initializer) : "";
if (classText !== null) {
try {
found = compileClass(classText).backgroundGradient !== undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Conditional JSX gradient classes are rejected

A supported <panel class={enabled ? "bg-linear-to-r from-black to-white" : "bg-black"} /> cannot bundle because JSX class values are reduced through the literal-only jsxStringValue; the source validator then rejects the expression before it emits a manifest. The reconciler accepts the same expression and sends its serialized gradient to Native. Apply the expression-aware class analysis already used for h() props to JSX classes, using a conservative GPU fallback when the expression cannot be statically resolved.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

T-Rex Ran code and verified through T-Rex

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