fix(crane): block incomplete parity completion#100
Merged
Conversation
26d36c4 to
f5c780b
Compare
Contributor
Migration Benchmark Results
Migration CLI BenchmarkMax allowed Go/Python median ratio:
|
Contributor
Migration Benchmark Results
Migration CLI BenchmarkMax allowed Go/Python median ratio:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix(crane): block incomplete parity completion
TL;DR
This PR fixes the false-completion path for the Python-to-Go Crane migration. An
intentionally-incompletebehavior contract manifest can still produce progress reports, but it can no longer satisfy the completion gate or let the scorer reach deletion-grade readiness.It also restores #78 to active migration state by ensuring the code now treats the current missing coverage as incomplete instead of complete.
Problem (WHY)
crane-completedeven thoughtests/parity/python_contract_coverage.ymlexplicitly says the manifest isintentionally-incomplete.TestParityCompletionPythonBehaviorContractscould pass without any command or Python-test mappings.Approach (WHAT)
checkstrict by default; add--allow-intentionally-incompleteonly for report-only summaries.python_behavior_contractsCrane gate event withpassing: 0/1or1/1; hard-fail only when enforcement is requested.status: intentionally-incompleteis never completion evidence.Implementation (HOW)
.crane/scripts/score.go: factors gate parsing/application, reads gate events embedded ingo test -jsonoutput, and defaultspython_behavior_contractsto failing when no explicit gate event appears.cmd/apm/python_behavior_contracts_test.go: emits a Crane ratio gate before reporting or passing the behavior-contract completion test;APM_ENFORCE_PYTHON_BEHAVIOR_CONTRACTS=1turns incomplete progress into a hard failure.scripts/ci/python_behavior_contracts.py: keeps report-only behavior behind--allow-intentionally-incomplete; strict mode now fails if the manifest still declaresstatus: intentionally-incomplete..github/workflows/migration-ci.yml: uses report-only mode only for the uploaded coverage summary.tests/unit/test_crane_score.py: verifies the scorer cannot reach 1.0 from completion test names alone and blocks explicit incomplete behavior gates.tests/parity/test_python_behavior_contracts.pyandtests/parity/README.md: make incomplete coverage an expected tracking result by default and a hard failure when enforcement is requested.Flow
Completion now needs strict checker success plus an explicit scorer gate event.
flowchart TD A["Extract Python behavior inventory"] --> B["Check coverage manifest"] B --> C{"status: intentionally-incomplete?"} C -->|yes, strict mode| D["Fail behavior-contract gate"] C -->|yes, report-only flag| E["Write summary only"] C -->|no missing findings| F["Emit passing gate event"] D --> G["migration_score < 1.0"] F --> H["Scorer may consider deletion-grade readiness"]Trade-offs
Benefits
migration_score: 1.0while the behavior manifest is declared incomplete.python_behavior_contractsgate result instead of relying on test-name inference.Validation
Scenario Evidence
tests/unit/test_crane_score.py19 passedpython_behavior_contracts.py checkpython_behavior_contracts.py check --allow-intentionally-incompletego test ./cmd/apm -run TestParityCompletionPythonBehaviorContractsgo test ./cmd/apm -run TestParityCompletionPythonBehaviorContractswithAPM_PYTHON_CONTRACT_INVENTORYpassing:0,total:1gateAPM_ENFORCE_PYTHON_BEHAVIOR_CONTRACTS=1Command output
How to test
UV_CACHE_DIR=/private/tmp/apm-uv-cache /Users/mrjf/.local/bin/uv run --extra dev pytest tests/unit/test_crane_score.py -q.UV_CACHE_DIR=/private/tmp/apm-uv-cache /Users/mrjf/.local/bin/uv run ruff check scripts/ci/python_behavior_contracts.py tests/parity/test_python_behavior_contracts.py tests/unit/test_crane_score.py.python_behavior_contracts.py checkand confirm it fails while the manifest is incomplete.--allow-intentionally-incompleteand confirm it exits 0 for report generation only.APM_ENFORCE_PYTHON_BEHAVIOR_CONTRACTS=1to confirm tracking passes and enforcement fails.crane-migrationand notcrane-completed.