Skip to content

Prevent resource sampling crash on profiles with missing/gap dynamics#1943

Open
AaronPlave wants to merge 1 commit into
developfrom
fix/resource-sampling-gaps
Open

Prevent resource sampling crash on profiles with missing/gap dynamics#1943
AaronPlave wants to merge 1 commit into
developfrom
fix/resource-sampling-gaps

Conversation

@AaronPlave

@AaronPlave AaronPlave commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a crash in resource sampling where real profiles with null/missing dynamics (or dynamics lacking initial/rate) made sampleProfiles throw, breaking views with these resources. Split out of #1837. Profile segments with no dynamics are valid profiles in PlanDev (comment from DB column says dynamics "may be NULL if no behavior is known" and that a trailing NULL segment is required to mark a profile's end so effectively every profile ends in a gap segment. A real world example of this is an external dataset with gaps like contact windows.

Details

  • Gap/null/missing-dynamics segments now render as gaps in the timeline
  • Malformed real dynamics are skipped
  • Adds isRealDynamics guard and types ProfileSegment.dynamics

Visible UX changes

Plans whose external profiles contain gap/dynamics-less segments now render (gaps shown) instead of crashing.

Verification

New unit tests added to src/utilities/resources.test.ts to cover these cases.

…amics

Real profile segments with null/missing dynamics are now emitted as gaps,
and segments with malformed dynamics (missing initial/rate) are skipped,
instead of throwing during resource profiling. Adds an isRealDynamics type
guard and tightens ProfileSegment dynamics typing.

Covered by unit tests in resources.test.ts; the external-dataset.json
fixture gains a dynamics-less segment that reproduces the original crash.
@AaronPlave AaronPlave requested a review from a team as a code owner June 9, 2026 00:32
@AaronPlave AaronPlave self-assigned this Jun 9, 2026
@AaronPlave AaronPlave added the fix A bug fix label Jun 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

Labels

fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant