Skip to content

Show large dataclass integers when relaunching an execution - #947

Open
1fanwang wants to merge 1 commit into
flyteorg:masterfrom
1fanwang:1fanwang/flyteconsole-msgpack-bigint
Open

1fanwang wants to merge 1 commit into
flyteorg:masterfrom
1fanwang:1fanwang/flyteconsole-msgpack-bigint

Conversation

@1fanwang

@1fanwang 1fanwang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR

Relaunching an execution whose dataclass input contains a large integer, above 4294967295 or below -2147483648, shows that field empty, and submitting the form sends the field back empty, so Flyte rejects the new execution. Relaunch now shows and sends the number.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added. Not needed for this fix.
  • Any pending items have an associated Issue

Complete description

Python writes small integers in a compact form and larger ones in a wider form. The console decoded the wider form but dropped it before the form value was built, so the field arrived empty. The form showed nothing for it, and sending the form unchanged sent the empty field back, which Flyte refuses with the error in the linked issue.

The fix carries those integers through as ordinary numbers. The value holds numbers as doubles, so an integer beyond 2^53, about 9 quadrillion, rounds to the nearest number a double can hold. Anything smaller is exact.

Tracking Issue

fixes flyteorg/flyte#8105

Follow-up issue

N/A

Testing Done

End to end on a Flyte v1.16.4 sandbox: run a workflow whose dataclass input holds 10737418240, open that execution in the console served from this repository, press Relaunch and submit the form unchanged. Master's execution page does not load against flyteadmin since #942, and #948 fixes that, so the red run serves master 73d8292 plus that pull request, and the green run adds this change on top.

Sandbox and client tools on macOS arm64:

colima start flyte-e2e --cpu 6 --memory 12 --disk 80 --vm-type vz --mount-type virtiofs
export DOCKER_HOST=unix://$HOME/.colima/flyte-e2e/docker.sock
gh release download flytectl/v0.9.8 --repo flyteorg/flyte -p flytectl_Darwin_arm64.tar.gz
tar xzf flytectl_Darwin_arm64.tar.gz flytectl
./flytectl demo start --version v1.16.4
export FLYTECTL_CONFIG=$HOME/.flyte/config-sandbox.yaml
uv venv -q --python 3.11 .venv && VIRTUAL_ENV=$PWD/.venv uv pip install -q flytekit==1.16.10 playwright==1.57.0
.venv/bin/playwright install chromium

The workflow, run once with the large value. Relaunch starts from this execution:

Reproducer source: wf_8105.py
from dataclasses import dataclass
from flytekit import task, workflow

@dataclass
class Params:
    name: str
    volume_size: int

@task
def show(params: Params) -> str:
    return f"{params.name}: {params.volume_size}"

@workflow
def wf(params: Params) -> str:
    return show(params=params)
.venv/bin/pyflyte run --remote --project flytesnacks --domain development wf_8105.py wf --params '{"name": "vol", "volume_size": 10737418240}'
./flytectl get execution -p flytesnacks -d development axxqf52fctjt47dmbcds
 ---------------------- ------------------ ------------------------ ------------- ----------- ---------------- -------------------------------- --------------- -------------------- -------------------- 
| NAME                 | LAUNCH PLAN NAME | VERSION                | TYPE        | PHASE     | SCHEDULED TIME | STARTED                        | ELAPSED TIME  | ABORT DATA (TRUNC) | ERROR DATA (TRUNC) |
 ---------------------- ------------------ ------------------------ ------------- ----------- ---------------- -------------------------------- --------------- -------------------- -------------------- 
| axxqf52fctjt47dmbcds | wf_8105.wf       | 9OKJ7vvK8A5pX1vevfaf5w | LAUNCH_PLAN | SUCCEEDED |                | 2026-11-15T16:49:32.505725056Z | 16.140172238s |                    |                    |
 ---------------------- ------------------ ------------------------ ------------- ----------- ---------------- -------------------------------- --------------- -------------------- -------------------- 
1 rows

The console dev server, from the repository root with Node v22.17.0, behind a small proxy that serves the console and flyteadmin from one origin as a deployment does:

Reproducer source: proxy.js
// Serves the local console and the sandbox admin from one origin, as a Flyte deployment does.
const http = require('http');
const route = (url) => (url.startsWith('/console') ? { host: '::1', port: 8080 } : { host: '127.0.0.1', port: 30080 });
http
  .createServer((req, res) => {
    const target = route(req.url);
    const upstream = http.request(
      { ...target, method: req.method, path: req.url, headers: { ...req.headers, host: `localhost:${target.port}` } },
      (up) => {
        res.writeHead(up.statusCode, up.headers);
        up.pipe(res);
      },
    );
    upstream.on('error', (e) => {
      res.writeHead(502);
      res.end(String(e));
    });
    req.pipe(upstream);
  })
  .listen(8095, 'localhost', () => console.log('proxy on http://localhost:8095'));
git fetch origin pull/948/head:e2e-red pull/947/head
git checkout e2e-red
node .yarn/releases/yarn-3.2.1.cjs install --immutable
openssl req -x509 -nodes -newkey rsa:2048 -days 2 -subj /CN=localhost -keyout scripts/certificate/server.key -out scripts/certificate/server.crt
BASE_URL=/console LOCAL_DEV_HOST=localhost NODE_OPTIONS=--max-old-space-size=8192 node .yarn/releases/yarn-3.2.1.cjs workspace @clients/console run start --no-open
node proxy.js

The relaunch script drives Chromium through Relaunch, prints the form fields, submits, and saves the request. The check script decodes that request and reads the new execution's phase from flyteadmin:

Reproducer source: relaunch_8105.py
#!/usr/bin/env python3
import json
import sys
from pathlib import Path

from flyteidl.admin import execution_pb2
from playwright.sync_api import sync_playwright

EXECUTION_URL: str = (
    "http://localhost:8095/console/projects/flytesnacks/domains/development"
    "/executions/axxqf52fctjt47dmbcds"
)
label: str = sys.argv[1]
out: Path = Path(__file__).parent / "runs" / label
out.mkdir(parents=True, exist_ok=True)

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1400, "height": 1000})
    page.on("console", lambda m: m.type == "error" and print(f"[browser console.error] {m.text}"))
    page.on("pageerror", lambda e: print(f"[browser pageerror] {e}"))

    page.goto(EXECUTION_URL)
    page.get_by_role("button", name="Relaunch").first.click()
    submit = page.locator("#launch-workflow-submit")
    submit.wait_for()
    page.wait_for_timeout(3000)
    page.screenshot(path=str(out / "form.png"), full_page=True)

    dialog = page.get_by_role("dialog")
    fields: list[dict[str, str]] = dialog.locator("input, textarea").evaluate_all(
        """els => els.filter(e => e.type !== 'hidden').map(e => ({
            id: e.id,
            name: e.name,
            label: (e.labels && e.labels[0] ? e.labels[0].innerText : ''),
            value: e.value,
        }))"""
    )
    print("[form fields]")
    for field in fields:
        print(f"  {json.dumps(field)}")

    with page.expect_response(
        lambda r: r.url.endswith("/api/v1/executions") and r.request.method == "POST",
        timeout=30000,
    ) as response_info:
        submit.click()
    response = response_info.value
    (out / "create_request.bin").write_bytes(response.request.post_data_buffer or b"")
    body: bytes = response.body()
    (out / "create_response.bin").write_bytes(body)
    print(f"[POST {response.url}] HTTP {response.status}")
    created = execution_pb2.ExecutionCreateResponse.FromString(body)
    print(f"[created execution] {created.id.project}/{created.id.domain}/{created.id.name}")

    page.wait_for_timeout(4000)
    print(f"[page url after submit] {page.url}")
    errors: list[str] = page.locator("[role=alert], .MuiAlert-message").all_inner_texts()
    print(f"[visible errors] {errors}")
    page.screenshot(path=str(out / "after_submit.png"), full_page=True)
    browser.close()
Reproducer source: check_exec.py
#!/usr/bin/env python3
import sys
from flyteidl.admin import execution_pb2
from flytekit.clients.friendly import SynchronousFlyteClient
from flytekit.configuration import Config
from flytekit.models.core.execution import WorkflowExecutionPhase
from flytekit.models.core.identifier import WorkflowExecutionIdentifier

label, name = sys.argv[1], sys.argv[2]
request = execution_pb2.ExecutionCreateRequest()
request.ParseFromString(open(f"runs/{label}/create_request.bin", "rb").read())
print("request inputs:")
print(request.spec.inputs)
client = SynchronousFlyteClient(Config.for_sandbox().platform)
execution = client.get_execution(WorkflowExecutionIdentifier("flytesnacks", "development", name))
print("phase:", WorkflowExecutionPhase.enum_to_string(execution.closure.phase))
print("error:", execution.closure.error.message if execution.closure.error else None)

Red, on master plus #948. The params field is empty, the request carries volume_size with no value, and the new execution fails in flyteadmin with the error from the linked issue:

.venv/bin/python relaunch_8105.py red 2>&1 | grep -v '^    at '
[browser console.error] Warning: Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.%s 

Check the render method of `NavigationItems`.  
[browser console.error] Failed to load resource: net::ERR_CONNECTION_REFUSED
[form fields]
  {"id": "launch-workflow-selector", "name": "", "label": "Workflow Version", "value": "9OKJ7vvK8A5pX1vevfaf5w"}
  {"id": "launch-lp-selector", "name": "", "label": "Launch Plan", "value": "wf_8105.wf"}
  {"id": "launch-input-params", "name": "", "label": "params (struct)*", "value": ""}
  {"id": "", "name": "", "label": "", "value": "x"}
  {"id": "launchform-role-IAM", "name": "", "label": "", "value": ""}
  {"id": "launchform-role-k8", "name": "", "label": "", "value": ""}
  {"id": "", "name": "", "label": "", "value": "on"}
  {"id": ":ri:", "name": "", "label": "", "value": ""}
  {"id": ":rj:", "name": "", "label": "", "value": "25"}
  {"id": "", "name": "", "label": "", "value": "on"}
  {"id": "", "name": "", "label": "", "value": "on"}
[POST http://localhost:8095/api/v1/executions] HTTP 200
[created execution] flytesnacks/development/aqjsdt2fgdwgjv5srf5c
[page url after submit] http://localhost:8095/console/projects/flytesnacks/domains/development/executions/aqjsdt2fgdwgjv5srf5c
[visible errors] []
.venv/bin/python check_exec.py red aqjsdt2fgdwgjv5srf5c
curl -s -w '\nHTTP %{http_code}\n' localhost:30080/api/v1/executions/flytesnacks/development/aqjsdt2fgdwgjv5srf5c
request inputs:
literals {
  key: "params"
  value {
    scalar {
      generic {
        fields {
          key: "volume_size"
          value {
          }
        }
        fields {
          key: "name"
          value {
            string_value: "vol"
          }
        }
      }
    }
  }
}

phase: FAILED
error: failed to create workflow in propeller json: error calling MarshalJSON for type *v1alpha1.Inputs: nil Value
{"code":2,"message":"proto: google.protobuf.Value: none of the oneof fields is set","details":[]}
HTTP 500

Green, with this change cherry-picked on the same base, after the dev server recompiles. The form shows the number, the request carries it, and the relaunched execution succeeds with the original value in its output:

git checkout -b e2e-green && git cherry-pick 4544bf1ec4235b58a0cfa8749a0c9d5b38ac5144
.venv/bin/python relaunch_8105.py green 2>&1 | grep -v '^    at '
[browser console.error] Warning: Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.%s 

Check the render method of `NavigationItems`.  
[browser console.error] Failed to load resource: net::ERR_CONNECTION_REFUSED
[form fields]
  {"id": "launch-workflow-selector", "name": "", "label": "Workflow Version", "value": "9OKJ7vvK8A5pX1vevfaf5w"}
  {"id": "launch-lp-selector", "name": "", "label": "Launch Plan", "value": "wf_8105.wf"}
  {"id": "launch-input-params", "name": "", "label": "params (struct)*", "value": "{\n  \"name\": \"vol\",\n  \"volume_size\": 10737418240\n}"}
  {"id": "", "name": "", "label": "", "value": "x"}
  {"id": "launchform-role-IAM", "name": "", "label": "", "value": ""}
  {"id": "launchform-role-k8", "name": "", "label": "", "value": ""}
  {"id": "", "name": "", "label": "", "value": "on"}
  {"id": ":ri:", "name": "", "label": "", "value": ""}
  {"id": ":rj:", "name": "", "label": "", "value": "25"}
  {"id": "", "name": "", "label": "", "value": "on"}
  {"id": "", "name": "", "label": "", "value": "on"}
[POST http://localhost:8095/api/v1/executions] HTTP 200
[created execution] flytesnacks/development/a9lrt7trmrlb8xbgfwkj
[page url after submit] http://localhost:8095/console/projects/flytesnacks/domains/development/executions/a9lrt7trmrlb8xbgfwkj
[visible errors] []
.venv/bin/python check_exec.py green a9lrt7trmrlb8xbgfwkj
curl -s localhost:30080/api/v1/data/executions/flytesnacks/development/a9lrt7trmrlb8xbgfwkj
request inputs:
literals {
  key: "params"
  value {
    scalar {
      generic {
        fields {
          key: "volume_size"
          value {
            number_value: 10737418240
          }
        }
        fields {
          key: "name"
          value {
            string_value: "vol"
          }
        }
      }
    }
  }
}

phase: SUCCEEDED
error: None
{"outputs":{"url":"","bytes":"0"},"inputs":{"url":"","bytes":"0"},"fullInputs":{"literals":{"params":{"scalar":{"generic":{"name":"vol","volume_size":10737418240}},"hash":"","metadata":{}}}},"fullOutputs":{"literals":{"o0":{"scalar":{"primitive":{"stringValue":"vol: 10737418240"}},"hash":"","metadata":{}}}}}

The two browser console errors, the React key warning in NavigationItems and the refused connection, appear on both runs.

The probes below cover the integer boundaries. They run the real msgpack decoder and the real Relaunch form helpers on the bytes that released flytekit writes for a dataclass. The change also adds a regression test for CI.

First, the bytes flytekit writes for a dataclass with a string and an integer field:

Reproducer source: flytekit_bytes.py
from dataclasses import dataclass

import flytekit
from flytekit import FlyteContextManager
from flytekit.core.type_engine import TypeEngine


@dataclass
class Params:
    name: str
    volume_size: int


ctx = FlyteContextManager.current_context()
literal_type = TypeEngine.to_literal_type(Params)
print("flytekit", flytekit.__version__)
for size in (5, 4294967295, 4294967296, 10737418240, -2147483649):
    literal = TypeEngine.to_literal(ctx, Params(name="x", volume_size=size), Params, literal_type)
    binary = literal.scalar.binary
    print(size, binary.tag, binary.value.hex())
uv run --with flytekit python flytekit_bytes.py
flytekit 1.16.32
5 msgpack 82a46e616d65a178ab766f6c756d655f73697a6505
4294967295 msgpack 82a46e616d65a178ab766f6c756d655f73697a65ceffffffff
4294967296 msgpack 82a46e616d65a178ab766f6c756d655f73697a65cf0000000100000000
10737418240 msgpack 82a46e616d65a178ab766f6c756d655f73697a65cf0000000280000000
-2147483649 msgpack 82a46e616d65a178ab766f6c756d655f73697a65d3ffffffff7fffffff

Next, what msgpackr 1.11.2, the version in yarn.lock, returns for those bytes, run from the repository root. It returns a BigInt for the 64-bit forms, and the console's convertToValue in decodeMsgPackLiterals.ts had no case for a BigInt, which left the protobuf Value for that field with no kind.

Reproducer source: probe.mjs
import { unpack } from 'msgpackr';

const cases = {
  '5': '82a46e616d65a178ab766f6c756d655f73697a6505',
  '2147483648': '82a46e616d65a178ab766f6c756d655f73697a65ce80000000',
  '4294967295': '82a46e616d65a178ab766f6c756d655f73697a65ceffffffff',
  '4294967296': '82a46e616d65a178ab766f6c756d655f73697a65cf0000000100000000',
  '10737418240': '82a46e616d65a178ab766f6c756d655f73697a65cf0000000280000000',
  '9007199254740992': '82a46e616d65a178ab766f6c756d655f73697a65cf0020000000000000',
  '-2147483649': '82a46e616d65a178ab766f6c756d655f73697a65d3ffffffff7fffffff',
};

for (const [label, hex] of Object.entries(cases)) {
  const decoded = unpack(Buffer.from(hex, 'hex'));
  console.log(label.padEnd(18), typeof decoded.volume_size, String(decoded.volume_size));
}
node probe.mjs
5                  number 5
2147483648         number 2147483648
4294967295         number 4294967295
4294967296         bigint 4294967296
10737418240        bigint 10737418240
9007199254740992   bigint 9007199254740992
-2147483649        bigint -2147483649

Then the console itself. The probe decodes each literal with the console's decoder, reads it the way the Relaunch form does, and builds what the form submits when left unchanged. It is saved outside the repository and run from the repository root, first on the decoder from master and then on this change.

Reproducer source: relaunch_probe.ts
const Module = require('module');
const path = require('path');

// Resolve @clients/<package>/... to packages/<package>/src/..., as the console's build does.
const root = process.cwd();
// The console's log module reads window.console.
Object.assign(globalThis, { window: globalThis });
const resolveFilename = Module._resolveFilename;
Module._resolveFilename = function (request: string, ...rest: unknown[]) {
  const match = /^@clients\/([^/]+)(.*)$/.exec(request);
  const mapped = match ? path.join(root, 'packages', match[1], 'src', match[2]) : request;
  return resolveFilename.call(this, mapped, ...rest);
};

const core = require('@clients/common/flyteidl/core').default;
const launchForm = path.join(root, 'packages/oss-console/src/components/Launch/LaunchForm');
require(path.join(root, 'packages/oss-console/src/common/decodeMsgPackLiterals'));
const { inputToLiteral, literalToInputValue } = require(`${launchForm}/inputHelpers/inputHelpers`);
const { InputType } = require(`${launchForm}/types`);

const NAME_PREFIX = '82a46e616d65a178ab766f6c756d655f73697a65';
const cases: [number, string][] = [
  [5, `${NAME_PREFIX}05`],
  [4294967295, `${NAME_PREFIX}ceffffffff`],
  [4294967296, `${NAME_PREFIX}cf0000000100000000`],
  [10737418240, `${NAME_PREFIX}cf0000000280000000`],
  [-2147483649, `${NAME_PREFIX}d3ffffffff7fffffff`],
];
const typeDefinition = { type: InputType.Struct, literalType: { simple: core.SimpleType.STRUCT } };

for (const [size, hex] of cases) {
  const binary = { value: Buffer.from(hex, 'hex'), tag: 'msgpack' };
  const initialValue = core.Literal.decode(core.Literal.encode({ scalar: { binary } }).finish());
  const value = literalToInputValue(typeDefinition, initialValue);
  const submitted = inputToLiteral({ initialValue, typeDefinition, value });
  const shown = value === undefined ? '(empty)' : JSON.stringify(JSON.parse(value));
  const sent = JSON.stringify(submitted.scalar.generic.fields.volume_size);
  console.log(`${String(size).padEnd(12)} form input ${shown.padEnd(38)} submitted volume_size ${sent}`);
}

On the decoder from master:

git checkout upstream/master -- packages/oss-console/src/common/decodeMsgPackLiterals.ts
TS_NODE_SKIP_PROJECT=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_COMPILER_OPTIONS='{"module":"commonjs","esModuleInterop":true,"jsx":"react","target":"es2019","resolveJsonModule":true}' node -r ts-node/register relaunch_probe.ts
5            form input {"name":"x","volume_size":5}           submitted volume_size {"numberValue":5}
4294967295   form input {"name":"x","volume_size":4294967295}  submitted volume_size {"numberValue":4294967295}
4294967296   form input (empty)                                submitted volume_size {}
10737418240  form input (empty)                                submitted volume_size {}
-2147483649  form input (empty)                                submitted volume_size {}

With this change:

git checkout HEAD -- packages/oss-console/src/common/decodeMsgPackLiterals.ts
TS_NODE_SKIP_PROJECT=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_COMPILER_OPTIONS='{"module":"commonjs","esModuleInterop":true,"jsx":"react","target":"es2019","resolveJsonModule":true}' node -r ts-node/register relaunch_probe.ts
5            form input {"name":"x","volume_size":5}           submitted volume_size {"numberValue":5}
4294967295   form input {"name":"x","volume_size":4294967295}  submitted volume_size {"numberValue":4294967295}
4294967296   form input {"name":"x","volume_size":4294967296}  submitted volume_size {"numberValue":4294967296}
10737418240  form input {"name":"x","volume_size":10737418240} submitted volume_size {"numberValue":10737418240}
-2147483649  form input {"name":"x","volume_size":-2147483649} submitted volume_size {"numberValue":-2147483649}

msgpackr decodes msgpack 64-bit integers as BigInt, and convertToValue had
no branch for it, so the protobuf Value for that field had no kind. The
Relaunch form then read the dataclass input as blank and resubmitted the
empty value, which the backend rejects.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
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.

[BUG] Console Relaunch blanks dataclass int fields larger than int32, propeller rejects with MarshalJSON ... nil Value

1 participant