Skip to content

ctf: Support CTF2 empty structs#409

Open
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:ctf2-support-empty-struct
Open

ctf: Support CTF2 empty structs#409
arfio wants to merge 1 commit into
eclipse-tracecompass:masterfrom
arfio:ctf2-support-empty-struct

Conversation

@arfio

@arfio arfio commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What it does

Allow empty structs with no names to be read as they are valid ctf2 structs. Fixes #378

How to test

Open the attached trace of the issue

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

Summary by CodeRabbit

  • Bug Fixes
    • Fixed handling of empty structs in CTF2 JSON format. Previously, empty structs without a name and body would cause an error. They are now properly processed and supported.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9243b069-a5b1-4fa8-8675-1c5c0072ef80

📥 Commits

Reviewing files that changed from the base of the PR and between 580df59 and a7db062.

📒 Files selected for processing (1)
  • ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/struct/StructParser.java

📝 Walkthrough

Walkthrough

StructParser now imports CTFJsonMetadataNode and extends its parse() method to handle empty structs in CTF2 JSON format. When parsing JSON metadata with no struct body and no name, the parser creates an empty StructDeclaration instead of throwing an error.

Changes

CTF2 Empty Struct JSON Parsing

Layer / File(s) Summary
Empty struct handling in JSON parser
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/struct/StructParser.java
StructParser imports CTFJsonMetadataNode and adds a JSON-specific branch to the parse() fallback path that constructs an empty StructDeclaration for CTF2 JSON structs lacking both name and body, instead of raising a parse error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • MatthewKhouzam

Poem

🐰 Empty structs in JSON bloom,
No name, no body—just room!
With CTFNode's gentle hand,
Traces parse across the land. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'ctf: Support CTF2 empty structs' clearly and concisely summarizes the main change: adding support for empty CTF2 structs in the CTF metadata parser.
Linked Issues check ✅ Passed The code changes successfully implement support for empty CTF2 structs by extending StructParser to handle cases where struct has no body/name but is a CTFJsonMetadataNode, directly addressing issue #378's requirement.
Out of Scope Changes check ✅ Passed All changes in StructParser are directly scoped to supporting empty CTF2 structs as specified in the linked issue; no unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
@arfio arfio force-pushed the ctf2-support-empty-struct branch from 6e63dda to a7db062 Compare June 12, 2026 03:43
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.

CTF2 Empty struct metadata failed to be parsed

1 participant