Skip to content

sm2mm: Add optional flag --permit-missing-externals#39

Merged
jlblancoc merged 1 commit intodevelopfrom
feat/permit-missing-externals
Feb 4, 2026
Merged

sm2mm: Add optional flag --permit-missing-externals#39
jlblancoc merged 1 commit intodevelopfrom
feat/permit-missing-externals

Conversation

@jlblancoc
Copy link
Member

@jlblancoc jlblancoc commented Feb 4, 2026

Summary by CodeRabbit

  • New Features

    • Added a CLI flag (--permit-missing-externals) that, when enabled, treats missing external files as warnings and continues processing.
  • Behavior

    • Processing now catches missing-external errors and logs a warning (showing brief context) instead of aborting when the new flag is set.
  • Documentation

    • Updated command usage and help text to document the new option.

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A new CLI flag --permit-missing-externals was added and wired into sm2mm_options_t as throw_on_missing_external_files. The processing loop in sm2mm.cpp now catches missing-external-file errors, logs a warning, and continues when the flag is set false.

Changes

Cohort / File(s) Summary
CLI
apps/sm2mm/main.cpp
Added TCLAP::SwitchArg argDontThrowOnMissingExternals (--permit-missing-externals) and wire to options to control missing-external behavior.
Docs
docs/source/app_sm2mm.rst
Added --permit-missing-externals to usage and options with help text; minor reflow of nearby options.
Options struct
mp2p_icp_filters/include/mp2p_icp_filters/sm2mm.h
Added bool throw_on_missing_external_files = true; to mp2p_icp_filters::sm2mm_options_t.
Processing / Error handling
mp2p_icp_filters/src/sm2mm.cpp
Added first_n_lines() helper; wrapped frame processing in try-catch. On "Assert file existence failed" and when throw_on_missing_external_files is false, log a warning (first 3 lines) and continue; otherwise rethrow. Minor reorganization of observation load/unload and pipeline application.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI
participant sm2mm as sm2mm Process
participant FS as External Files Checker
participant Logger
CLI->>sm2mm: parse args (permit-missing-externals)
sm2mm->>sm2mm: for each frame: load observations
sm2mm->>FS: validate external files
alt files present
FS-->>sm2mm: ok
sm2mm->>sm2mm: run generators & pipeline
else missing files
FS-->>sm2mm: throw "Assert file existence failed"
alt throw_on_missing_external_files == true
sm2mm-->>CLI: propagate exception (abort)
else throw_on_missing_external_files == false
sm2mm->>Logger: log warning with snippet
sm2mm-->>sm2mm: continue to next frame
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A hop, a sniff, a gentle nudge,

When externals wander off the ledge,
I log a warning, skip the fray,
And bound along to map the day.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a new CLI flag --permit-missing-externals to the sm2mm application.

✏️ 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
  • Commit unit tests in branch feat/permit-missing-externals

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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@mp2p_icp_filters/src/sm2mm.cpp`:
- Around line 245-255: The observation object loaded for processing is not
always unloaded: when apply_generators(generators, *obs, mm, robotPose) returns
false the code continues without calling obs->unload(), and the same omission
exists in the exception handler; fix by ensuring obs->unload() is called on
every exit path (e.g., call obs->unload() immediately before the early continue
and also in the catch block before rethrow/continue), or preferably wrap the
load/process block with a RAII/scope-guard that calls obs->unload() in its
destructor to guarantee unload regardless of normal return or exceptions
(references: apply_generators, apply_filter_pipeline, obs->unload()).

@jlblancoc jlblancoc force-pushed the feat/permit-missing-externals branch from 71467c0 to 71ea591 Compare February 4, 2026 18:03
@jlblancoc jlblancoc merged commit d23d236 into develop Feb 4, 2026
9 of 13 checks passed
@jlblancoc jlblancoc deleted the feat/permit-missing-externals branch February 4, 2026 18:04
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