Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7496ab7
Add CI lint gate and local precheck command
sbryngelson Feb 4, 2026
26f7e17
Fix precheck.sh portability and usability issues
sbryngelson Feb 4, 2026
4b17fa2
Gate benchmarks on Test Suite completion
sbryngelson Feb 4, 2026
1b211a5
Auto-install git pre-commit hook for precheck
sbryngelson Feb 4, 2026
9304137
Use dynamic CPU count in pre-commit hook
sbryngelson Feb 4, 2026
77ac8cc
Show CPU count in pre-commit hook output
sbryngelson Feb 4, 2026
a7cf1d2
Merge upstream master, resolve mfc.sh conflict
sbryngelson Feb 5, 2026
4b55c30
Add precheck command to CLI and autocomplete
sbryngelson Feb 5, 2026
e017cf0
Auto-update installed shell completions on regeneration
sbryngelson Feb 5, 2026
780138b
Show source command when completions auto-update
sbryngelson Feb 5, 2026
06f0425
Always check installed completions on every run
sbryngelson Feb 5, 2026
f65ed30
Prevent directory completion fallback in shell completions
sbryngelson Feb 5, 2026
d23addc
Auto-install completions and fix bash completion options
sbryngelson Feb 5, 2026
33cbd0e
Auto-install completions from mfc.sh with shell rc setup
sbryngelson Feb 5, 2026
1ba4666
Clarify verbose, debug, and debug-log flag documentation
sbryngelson Feb 5, 2026
adfcb7f
Cap pre-commit hook parallelism at 12 jobs
sbryngelson Feb 5, 2026
02ef3de
Fix completion auto-install to check for files, not just directory
sbryngelson Feb 5, 2026
ff8d499
Merge MFlowCode/MFC master into triage
sbryngelson Feb 5, 2026
fc5e2a5
Auto-update outdated shell completions
sbryngelson Feb 5, 2026
9c15c8a
Auto-activate completions when mfc.sh is sourced
sbryngelson Feb 5, 2026
52d0ddd
Use workflow_run for benchmarks and extract completion logic
sbryngelson Feb 5, 2026
8e3f405
Suppress verbose package list from uv install by default
sbryngelson Feb 5, 2026
989a79d
Compact splash screen from 45 to 20 lines
sbryngelson Feb 5, 2026
e913f7c
Pass arguments to python.sh for verbose flag support
sbryngelson Feb 5, 2026
6972e6e
Handle ./mfc.sh -v without command (show help, not error)
sbryngelson Feb 5, 2026
cf49bcc
Fix splash screen to use COMMANDS as single source of truth
sbryngelson Feb 5, 2026
72d8a38
Address AI reviewer feedback on PR #1124
sbryngelson Feb 5, 2026
88d8736
Show full build error output instead of truncating to 40 lines
sbryngelson Feb 5, 2026
c96edf2
Fix troubleshooting tips to suggest --debug instead of --debug-log
sbryngelson Feb 5, 2026
b44360f
Fix flags-before-command detection and shell detection
sbryngelson Feb 5, 2026
f24c62b
Raise minimum Python version to 3.12 (pyrometheus requires it)
sbryngelson Feb 5, 2026
e0bdc88
Lower minimum Python to 3.10 by pinning pyrometheus to pre-3.12 commit
sbryngelson Feb 5, 2026
f9fa919
Add -v flag to all CI build/run/test/bench commands
sbryngelson Feb 5, 2026
0ec406b
Add -v flag to coverage and GitHub runner CI commands
sbryngelson Feb 5, 2026
1e863ae
Revert pyrometheus pin to track git HEAD
sbryngelson Feb 5, 2026
73e0de3
Remove -v flag from HPC CI scripts to fix build stalls
sbryngelson Feb 8, 2026
b76f0a3
Fix shell detection for zsh users sourcing under bash
sbryngelson Feb 8, 2026
13fcc83
Limit push-triggered CI to master branch only
sbryngelson Feb 8, 2026
6b0faef
Fix shell detection to not use $SHELL fallback when in bash
sbryngelson Feb 8, 2026
2651c08
Change Frontier SLURM account from CFD154 to ENG160
sbryngelson Feb 8, 2026
18548ab
Remove -v flag from GitHub/coverage CI and pin pyrometheus
sbryngelson Feb 8, 2026
32c4fa4
Harden CI against transient Frontier/Phoenix failures
sbryngelson Feb 8, 2026
cd1b771
Add SIGHUP protection to Frontier build scripts
sbryngelson Feb 8, 2026
4353e1e
Restore -v flag to all CI build and test commands
sbryngelson Feb 9, 2026
40a12e1
Remove -v from GitHub-hosted CI, keep for self-hosted runners
sbryngelson Feb 9, 2026
0fdd27e
Fix pipe deadlock in -v build mode and restore -v everywhere
sbryngelson Feb 9, 2026
8321eac
Pass --test-all to Build step so post_process builds during dry-run
sbryngelson Feb 9, 2026
f213175
Refactor test.yml: generic self-hosted steps via matrix.cluster
sbryngelson Feb 9, 2026
3470c7a
Unpin pyrometheus to track git HEAD
sbryngelson Feb 9, 2026
d169d08
Clean build directory between retry attempts
sbryngelson Feb 9, 2026
9734b2d
Add build retry logic with clean to Phoenix test script
sbryngelson Feb 9, 2026
3fefb70
Add build retry with clean to Phoenix benchmark script
sbryngelson Feb 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,85 @@
name: 'Benchmark'

on:
pull_request:
pull_request_review:
types: [submitted]
# Trigger when Test Suite completes (no polling needed)
workflow_run:
workflows: ["Test Suite"]
types: [completed]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
cancel-in-progress: true
Comment thread
sbryngelson marked this conversation as resolved.

jobs:
file-changes:
name: Detect File Changes
# Only run if Test Suite passed (or manual dispatch)
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: 'ubuntu-latest'
outputs:
checkall: ${{ steps.changes.outputs.checkall }}
pr_number: ${{ steps.pr-info.outputs.pr_number }}
pr_approved: ${{ steps.pr-info.outputs.approved }}
pr_author: ${{ steps.pr-info.outputs.author }}
steps:
- name: Clone
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}

- name: Detect Changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: ".github/file-filter.yml"

wait-for-tests:
name: Wait for Test Suite
runs-on: ubuntu-latest
steps:
- name: Wait for Test Suite to Pass
- name: Get PR Info
id: pr-info
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Waiting for Test Suite workflow to complete..."
SHA="${{ github.event.pull_request.head.sha || github.sha }}"

# Poll every 60 seconds for up to 3 hours
for i in $(seq 1 180); do
# Get the Test Suite workflow runs for this commit
STATUS=$(gh api repos/${{ github.repository }}/commits/$SHA/check-runs \
--jq '.check_runs[] | select(.name == "Lint Gate") | .conclusion' | head -1)

if [ "$STATUS" = "success" ]; then
echo "Lint Gate passed. Checking test jobs..."

# Check if any Github test jobs failed
FAILED=$(gh api repos/${{ github.repository }}/commits/$SHA/check-runs \
--jq '[.check_runs[] | select(.name | startswith("Github")) | select(.conclusion == "failure")] | length')

if [ "$FAILED" != "0" ]; then
echo "::error::Test Suite has failing jobs. Benchmarks will not run."
exit 1
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "pr_number=" >> $GITHUB_OUTPUT
echo "approved=true" >> $GITHUB_OUTPUT
echo "author=${{ github.actor }}" >> $GITHUB_OUTPUT
else
# Get PR number from workflow_run
PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
if [ -n "$PR_NUMBER" ]; then
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT

# Fetch actual PR author from API (workflow_run.actor is the re-runner, not PR author)
PR_AUTHOR=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.user.login')
echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT

# Check if PR is approved
APPROVED=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews \
--jq '[.[] | select(.state == "APPROVED")] | length')
if [ "$APPROVED" -gt 0 ]; then
echo "approved=true" >> $GITHUB_OUTPUT
else
echo "approved=false" >> $GITHUB_OUTPUT
fi

# Check if Github tests are still running
PENDING=$(gh api repos/${{ github.repository }}/commits/$SHA/check-runs \
--jq '[.check_runs[] | select(.name | startswith("Github")) | select(.conclusion == null)] | length')

if [ "$PENDING" = "0" ]; then
echo "All Test Suite jobs completed successfully!"
exit 0
fi

echo "Tests still running ($PENDING pending)..."
elif [ "$STATUS" = "failure" ]; then
echo "::error::Lint Gate failed. Benchmarks will not run."
exit 1
else
echo "Lint Gate status: ${STATUS:-pending}..."
echo "pr_number=" >> $GITHUB_OUTPUT
echo "approved=false" >> $GITHUB_OUTPUT
echo "author=" >> $GITHUB_OUTPUT
fi

sleep 60
done

echo "::error::Timeout waiting for Test Suite to complete."
exit 1
fi

self:
name: "${{ matrix.name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }})"
if: ${{ github.repository=='MFlowCode/MFC' && needs.file-changes.outputs.checkall=='true' && ((github.event_name=='pull_request_review' && github.event.review.state=='approved') || (github.event_name=='pull_request' && (github.event.pull_request.user.login=='sbryngelson' || github.event.pull_request.user.login=='wilfonba'))) }}
needs: [file-changes, wait-for-tests]
if: >
github.repository == 'MFlowCode/MFC' &&
needs.file-changes.outputs.checkall == 'true' &&
(
github.event_name == 'workflow_dispatch' ||
needs.file-changes.outputs.pr_approved == 'true' ||
needs.file-changes.outputs.pr_author == 'sbryngelson' ||
needs.file-changes.outputs.pr_author == 'wilfonba'
)
needs: [file-changes]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -145,6 +143,7 @@ jobs:
- name: Clone - PR
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
path: pr

- name: Clone - Master
Expand Down
61 changes: 23 additions & 38 deletions mfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,8 @@ if [ -d "$(pwd)/.git" ] && [ ! -e "$(pwd)/.git/hooks/pre-commit" ] && [ -f "$(pw
log "Installed git pre-commit hook (runs$MAGENTA ./mfc.sh precheck$COLOR_RESET before commits)."
fi

# Auto-install shell completions (once)
COMPLETION_DIR="$HOME/.local/share/mfc/completions"
if [ ! -d "$COMPLETION_DIR" ]; then
mkdir -p "$COMPLETION_DIR"
cp "$(pwd)/toolchain/completions/mfc.bash" "$COMPLETION_DIR/"
cp "$(pwd)/toolchain/completions/_mfc" "$COMPLETION_DIR/"

# Add to shell rc file based on current shell
if [[ "$SHELL" == *"zsh"* ]]; then
RC_FILE="$HOME/.zshrc"
RC_LINE="fpath=(\"$COMPLETION_DIR\" \$fpath)"
SOURCE_CMD="source $COMPLETION_DIR/_mfc"
else
RC_FILE="$HOME/.bashrc"
RC_LINE="[ -f \"$COMPLETION_DIR/mfc.bash\" ] && source \"$COMPLETION_DIR/mfc.bash\""
SOURCE_CMD="source $COMPLETION_DIR/mfc.bash"
fi

if [ -f "$RC_FILE" ] && ! grep -q "$COMPLETION_DIR" "$RC_FILE" 2>/dev/null; then
echo "" >> "$RC_FILE"
echo "# MFC shell completion" >> "$RC_FILE"
echo "$RC_LINE" >> "$RC_FILE"
fi

log "Installed tab completions. Restart shell or run:$MAGENTA $SOURCE_CMD$COLOR_RESET"
fi
# Shell completions auto-install/update
. "$(pwd)/toolchain/bootstrap/completions.sh" "$(pwd)"

# Print startup message immediately for user feedback
log "Starting..."
Expand Down Expand Up @@ -72,33 +48,33 @@ if [ "$1" '==' 'load' ] && [ "$2" != "--help" ] && [ "$2" != "-h" ]; then
echo ""
exit 1
fi
shift; . "$(pwd)/toolchain/bootstrap/modules.sh" $@; return
shift; . "$(pwd)/toolchain/bootstrap/modules.sh" "$@"; return
elif [ "$1" '==' "lint" ] && [ "$2" != "--help" ] && [ "$2" != "-h" ]; then
. "$(pwd)/toolchain/bootstrap/python.sh"
. "$(pwd)/toolchain/bootstrap/python.sh" "$@"

shift; . "$(pwd)/toolchain/bootstrap/lint.sh" $@; exit 0
shift; . "$(pwd)/toolchain/bootstrap/lint.sh" "$@"; exit 0
elif [ "$1" '==' "format" ] && [ "$2" != "--help" ] && [ "$2" != "-h" ]; then
. "$(pwd)/toolchain/bootstrap/python.sh"
. "$(pwd)/toolchain/bootstrap/python.sh" "$@"

shift; . "$(pwd)/toolchain/bootstrap/format.sh" $@; exit 0
shift; . "$(pwd)/toolchain/bootstrap/format.sh" "$@"; exit 0
elif [ "$1" '==' "venv" ]; then
shift; . "$(pwd)/toolchain/bootstrap/python.sh" $@; return
shift; . "$(pwd)/toolchain/bootstrap/python.sh" "$@"; return
Comment thread
sbryngelson marked this conversation as resolved.
elif [ "$1" '==' "clean" ] && [ "$2" != "--help" ] && [ "$2" != "-h" ]; then
rm -rf "$(pwd)/build"; exit 0
elif [ "$1" '==' "spelling" ] && [ "$2" != "--help" ] && [ "$2" != "-h" ]; then
. "$(pwd)/toolchain/bootstrap/python.sh"
. "$(pwd)/toolchain/bootstrap/python.sh" "$@"

shift; . "$(pwd)/toolchain/bootstrap/spelling.sh" $@; exit 0
shift; . "$(pwd)/toolchain/bootstrap/spelling.sh" "$@"; exit 0
elif [ "$1" '==' "precheck" ]; then
. "$(pwd)/toolchain/bootstrap/python.sh"
. "$(pwd)/toolchain/bootstrap/python.sh" "$@"

shift; . "$(pwd)/toolchain/bootstrap/precheck.sh" $@; exit 0
shift; . "$(pwd)/toolchain/bootstrap/precheck.sh" "$@"; exit 0
fi

mkdir -p "$(pwd)/build"

. "$(pwd)/toolchain/bootstrap/cmake.sh"
. "$(pwd)/toolchain/bootstrap/python.sh"
. "$(pwd)/toolchain/bootstrap/python.sh" "$@"

# init command: just bootstrap the environment and exit (no Python command)
if [ "$1" '==' 'init' ]; then
Expand All @@ -108,7 +84,16 @@ fi
echo

# Run the main.py bootstrap script
python3 "$(pwd)/toolchain/main.py" "$@"
# If only flags given (no command), show help without passing flags
has_command=false
for arg in "$@"; do
case "$arg" in -*) ;; *) has_command=true; break ;; esac
done
if [ "$has_command" = true ]; then
python3 "$(pwd)/toolchain/main.py" "$@"
else
python3 "$(pwd)/toolchain/main.py"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
code=$?

echo
Expand Down
79 changes: 79 additions & 0 deletions toolchain/bootstrap/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
# MFC Shell Completion Auto-installer
#
# This script handles automatic installation and updating of shell completions.
# It is sourced by mfc.sh on startup.
#
# Features:
# - Auto-detects bash vs zsh
# - Installs completions to ~/.local/share/mfc/completions/
# - Updates completions when source files change
# - Configures shell rc files on first install
# - Sources completions immediately when mfc.sh is sourced

_mfc_setup_completions() {
local MFC_ROOT="$1"
local COMPLETION_DIR="$HOME/.local/share/mfc/completions"
local COMPLETION_SRC="$MFC_ROOT/toolchain/completions"
local COMPLETION_FILE SOURCE_FILE RC_FILE RC_LINE SOURCE_CMD

# Detect shell: use ZSH_VERSION (current shell) rather than $SHELL (login shell)
if [ -n "${ZSH_VERSION-}" ]; then
Comment thread
sbryngelson marked this conversation as resolved.
Outdated
COMPLETION_FILE="$COMPLETION_DIR/_mfc"
SOURCE_FILE="$COMPLETION_SRC/_mfc"
RC_FILE="$HOME/.zshrc"
RC_LINE="fpath=(\"$COMPLETION_DIR\" \$fpath)"
SOURCE_CMD="source $COMPLETION_DIR/_mfc"
Comment thread
sbryngelson marked this conversation as resolved.
else
COMPLETION_FILE="$COMPLETION_DIR/mfc.bash"
SOURCE_FILE="$COMPLETION_SRC/mfc.bash"
RC_FILE="$HOME/.bashrc"
RC_LINE="[ -f \"$COMPLETION_DIR/mfc.bash\" ] && source \"$COMPLETION_DIR/mfc.bash\""
SOURCE_CMD="source $COMPLETION_DIR/mfc.bash"
fi

# Check if we need to install or update
local COMPLETIONS_CHANGED=false

# Only proceed if source completion files exist (they're generated by ./mfc.sh generate)
if [ ! -f "$COMPLETION_SRC/mfc.bash" ] || [ ! -f "$COMPLETION_SRC/_mfc" ]; then
return
fi

if [ ! -f "$COMPLETION_FILE" ]; then
# Fresh install
mkdir -p "$COMPLETION_DIR"
cp "$COMPLETION_SRC/mfc.bash" "$COMPLETION_DIR/"
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
cp "$COMPLETION_SRC/_mfc" "$COMPLETION_DIR/"
COMPLETIONS_CHANGED=true

# Add to shell rc file on first install
if [ -f "$RC_FILE" ] && ! grep -q "$COMPLETION_DIR" "$RC_FILE" 2>/dev/null; then
echo "" >> "$RC_FILE"
echo "# MFC shell completion" >> "$RC_FILE"
echo "$RC_LINE" >> "$RC_FILE"
fi
elif [ "$SOURCE_FILE" -nt "$COMPLETION_FILE" ]; then
# Update outdated completions
cp "$COMPLETION_SRC/mfc.bash" "$COMPLETION_DIR/"
cp "$COMPLETION_SRC/_mfc" "$COMPLETION_DIR/"
COMPLETIONS_CHANGED=true
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
sbryngelson marked this conversation as resolved.

# Notify user about changes
if [ "$COMPLETIONS_CHANGED" = true ]; then
if [[ "${BASH_SOURCE[1]}" != "${0}" ]] 2>/dev/null; then
# Script is being sourced - activate completions now
# shellcheck disable=SC1090
source "$COMPLETION_FILE" 2>/dev/null && log "Tab completions activated."
else
# Script is being executed - can't modify parent shell
log "Tab completions updated. Run:$MAGENTA $SOURCE_CMD$COLOR_RESET"
Comment thread
sbryngelson marked this conversation as resolved.
fi
Comment thread
sbryngelson marked this conversation as resolved.
fi
Comment thread
sbryngelson marked this conversation as resolved.
}

# Run setup if this script is sourced with MFC_ROOT_DIR set
if [ -n "$1" ]; then
_mfc_setup_completions "$1"
fi
22 changes: 16 additions & 6 deletions toolchain/bootstrap/python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/

next_arg=0
nthreads=1
verbose=0
for arg in "$@"; do
if [ "$arg" == "-j" ] || [ "$arg" == "--jobs" ]; then
next_arg=1
Expand All @@ -148,6 +149,10 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/
nthreads=$arg
continue
fi
# Check for verbosity flags
if [ "$arg" == "-v" ] || [ "$arg" == "-vv" ] || [ "$arg" == "-vvv" ] || [ "$arg" == "--verbose" ]; then
verbose=1
fi
done

# Run package installer and show progress
Expand All @@ -173,12 +178,12 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/

# Use uv if available, otherwise fall back to pip
if [ "$USE_UV" = "1" ]; then
# uv is much faster and has its own progress display - show it
# UV_LINK_MODE=copy avoids slow hardlink failures on cross-filesystem installs (common on HPC)
export UV_LINK_MODE=copy
log "(venv) Using$MAGENTA uv$COLOR_RESET for fast installation..."
if [ -t 1 ]; then
# Interactive terminal: show uv's native progress

if [ "$verbose" = "1" ]; then
# Verbose mode: show full uv output
if uv pip install "$(pwd)/toolchain"; then
ok "(venv) Installation succeeded."
cp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/"
Expand All @@ -189,13 +194,18 @@ if ! cmp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/pyproject.toml" > /dev/
exit 1
fi
else
# Non-interactive: capture output for logging
if uv pip install "$(pwd)/toolchain" > "$PIP_LOG" 2>&1; then
# Default: show progress but filter out individual package lines (+ pkg==ver)
uv pip install "$(pwd)/toolchain" > "$PIP_LOG" 2>&1
UV_EXIT=$?
# Show filtered output (progress info without package list)
# Filter out lines like " + pkg==1.0", " - pkg==1.0", " ~ pkg==1.0"
grep -v '^ [+~-] ' "$PIP_LOG" || true
if [ $UV_EXIT -eq 0 ]; then
rm -f "$PIP_LOG"
ok "(venv) Installation succeeded."
cp "$(pwd)/toolchain/pyproject.toml" "$(pwd)/build/"
else
error "(venv) Installation failed. See output below:"
error "(venv) Installation failed. Full output:"
echo ""
cat "$PIP_LOG"
echo ""
Expand Down
Loading
Loading