Repository navigation
feat(heal): scripts/heal.py becomes a heal-service client - #22
Merged
Merged
Conversation
Returns the locator of the page's language, and the first entry (the original copy) for any other language. The page fixture records the language on async pages.
…an green run Off unless HEAL_FINGERPRINTS=on. Writes .heal/fingerprints.json atomically with an automatic .heal/.gitignore (*); committing it is an opt-in. Only clean green tests (passed once, not flaky, not during a heal) are recorded; never input values.
Adds utils/heal_client.py (request building, live count/element check, patch safety, try->result loop) and removes the direct model call, its prompt and the HEAL_BASE_URL / HEAL_MODEL / HEAL_API_KEY settings. A service error becomes a needs_human decision, failures past --max are recorded, decisions print with token usage, and heal-summary.json is written to the test artifacts directory.
Redact typed values and allowlist inventory keys before anything is sent; reject comments and control characters in replacements; require the original span to be a locator chain that is exactly one AST node; write only the locator that was checked live (also-patches included); vendor the probe and block foreign origins while it runs; revert partial writes, keep file modes, never write through symlinks; refuse a bearer token over http to a remote host; optional hashed fingerprint copy; escape markdown in PR bodies; validate HEAL_DIR and HEAL_SOURCE_ROOTS; detect the helper import by AST.
…rror, not a crash
…s a full translation again
|
✅ All smoke tests passed! View report |
Owner
Author
|
No changes needed: the only feedback on this PR is the github-actions smoke-pass notice (lint, unit, smoke, setup and semgrep all green) and a Copilot review that didn't run because of quota. There's no review comment to act on, so I made no commit. The |
|
✅ All chromium login tests passed! View report |
|
✅ All firefox login tests passed! View report |
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.
scripts/heal.pybecomes a client of the heal service (spec:docs/HEAL_SERVICE_SPEC.md, in a separate PR). The framework no longer holds a model URL, a model name, a prompt or any parsing of model replies; a unit test checks that none of them come back.Do not merge before the heal service's phase 1 is merged. The service is not public yet, so the integration test skips in CI with a stated reason.
What changes
scripts/heal.py: same flags (-k,--max,--open-pr). It keeps the JUnit parse, the exact-test re-run, revert and the PR flow.heal-summary.json.--maxbecomes a recordedneeds_humandecision instead of a crash.utils/heal_client.py: builds the request (stack files under the source roots, capped, with sha256), probes the reopened failing route, sends the language signals, and runs the try → result loop.utils/heal_fingerprints.py: a pytest plugin, off unlessHEAL_FINGERPRINTS=on..heal/fingerprints.jsonand writes.heal/.gitignoreitself.HEAL_FINGERPRINT_COPY=offstores hashes of page copy instead of the copy.utils/heal_locale.py:by_language, for healed copy-based locators on a page in another language.utils/heal_probe.js: the in-page probe, vendored and byte-identical to the service's copy.Treating the service as untrusted
Every patch the service returns is checked before it touches a file. The client applies it only if all of these hold:
Other safeguards:
http://to a non-localhost host is refused unlessHEAL_ALLOW_INSECURE=1.A security review of this branch found five HIGH issues. All are fixed, each with a test written first (
tests/unit/test_heal_client_security.py).Tests
pytest tests/unit: 292 passed.ruff check .: clean.