-
Notifications
You must be signed in to change notification settings - Fork 0
Phase III U2 Safety Envelope & Type-Verified Runner Surface #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6f5241e
Initial plan
Copilot 868a377
experiments/u2: implement core safety infrastructure with tests
Copilot 830f7f1
experiments/u2: add mypy config, CI guide, and performance tests
Copilot 27f5d92
experiments/u2: add implementation summary documentation
Copilot de0c4b6
experiments/u2: fix typing compatibility issues from code review
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
.github/workflows/u2-safety-gate.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: U2 Safety Gate | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'experiments/u2/**' | ||
| - 'tests/test_u2*.py' | ||
| - 'pyproject.toml' | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'copilot/**' | ||
|
|
||
| jobs: | ||
| type-check: | ||
| name: Type Safety Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install mypy pytest pyyaml pydantic typing-extensions | ||
|
|
||
| - name: Run mypy on U2 modules | ||
| run: | | ||
| mypy experiments/u2/ --config-file pyproject.toml | ||
|
|
||
| - name: Fail if mypy errors | ||
| if: failure() | ||
| run: | | ||
| echo "::error::Type checking failed for U2 modules" | ||
| exit 1 | ||
|
|
||
| safety-tests: | ||
| name: Safety & Performance Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install pytest pyyaml pydantic typing-extensions | ||
|
|
||
| - name: Run U2 tests | ||
| run: | | ||
| pytest tests/test_u2*.py -v | ||
|
|
||
| - name: Check test results | ||
| if: failure() | ||
| run: | | ||
| echo "::error::U2 tests failed" | ||
| exit 1 | ||
|
|
||
| - name: Run performance guardrail tests | ||
| run: | | ||
| pytest tests/test_u2_perf_guardrails.py -v | ||
|
|
||
| - name: Check safety envelope smoke test | ||
| run: | | ||
| python3 -c " | ||
| from experiments.u2.entrypoint import run_u2_experiment | ||
| from experiments.u2.runner import U2Config | ||
| from experiments.u2.safety_envelope import evaluate_safety_status | ||
|
|
||
| # Quick smoke test | ||
| config = U2Config( | ||
| experiment_id='ci_smoke', | ||
| slice_name='test', | ||
| mode='baseline', | ||
| total_cycles=5, | ||
| master_seed=42 | ||
| ) | ||
|
|
||
| def mock_exec(item, seed): | ||
| return True, {'ok': True} | ||
|
|
||
| results, envelope = run_u2_experiment( | ||
| config=config, | ||
| items=['a', 'b', 'c'], | ||
| execute_fn=mock_exec | ||
| ) | ||
|
|
||
| if not evaluate_safety_status(envelope): | ||
| raise RuntimeError(f'Safety envelope BLOCKED: {envelope.warnings}') | ||
|
|
||
| print(f'✓ Safety status: {envelope.safety_status}') | ||
| print(f'✓ Completed {len(results)} cycles') | ||
| print(f'✓ Performance OK: {envelope.perf_ok}') | ||
| " |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.