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
2 changes: 1 addition & 1 deletion .github/workflows/castiron-custom-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: false

env:
REPORTER_SHA256: d92cc331cea526bb3230ea4b0c2430ad974338a8373134e0b07b3a1ad3535e2a
REPORTER_SHA256: 249f5d2f90f1c66d9ac143c875a3ceac4b0edbce4e67fd0e84524f239d50315c

jobs:
queue-signal:
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dev = [
"rich>=13.7.1",
"inline-snapshot>=0.28.0",
"azure-identity >=1.14.1",
"botocore==1.42.97",
"botocore==1.43.106",
"pandas-stubs >= 1.1.0.11",
"trio >=0.22.2",
"pytest-xdist>=3.6.1",
Expand All @@ -70,12 +70,12 @@ pydantic-v1 = ["pydantic>=1.10.26,<2"]
pydantic-v2 = ["pydantic>=2,<3"]
# Isolated build requirements are exported with hashes by scripts/build.
build = [
"hatchling==1.27.0",
"hatchling==1.32.4",
"packaging==26.3",
"pathspec==1.1.1",
"pluggy==1.6.0",
"tomli==2.4.1; python_version < '3.11'",
"trove-classifiers==2026.6.1.19",
"trove-classifiers==2026.9.21.13",
]

[tool.uv]
Expand All @@ -98,17 +98,17 @@ constraint-dependencies = [
]
# Also constrain editable/source builds performed by uv sync.
build-constraint-dependencies = [
"hatchling==1.27.0",
"hatchling==1.32.4",
"packaging==26.3",
"pathspec==1.1.1",
"pluggy==1.6.0",
"tomli==2.4.1; python_version < '3.11'",
"trove-classifiers==2026.6.1.19",
"trove-classifiers==2026.9.21.13",
]


[build-system]
requires = ["hatchling==1.27.0"]
requires = ["hatchling==1.32.4"]
build-backend = "hatchling.build"

[tool.hatch.build]
Expand Down
5 changes: 2 additions & 3 deletions scripts/castiron/custom_code_budget.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def read_budget(repo: Path, revision: str) -> int:
report.git(repo, "show", f"{revision}:{POLICY}"), object_pairs_hook=unique_keys
)
if not isinstance(value, dict):
raise ValueError("budget file must be an object")
raise ValueError("budget file must be an object") # noqa: TRY004 - malformed policy is a value error
value = cast(dict[str, Any], value)
if set(value) != {"schema_version", "max_custom_patch_lines"}:
raise ValueError("budget file must contain only schema_version and max_custom_patch_lines")
Expand Down Expand Up @@ -424,8 +424,7 @@ def main() -> int:
write_result(args.out, result, patch)
if args.command == "github" and "GITHUB_OUTPUT" in os.environ:
with Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:
for name in ("isolation", "budget"):
output.write(f"{name}={result['checks'][name]['state']}\n")
output.writelines(f"{name}={result['checks'][name]['state']}\n" for name in ("isolation", "budget"))
output.write(f"base_sha={result.get('base_sha', '')}\n")
output.write(f"head_sha={result.get('head_sha', '')}\n")
return 0 if all(c["state"] == "success" for c in result["checks"].values()) else 1
Expand Down
3 changes: 1 addition & 2 deletions scripts/castiron/custom_code_report.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def git(repo: Path, *args: str, input_bytes: bytes | None = None) -> bytes:
result = subprocess.run(
["git", "--no-replace-objects", "-C", str(repo), *args],
input=input_bytes,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
env=env,
check=False,
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/castiron/test_custom_code_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_cli_executes_trusted_reporter_not_inspected_repo(self) -> None:
"--out",
str(out),
]
completed = subprocess.run(command, cwd=self.repo, capture_output=True, text=True)
completed = subprocess.run(command, cwd=self.repo, capture_output=True, text=True, check=False)
self.assertEqual(completed.returncode, 0, completed.stderr + completed.stdout)
self.assertEqual(json.loads((out / "budget.json").read_text())["total"], 0)

Expand Down
4 changes: 2 additions & 2 deletions scripts/castiron/test_custom_code_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

import json
import os
import tempfile
import sys
import tempfile
import unittest
from pathlib import Path
from typing import Any
from unittest import mock

import custom_code_report as report
import custom_code_budget as budget
import custom_code_report as report
from custom_code_test_support import GENERATION, GitTestCase, source_run

REPOSITORY = "openai/example"
Expand Down
1 change: 0 additions & 1 deletion scripts/castiron/test_custom_code_publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import custom_code_report as report
from custom_code_test_support import GitTestCase, source_run


WORKFLOW = (
Path(__file__).resolve().parents[2] / ".github/workflows/castiron-custom-code-comment.yml"
)
Expand Down
3 changes: 1 addition & 2 deletions scripts/castiron/test_custom_code_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import struct
import subprocess
import unittest
import unittest.mock as mock
from unittest import mock

import custom_code_report as report

from custom_code_test_support import GENERATION, GitTestCase


Expand Down
6 changes: 3 additions & 3 deletions tests/lib/chat/test_completions_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
external,
snapshot,
outsource, # pyright: ignore[reportUnknownVariableType]
get_snapshot_value,
get_snapshot_value, # pyright: ignore[reportUnknownVariableType]
)

import openai
Expand Down Expand Up @@ -1170,7 +1170,7 @@ def _on_response(response: httpx2.Response) -> None:
respx2_mock.post("/chat/completions").mock(
return_value=httpx2.Response(
200,
content=get_snapshot_value(content_snapshot),
content=cast("str | bytes", get_snapshot_value(content_snapshot)),
headers={"content-type": "text/event-stream"},
)
)
Expand Down Expand Up @@ -1217,7 +1217,7 @@ def _on_response(response: httpx2.Response) -> None:
respx2_mock.post("/chat/completions").mock(
return_value=httpx2.Response(
200,
content=get_snapshot_value(content_snapshot),
content=cast("str | bytes", get_snapshot_value(content_snapshot)),
headers={"content-type": "text/event-stream"},
)
)
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import os
import json
from typing import Any, Callable, Awaitable
from typing import Any, Callable, Awaitable, cast
from typing_extensions import TypeVar

import httpx2
from inline_snapshot import get_snapshot_value
from inline_snapshot import get_snapshot_value # pyright: ignore[reportUnknownVariableType]

from openai import OpenAI, AsyncOpenAI
from tests.respx2 import MockRouter
Expand Down Expand Up @@ -42,7 +42,7 @@ def _on_response(response: httpx2.Response) -> None:
respx2_mock.post(path).mock(
return_value=httpx2.Response(
200,
content=get_snapshot_value(content_snapshot),
content=cast("str | bytes", get_snapshot_value(content_snapshot)),
headers={"content-type": "application/json"},
)
)
Expand Down Expand Up @@ -85,7 +85,7 @@ async def _on_response(response: httpx2.Response) -> None:
respx2_mock.post(path).mock(
return_value=httpx2.Response(
200,
content=get_snapshot_value(content_snapshot),
content=cast("str | bytes", get_snapshot_value(content_snapshot)),
headers={"content-type": "application/json"},
)
)
Expand Down
Loading
Loading