Validation: add structured author diagnostics and remediation#952
Validation: add structured author diagnostics and remediation#952zkwentz wants to merge 1 commit into
Conversation
thegovind
left a comment
There was a problem hiding this comment.
I found two issues in the new remediation contract; the first is a credential-exposure blocker.
-
The URL guard checks
parsed.usernameby truthiness, sohttps://:secret@example.com/guideis accepted (username == "",password == "secret").to_dict()redacts it, but the human formatter printsremediation.urldirectly, soopenenv validateemits the credential. I reproduced the full output. Please reject any URL whereparsed.username is not Noneorparsed.password is not None, and render the sanitized value fromsafe_remediation["url"]rather than the raw field. -
ValidationRemediation.kindis not yet a reliable typed contract.kind="documentation"without a URL andkind="edit"without a path are both accepted, and fields from unrelated kinds can coexist. The renderer then chooses behavior from whichever field happens to be present instead of fromkind, producing non-actionable or misleading guidance. Please enforce kind-specific required/forbidden fields (or model these as a discriminated union): command→argv, documentation→url, edit→path, retry→no destination.
Alignment flag: the first issue violates the no-credential-exposure invariant. Suggested reviewers: @zkwentz and @Darktex.
What & Why
A failed gate is only useful if an environment author or agent can act on it. This PR adds typed diagnostics, repository-relative locations, and trusted remediation to both JSON and human reports.
Risk & Review Guidance
src/openenv/validation/models.py:104for locations/validation;src/openenv/validation/models.py:158for remediation safety;src/openenv/validation/local.py:534for human renderingDecisions & Alternatives
Verification
PYTHONPATH=src:envs .venv/bin/python -m pytest tests/ -q -m 'not integration'— 1,559 passed, 114 skipped, 31 external integration tests deselected on the complete stack.Scope & Non-Goals
Stack
PR 11 of 17; depends on #951.
Full 17-PR stack
All upstream PRs remain draft while RFC 008 is under review.