Repository navigation
Reject check receipts when declared inputs cannot be verified #1440
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -326,6 +326,10 @@ def _check_report_problem( | |
| return f"check receipt is missing its settings fingerprint. {recovery}" | ||
| if report.settings_sha256 != sandbox.settings_fingerprint(config, wt): | ||
| return f"check receipt has an incompatible settings fingerprint. {recovery}" | ||
| if not sandbox.receipt_inputs_match(config, wt, report): | ||
| return ("declared input keys changed or are unavailable; run loopzero check at this head. " | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Recovery guidance omits the oversized-pathspec cause
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The ready/merge error message leaves out the oversized-pathspec recovery that the docs now describe The new text in docs/ARCHITECTURE.md lists three ways to recover when keys are unavailable: restore the base, narrow oversized pathspecs, or narrow declarations that match unreadable or non-regular paths. The code supports all three: The error message users actually see, at cli.py:330-332, only covers the base and the readable-regular-files cases. A user who hits E2BIG would rerun Smallest fix: add "and pathspecs are not oversized" (or similar) to that message so it matches the docs. Separately, the doc sentence "narrow oversized pathspecs and declarations that match unreadable or non-regular paths" is hard to parse; splitting it into two clauses would make it clearer. |
||
| "If keys remain unavailable, ensure the check base is available and " | ||
| "declared paths select only readable regular files.") | ||
| return None | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,8 +253,22 @@ def settings_fingerprint(config: Config, worktree: Path, *, base: str | None = N | |
| return hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest() | ||
|
|
||
|
|
||
| def _keyed_stage(config: Config, command: str) -> bool: | ||
| return command in config.inputs or "." in config.inputs.get("*", ()) | ||
|
|
||
|
|
||
| def receipt_inputs_match(config: Config, worktree: Path, report: CheckReport) -> bool: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Readiness now rehashes every declared input once per stage
|
||
| try: | ||
| base = _check_base(config, worktree) | ||
| return all(result.input_key is not None | ||
| and result.input_key == _input_key(config, worktree, result.command, base) | ||
| for result in report.results if _keyed_stage(config, result.command)) | ||
| except (SandboxUnavailable, OSError, _proc.ProcTimeout, _proc.ToolMissing): | ||
| return False | ||
|
|
||
|
|
||
| def _input_key(config: Config, worktree: Path, command: str, base: str) -> str | None: | ||
| if not base or (command not in config.inputs and "." not in config.inputs.get("*", ())): | ||
| if not base or not _keyed_stage(config, command): | ||
| return None | ||
| paths = (*config.inputs.get(command, ()), *config.inputs.get("*", ())) | ||
| # Empty pathspecs must not accidentally mean the whole tree. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.