Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .claude/skills/hil-contract/scripts/agentrc_pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def pin():
except (OSError, ValueError, RecursionError) as e:
raise PinError(f'{PIN_FILE} is not readable JSON ({e})') from None
url, commit = (data.get('url'), data.get('commit')) if isinstance(data, dict) else (None, None)
if not isinstance(url, str) or not url or not isinstance(commit, str) or not re.fullmatch(r'[0-9a-f]{40}', commit):
if (not isinstance(url, str) or not url.strip()
or not isinstance(commit, str) or not re.fullmatch(r'[0-9a-f]{40}', commit)):
raise PinError(f'{PIN_FILE} names no {{url, commit}} with a 40-hex commit ({data!r})')
return url, commit

Expand Down
3 changes: 2 additions & 1 deletion .claude/test/test_agentrc_pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def test_the_repository_pin_is_valid(self):
def test_a_missing_or_malformed_pin_is_refused_by_pin_and_check(self):
good = {'url': 'https://example.invalid/agentrc.git', 'commit': '0' * 40}
cases = {'missing': None, 'not json': '{', 'a list': '[]', 'no commit': {'url': good['url']},
'no url': {'commit': good['commit']}, 'a short commit': {**good, 'commit': 'abc123'},
'no url': {'commit': good['commit']}, 'a blank url': {**good, 'url': ' '},
'a short commit': {**good, 'commit': 'abc123'},
'a non-hex commit': {**good, 'commit': 'g' * 40}, 'a numeric commit': {**good, 'commit': 1}}
self.env(CI='true')
for name, content in cases.items():
Expand Down
Loading