Skip to content

Fix test flakiness and add timeline coverage (#347)#347

Closed
fengxizhou wants to merge 1 commit into
facebookresearch:mainfrom
fengxizhou:export-D104891668
Closed

Fix test flakiness and add timeline coverage (#347)#347
fengxizhou wants to merge 1 commit into
facebookresearch:mainfrom
fengxizhou:export-D104891668

Conversation

@fengxizhou

@fengxizhou fengxizhou commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary:

Fix two root causes of flakiness in test_timeline.py and add coverage for uncovered functions in hta/analyzers/timeline.py.

Flakiness fixes:

  • get_trace(rank) returns a direct reference to the internal DataFrame, not a copy. All setUp methods and inline calls now use .copy() to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
  • test_raises_on_partial_columns had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate cols_present so the ValueError assertion always fires.

Coverage additions (test_coverage_gaps.py):

  • test_simplify_name_truncates_long_names — covers truncation path in _simplify_name
  • test_plot_gpu_kernels_delegates — covers plot_timeline_gpu_kernels (previously 0% coverage)
  • test_plot_gpu_kernels_from_trace — covers plot_timeline_gpu_kernels_from_trace (previously 0% coverage)

Reviewed By: Chenguang-Zhu

Differential Revision: D104891668

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2026
@meta-codesync

meta-codesync Bot commented May 12, 2026

Copy link
Copy Markdown

@fengxizhou has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104891668.

@fengxizhou fengxizhou force-pushed the export-D104891668 branch from d38af66 to fd41ee8 Compare May 12, 2026 22:14
@meta-codesync meta-codesync Bot changed the title Fix test flakiness and add timeline coverage Fix test flakiness and add timeline coverage (#347) May 12, 2026
fengxizhou added a commit to fengxizhou/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Differential Revision: D104891668
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from fd41ee8 to 0044c67 Compare May 12, 2026 22:26
fengxizhou added a commit to fengxizhou/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Differential Revision: D104891668
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from 0044c67 to 076f198 Compare May 12, 2026 22:56
@meta-codesync meta-codesync Bot changed the title Fix test flakiness and add timeline coverage (#347) Fix test flakiness and add timeline coverage May 12, 2026
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from 076f198 to 9af410b Compare May 12, 2026 23:12
@meta-codesync meta-codesync Bot changed the title Fix test flakiness and add timeline coverage Fix test flakiness and add timeline coverage (#347) May 12, 2026
fengxizhou added a commit to fengxizhou/HolisticTraceAnalysis that referenced this pull request May 12, 2026
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Differential Revision: D104891668
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from 9af410b to cece533 Compare May 12, 2026 23:55
fengxizhou added a commit to fengxizhou/HolisticTraceAnalysis that referenced this pull request May 13, 2026
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Differential Revision: D104891668
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from cece533 to 8090140 Compare May 13, 2026 00:05
fengxizhou added a commit to fengxizhou/HolisticTraceAnalysis that referenced this pull request May 13, 2026
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Differential Revision: D104891668
@fengxizhou fengxizhou force-pushed the export-D104891668 branch from 8090140 to 7a383ec Compare May 13, 2026 01:35
Summary:

Fix two root causes of flakiness in `test_timeline.py` and add coverage for uncovered functions in `hta/analyzers/timeline.py`.

**Flakiness fixes:**
- `get_trace(rank)` returns a direct reference to the internal DataFrame, not a copy. All `setUp` methods and inline calls now use `.copy()` to ensure test isolation — preventing shared mutable state between tests that caused non-deterministic failures depending on execution order.
- `test_raises_on_partial_columns` had a silent-pass path: when trace data contained all required columns, the test body never executed. Rewritten to always truncate `cols_present` so the ValueError assertion always fires.

**Coverage additions (test_coverage_gaps.py):**
- `test_simplify_name_truncates_long_names` — covers truncation path in `_simplify_name`
- `test_plot_gpu_kernels_delegates` — covers `plot_timeline_gpu_kernels` (previously 0% coverage)
- `test_plot_gpu_kernels_from_trace` — covers `plot_timeline_gpu_kernels_from_trace` (previously 0% coverage)

Reviewed By: Chenguang-Zhu

Differential Revision: D104891668
@meta-codesync

meta-codesync Bot commented May 13, 2026

Copy link
Copy Markdown

This pull request has been merged in 3bdde70.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant