-
Notifications
You must be signed in to change notification settings - Fork 0
test(browser): bind controlled result to semantic digest evidence #105
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
Merged
seonghobae
merged 8 commits into
test/agent-task-semantic-role-name-locator
from
test/agent-task-structured-value-evidence
Aug 26, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3eaf34b
test(browser): require structured result evidence
seonghobae d2e4086
feat(browser): name controlled result semantically
seonghobae 6800ef0
feat(browser): record bounded structured result evidence
seonghobae bc1d22d
docs: record structured browser result evidence
seonghobae 43ea212
merge: align structured Agent Task evidence with current semantic loc…
seonghobae cc187cd
chore(stack): converge structured-value evidence on current semantic …
seonghobae c3f14ab
fix(mv3): reuse one rss evidence snapshot
seonghobae 42908ad
fix(mv3): contain fixture server paths
seonghobae 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
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
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
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
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,66 @@ | ||
| """Contract for credential-safe structured extraction in the controlled Agent Task.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import hashlib | ||
| import pathlib | ||
| import runpy | ||
| import unittest | ||
|
|
||
| ROOT = pathlib.Path(__file__).resolve().parents[1] | ||
| RUNNER = ROOT / "scripts" / "ci" / "run_mv3_compatibility.py" | ||
| FIXTURE = ROOT / "tests" / "fixtures" / "agent_task_basic" / "index.html" | ||
|
|
||
|
|
||
| class AgentTaskStructuredValueContractTests(unittest.TestCase): | ||
| """Require bounded semantic extraction without retaining the extracted value.""" | ||
|
|
||
| def test_result_is_discovered_by_exact_browser_semantics(self) -> None: | ||
| """The result node must be located by browser-computed role/name, not fixture CSS.""" | ||
|
|
||
| runner = RUNNER.read_text(encoding="utf-8") | ||
| fixture = FIXTURE.read_text(encoding="utf-8") | ||
| self.assertIn('aria-label="Task result"', fixture) | ||
| self.assertIn('"status"', runner) | ||
| self.assertIn('"Task result"', runner) | ||
| self.assertIn('"result_semantics_verified"', runner) | ||
| self.assertNotIn('_find_element(driver_port, session_id, "#task-result")', runner) | ||
|
|
||
| def test_structured_value_hash_is_bounded_and_canonical(self) -> None: | ||
| """Only a canonical SHA-256 digest may leave the controlled extraction boundary.""" | ||
|
|
||
| namespace = runpy.run_path(str(RUNNER), run_name="agent_task_structured_value_contract") | ||
| self.assertIn("MAX_AGENT_TASK_STRUCTURED_VALUE_BYTES", namespace) | ||
| self.assertIn("_hash_agent_task_structured_value", namespace) | ||
| helper = namespace["_hash_agent_task_structured_value"] | ||
| maximum = namespace["MAX_AGENT_TASK_STRUCTURED_VALUE_BYTES"] | ||
|
|
||
| value = "synthetic structured value" | ||
| expected = "sha256:" + hashlib.sha256(value.encode("utf-8")).hexdigest() | ||
| digest = helper(value) | ||
| self.assertEqual(digest, expected) | ||
| self.assertNotIn(value, digest) | ||
| self.assertEqual(len(digest), len("sha256:") + 64) | ||
|
|
||
| with self.assertRaises(ValueError): | ||
| helper("") | ||
| with self.assertRaises(ValueError): | ||
| helper("x" * (maximum + 1)) | ||
| with self.assertRaises(TypeError): | ||
| helper(42) | ||
|
|
||
| def test_agent_task_evidence_reports_field_and_digest_not_raw_result(self) -> None: | ||
| """Trial evidence must expose a field identifier and digest, not extracted text.""" | ||
|
|
||
| runner = RUNNER.read_text(encoding="utf-8") | ||
| for expected in ( | ||
| '"structured_value_field"', | ||
| '"structured_value_sha256"', | ||
| '"task_result"', | ||
| ): | ||
| with self.subTest(expected=expected): | ||
| self.assertIn(expected, runner) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
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
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.
Uh oh!
There was an error while loading. Please reload this page.