Skip to content

Investigation related to custom lateral lengths#686

Open
magnesj wants to merge 1 commit intodevfrom
custom-lateral-length
Open

Investigation related to custom lateral lengths#686
magnesj wants to merge 1 commit intodevfrom
custom-lateral-length

Conversation

@magnesj
Copy link
Owner

@magnesj magnesj commented Feb 17, 2026

PR Type

Enhancement


Description

  • Refactor custom segment intervals retrieval from parameters

  • Move segment configuration UI section outside conditional block

  • Use well path completion settings to access segment intervals

  • Improve code organization and maintainability


Diagram Walkthrough

flowchart LR
  A["RicMswTableDataTools"] -->|retrieve intervals| B["RimMswCompletionParameters"]
  B -->|access via| C["RigWellPath completionSettings"]
  C -->|get| D["Segment Intervals"]
  E["UI Ordering"] -->|moved outside| F["Conditional Block"]
Loading

File Walkthrough

Relevant files
Enhancement
RicMswTableDataTools.cpp
Extract segment intervals from well path settings               

ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp

  • Added include for RimCustomSegmentIntervalCollection.h
  • Extract segment intervals from lateral well path completion settings
  • Pass retrieved intervals to createSubSegmentMDPairs instead of custom
    parameter
+5/-1     
RimMswCompletionParameters.cpp
Relocate segment configuration UI section                               

ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp

  • Moved "Custom Segment Configuration" UI section outside the
    conditional block
  • Relocated segment configuration group definition to apply universally
  • Maintains same UI elements but improves code organization
+6/-6     

@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Null pointer deref

Description: Possible null-pointer dereference/DoS: the new chained calls
lateral->completionSettings()->mswCompletionParameters()->getSegmentIntervals() assume all
pointers are non-null and occur before the later CVF_ASSERT(branch->wellPath()), so a
crafted/invalid project state could crash the application during export.
RicMswTableDataTools.cpp [201-205]

Referred Code
auto lateral   = branch->wellPath();
auto intervals = lateral->completionSettings()->mswCompletionParameters()->getSegmentIntervals();

std::vector<std::pair<double, double>> segments =
    RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, maxSegmentLength, intervals );
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing null checks: The new pointer chain dereferences
lateral->completionSettings()->mswCompletionParameters() without validating
intermediate pointers, risking crashes on null/absent settings.

Referred Code
auto lateral   = branch->wellPath();
auto intervals = lateral->completionSettings()->mswCompletionParameters()->getSegmentIntervals();

std::vector<std::pair<double, double>> segments =
    RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, maxSegmentLength, intervals );

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Unvalidated external data: The PR now consumes segment interval data from completion settings without visible
validation/sanitization of interval bounds or ordering, which may allow invalid geometry
inputs unless guaranteed elsewhere.

Referred Code
auto lateral   = branch->wellPath();
auto intervals = lateral->completionSettings()->mswCompletionParameters()->getSegmentIntervals();

std::vector<std::pair<double, double>> segments =
    RicMswTableDataTools::createSubSegmentMDPairs( startMD, endMD, maxSegmentLength, intervals );

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Assert non-null pointers before use

Add CVF_ASSERT checks for wellPath, completionSettings, and
mswCompletionParameters pointers to ensure they are not null before being
dereferenced.

ApplicationLibCode/Commands/CompletionExportCommands/RicMswTableDataTools.cpp [201-202]

-auto lateral   = branch->wellPath();
-auto intervals = lateral->completionSettings()->mswCompletionParameters()->getSegmentIntervals();
+CVF_ASSERT(branch->wellPath());
+auto* lateral = branch->wellPath();
+CVF_ASSERT(lateral->completionSettings());
+auto* settings = lateral->completionSettings();
+CVF_ASSERT(settings->mswCompletionParameters());
+auto* mswParams = settings->mswCompletionParameters();
+auto intervals = mswParams->getSegmentIntervals();
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a potential null pointer dereference due to chained calls and a misplaced CVF_ASSERT. Adding assertions aligns with the existing coding style and prevents runtime crashes by ensuring pointers are valid before use.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments