Skip to content

Fix deserialization of YAML-tagged values in job log extra fields#32

Merged
sjoerdsimons merged 1 commit into
mainfrom
copilot/fix-extra-data-parsing
Jun 23, 2026
Merged

Fix deserialization of YAML-tagged values in job log extra fields#32
sjoerdsimons merged 1 commit into
mainfrom
copilot/fix-extra-data-parsing

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

LAVA occasionally emits bare YAML tags (e.g. ! "188250") inside the extra map of results log entries. This caused a hard parse failure because JobLogMsg used #[serde(untagged)], which routes deserialization through serde's internal ContentVisitor — and that visitor explicitly rejects visit_enum calls with:

untagged and internally tagged enums do not support enum input

serde_norway represents YAML-tagged values via visit_enum, so any tagged scalar in extra would crash the parser.

Changes

  • joblog.rsJobLogMsg: Replace #[serde(untagged)] + derived Deserialize with a hand-written impl that deserializes msg first into serde_norway::Value (which has a proper Tagged variant and handles visit_enum correctly), then dispatches by value type:
    • Value::StringMsg
    • Value::SequenceMsgs
    • Value::Mappingfrom_value::<JobResult>(...)

This means tagged values like ! "188250" survive into extra as Value::Tagged(...) rather than causing a parse error.

Example input that previously failed:

{"lvl": "results", "msg": {"case": "http-download", ..., "extra": {"size": ! "188250", ...}}}

Copilot AI changed the title [WIP] Fix fails to parse extra data in results message Fix deserialization of YAML-tagged values in job log extra fields Jun 23, 2026
Copilot AI requested a review from sjoerdsimons June 23, 2026 10:05
@sjoerdsimons sjoerdsimons requested a review from Copilot June 23, 2026 10:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a deserialization failure in JobLogEntry.msg when LAVA emits YAML-tagged scalars (e.g. ! "188250") inside the extra map of results log entries by avoiding serde’s untagged-enum ContentVisitor path and routing deserialization through serde_norway::Value first.

Changes:

  • Replaced JobLogMsg’s #[serde(untagged)] derived Deserialize with a custom Deserialize impl that first deserializes into serde_norway::Value and then dispatches by value type.
  • Added regression/unit tests covering tagged values in extra, plus string and sequence msg forms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lava-api/src/joblog.rs
@sjoerdsimons sjoerdsimons force-pushed the copilot/fix-extra-data-parsing branch from 204025c to ffbe777 Compare June 23, 2026 10:21
@sjoerdsimons sjoerdsimons marked this pull request as ready for review June 23, 2026 10:22
@sjoerdsimons sjoerdsimons force-pushed the copilot/fix-extra-data-parsing branch from ffbe777 to 1cd8905 Compare June 23, 2026 11:12
LAVA sometimes emits tagged YAML values (e.g. `! "188250"`) in the
`extra` field of results log entries. The previous `#[serde(untagged)]`
on `JobLogMsg` caused serde's internal ContentVisitor to be used for
buffering, and that visitor explicitly rejects `visit_enum` calls with:

  "untagged and internally tagged enums do not support enum input"

Fix this by replacing the derived untagged Deserialize with a custom
implementation that first deserializes the `msg` field as a
`serde_norway::Value` (which fully supports tagged YAML values), then
dispatches to the correct JobLogMsg variant based on the value type.

Closes: #31
@sjoerdsimons sjoerdsimons force-pushed the copilot/fix-extra-data-parsing branch from 1cd8905 to 733dd27 Compare June 23, 2026 11:20
@sjoerdsimons sjoerdsimons enabled auto-merge June 23, 2026 11:20
@sjoerdsimons sjoerdsimons added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit c77eada Jun 23, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants