Skip to content

Comments

lttng: fix validation of ust ctf2 trace#373

Merged
arfio merged 1 commit intoeclipse-tracecompass:masterfrom
arfio:lttng-ctf2-ust-validate
Feb 20, 2026
Merged

lttng: fix validation of ust ctf2 trace#373
arfio merged 1 commit intoeclipse-tracecompass:masterfrom
arfio:lttng-ctf2-ust-validate

Conversation

@arfio
Copy link
Contributor

@arfio arfio commented Feb 19, 2026

What it does

It makes LTTng UST ctf2 traces detectable by Trace Compass by modifying the validate function.

How to test

Open a CTF2 trace generated from LTTng 2.15 with a program instrumented by LTTng-UST

Review checklist

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

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced domain validation to accept alternative domain value formats, improving trace parsing compatibility and reducing validation errors.

Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

The domain validation in LttngUstTrace.validate was modified to accept both "ust" and "\"ust\"" as valid domain values. The method now checks if the domain matches either format, returning a DomainError only when the domain is null or does not match either accepted value.

Changes

Cohort / File(s) Summary
Domain validation expansion
lttng/org.eclipse.tracecompass.lttng2.ust.core/.../trace/LttngUstTrace.java
Broadened domain check to accept both unquoted (ust) and quoted ("ust") domain formats in the validation method.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops through validation gates,
Where domains now dance in dual states—
Both quoted and bare are now quite fair,
Flexibility blooms in the debugging air! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the PR's main objective: fixing validation to support LTTng UST CTF2 traces, which aligns with the code change that broadens domain validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java (1)

193-193: LGTM — the Boolean guard is correct; one optional readability nit.

The condition correctly admits the unquoted "ust" (CTF2) alongside the legacy quoted "\"ust\"" (CTF1) while still rejecting null and any other value. No logic issues.

Optional: extracting the two accepted values into named constants (or a small Set) would make the intent self-documenting and make future format additions a one-line change:

♻️ Optional refactor — named constant + Set lookup
+    private static final Set<String> VALID_DOMAINS = ImmutableSet.of("ust", "\"ust\""); //$NON-NLS-1$ //$NON-NLS-2$
+
     `@Override`
     public IStatus validate(final IProject project, final String path) {
         ...
-            if (domain == null || !(domain.equals("ust") || domain.equals("\"ust\""))) { //$NON-NLS-1$ //$NON-NLS-2$
+            if (domain == null || !VALID_DOMAINS.contains(domain)) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java`
at line 193, The null/equals check for domain in LttngUstTrace currently
hardcodes accepted values ("ust" and "\"ust\"") inline; refactor by introducing
named constants (e.g., UST_UNQUOTED and UST_QUOTED) or a small immutable Set of
accepted domain strings and replace the inline condition (the if that checks
domain == null || !(domain.equals("ust") || domain.equals("\"ust\""))) with a
clearer lookup (null-check plus contains on the Set or equals against the
constants) to improve readability and make future additions trivial.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java`:
- Line 193: The null/equals check for domain in LttngUstTrace currently
hardcodes accepted values ("ust" and "\"ust\"") inline; refactor by introducing
named constants (e.g., UST_UNQUOTED and UST_QUOTED) or a small immutable Set of
accepted domain strings and replace the inline condition (the if that checks
domain == null || !(domain.equals("ust") || domain.equals("\"ust\""))) with a
clearer lookup (null-check plus contains on the Set or equals against the
constants) to improve readability and make future additions trivial.

@arfio arfio merged commit 1243012 into eclipse-tracecompass:master Feb 20, 2026
5 checks passed
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.

2 participants