fix(s42): close review WARN — hermetic dry-run env + scoped azure hint
Post-hoc /trekreview of S4.2 surfaced two confirmed findings; both closed via TDD. S42-001 (MAJOR): the new --live-dry-run CLI tests read PORTFOLIO_MODEL_MAP / PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT via resolve_model/AzureFoundryBackend but did not isolate them, so both arms inverted their rc in a Foundry-configured env. Add an autouse fixture that delenvs both, mirroring test_backends/test_preflight. S42-002 (MINOR): the --live-dry-run except ValueError attached the azure-preflight remediation to every offline-path ValueError (unknown project_id, empty docs_dir, bundle mismatch). Scope the hint to args.profile == "azure"; structured refusal + rc 1 preserved for all. New test proves a LOCAL unknown-project refusal carries no azure hint. Gate: pytest 358 passed / 4 skipped, ruff check + format clean, mypy 24 files.
This commit is contained in:
parent
d7313593bc
commit
ce5b1151c8
2 changed files with 46 additions and 6 deletions
|
|
@ -652,12 +652,17 @@ def main(argv: list[str] | None = None) -> int:
|
|||
)
|
||||
)
|
||||
except ValueError as exc:
|
||||
print(
|
||||
f"live-dry-run refused: {exc}\n"
|
||||
"kjør 'python -m portfolio_optimiser.preflight --profile azure' først "
|
||||
"(S4.1 offline config-gate)",
|
||||
file=sys.stderr,
|
||||
)
|
||||
# Structured refusal (rc 1, no traceback) for ANY offline-path ValueError. The
|
||||
# azure-preflight remediation is only meaningful for the AZURE config gate (S4.1), so
|
||||
# scope it to that profile — a LOCAL-profile ValueError (unknown project_id, empty
|
||||
# docs_dir, bundle mismatch) must not carry an irrelevant azure hint.
|
||||
msg = f"live-dry-run refused: {exc}"
|
||||
if args.profile == "azure":
|
||||
msg += (
|
||||
"\nkjør 'python -m portfolio_optimiser.preflight --profile azure' først "
|
||||
"(S4.1 offline config-gate)"
|
||||
)
|
||||
print(msg, file=sys.stderr)
|
||||
return 1
|
||||
assert isinstance(report, DryRunReport) # live_dry_run=True always returns a DryRunReport
|
||||
print(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue