Skip to content

Commit d770e4d

Browse files
committed
Add fail-fast local parity ladder and staged CI diagnostics
1 parent 069b00f commit d770e4d

File tree

9 files changed

+798
-6
lines changed

9 files changed

+798
-6
lines changed

.github/workflows/matlab-parity-gate.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,27 @@ jobs:
5757
python3 python/tools/generate_method_parity_matrix.py
5858
python3 python/tools/generate_implemented_method_coverage.py
5959
60-
- name: Run MATLAB/Python similarity gate
60+
- name: Parity Stage A (core + timeout-front)
61+
run: |
62+
python/tools/run_parity_ladder.sh core_smoke timeout_front
63+
64+
- name: Parity Stage B (graphics-mid + heavy-tail)
65+
run: |
66+
python/tools/run_parity_ladder.sh graphics_mid heavy_tail
67+
68+
- name: Parity Stage C (full-suite gate report)
6169
run: |
6270
python3 python/tools/verify_python_vs_matlab_similarity.py --enforce-gate
6371
72+
- name: Summarize full-suite parity report
73+
if: ${{ always() && !cancelled() }}
74+
run: |
75+
if [ -f python/reports/python_vs_matlab_similarity_report.json ]; then
76+
python3 python/tools/summarize_parity_report.py python/reports/python_vs_matlab_similarity_report.json --json > python/reports/python_vs_matlab_similarity_summary.json
77+
else
78+
echo "Parity report missing; skipping summary."
79+
fi
80+
6481
- name: Freeze similarity baseline
6582
if: ${{ always() && !cancelled() }}
6683
run: |
@@ -70,6 +87,38 @@ jobs:
7087
echo "Similarity report missing; skipping baseline freeze."
7188
fi
7289
90+
- name: Collect MATLAB crash diagnostics
91+
if: ${{ failure() && !cancelled() }}
92+
continue-on-error: true
93+
run: |
94+
set -euo pipefail
95+
OUT_DIR="python/reports/matlab_crash_diagnostics"
96+
mkdir -p "$OUT_DIR/diagnostic_reports" "$OUT_DIR/mathworks_crash_reports"
97+
98+
# Collect macOS crash/ips reports (latest 20) when MATLAB crashes.
99+
DIAG_DIR="$HOME/Library/Logs/DiagnosticReports"
100+
if [ -d "$DIAG_DIR" ]; then
101+
find "$DIAG_DIR" -maxdepth 1 -type f \( -name '*MATLAB*.crash' -o -name '*matlab*.crash' -o -name '*MATLAB*.ips' -o -name '*matlab*.ips' \) -print \
102+
| sort \
103+
| tail -n 20 \
104+
| while IFS= read -r f; do cp -f "$f" "$OUT_DIR/diagnostic_reports/" || true; done
105+
fi
106+
107+
# Collect MathWorks CrashReporter payload files (latest 50).
108+
MW_APP_SUPPORT="$HOME/Library/Application Support/MathWorks"
109+
if [ -d "$MW_APP_SUPPORT" ]; then
110+
find "$MW_APP_SUPPORT" -type d -name crash_reports -print \
111+
| while IFS= read -r crash_dir; do
112+
find "$crash_dir" -type f -print || true
113+
done \
114+
| sort \
115+
| tail -n 50 \
116+
| while IFS= read -r f; do cp -f "$f" "$OUT_DIR/mathworks_crash_reports/" || true; done
117+
fi
118+
119+
# Keep staged block reports if present for triage context.
120+
ls -1 python/reports/parity_block*.json > "$OUT_DIR/parity_block_report_manifest.txt" 2>/dev/null || true
121+
73122
- name: Upload parity reports
74123
if: ${{ always() && !cancelled() }}
75124
continue-on-error: true
@@ -80,3 +129,6 @@ jobs:
80129
path: |
81130
python/reports/python_vs_matlab_similarity_report.json
82131
python/reports/python_vs_matlab_similarity_baseline.json
132+
python/reports/python_vs_matlab_similarity_summary.json
133+
python/reports/parity_block*.json
134+
python/reports/matlab_crash_diagnostics/**

.github/workflows/python-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
python python/tools/generate_method_parity_matrix.py
4242
python python/tools/generate_implemented_method_coverage.py
4343
44+
- name: Verify help docs coverage
45+
run: |
46+
python python/tools/verify_help_docs_coverage.py
47+
4448
- name: Validate notebooks
4549
run: |
4650
python python/tools/verify_examples_notebooks.py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ __pycache__/
55
python/plots/
66

77
python/docs/_build/
8+
python/reports/parity_block*.json

python/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,67 @@ python3 python/tools/verify_offline_standalone.py
5252
cd python && python3 -m pytest
5353
```
5454

55+
### Local parity block debugging
56+
57+
```bash
58+
python3 python/tools/debug_parity_blocks.py \
59+
--set-actions-runner-svc \
60+
--matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
61+
```
62+
63+
Single wrapper command (fail-fast ladder):
64+
65+
```bash
66+
python/tools/run_parity_ladder.sh
67+
```
68+
69+
Notes:
70+
71+
- Runs blocks in order: `core_smoke -> timeout_front -> graphics_mid -> heavy_tail -> full_suite`.
72+
- Exits immediately if a block regresses (`python_ok`, `matlab_ok`, scalar overlap, parity contract, or regression gate).
73+
- Includes runtime regression guard using machine baseline block times with multiplier `NSTAT_PARITY_RUNTIME_MULTIPLIER` (default `2.5`).
74+
- Set `NSTAT_PARITY_RUNTIME_MULTIPLIER=0` to disable runtime regression checks.
75+
- Pass specific block names as args to run subset ladders, e.g.:
76+
`python/tools/run_parity_ladder.sh core_smoke timeout_front`.
77+
78+
Use targeted blocks to debug delays locally before running remote CI:
79+
80+
```bash
81+
# 1) Fast API/parity smoke
82+
python3 python/tools/debug_parity_blocks.py --blocks core_smoke \
83+
--set-actions-runner-svc --matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
84+
85+
# 2) Former timeout-prone front topics
86+
python3 python/tools/debug_parity_blocks.py --blocks timeout_front \
87+
--set-actions-runner-svc --matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
88+
89+
# 3) Graphics-sensitive middle topics
90+
python3 python/tools/debug_parity_blocks.py --blocks graphics_mid \
91+
--set-actions-runner-svc --matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
92+
93+
# 4) Heavy tail topics
94+
python3 python/tools/debug_parity_blocks.py --blocks heavy_tail \
95+
--set-actions-runner-svc --matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
96+
97+
# 5) Full gate-equivalent suite
98+
python3 python/tools/debug_parity_blocks.py --blocks full_suite \
99+
--set-actions-runner-svc --matlab-extra-args "-maca64 -nodisplay -noFigureWindows"
100+
```
101+
102+
Summarize a parity report quickly:
103+
104+
```bash
105+
python3 python/tools/summarize_parity_report.py python/reports/parity_block_full_suite.json
106+
```
107+
108+
Recent local baseline on this machine (MATLAB R2025b, no figure windows):
109+
110+
- `core_smoke`: ~47s
111+
- `timeout_front`: ~122s
112+
- `graphics_mid`: ~291s
113+
- `heavy_tail`: ~385s
114+
- `full_suite` (25 topics): ~826s
115+
55116
## CI
56117

57118
- `.github/workflows/python-ci.yml` runs docs, notebook verification, offline standalone checks, and `pytest`.

0 commit comments

Comments
 (0)