Skip to content

Commit 0a9a3c6

Browse files
authored
Merge pull request #205 from TIGER-AI-Lab/fix/201-task-mismatch
Fix/201 task mismatch
2 parents 8e19b25 + cbac778 commit 0a9a3c6

15 files changed

Lines changed: 185 additions & 81 deletions

File tree

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: validate-task
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- ".github/workflows/validate-task.yml"
8+
- "test-cases/task.schema.json"
9+
- "test-cases/**/task.json"
10+
- "test-cases/**/extra_info/**"
11+
push:
12+
branches: [main]
13+
paths:
14+
- ".github/workflows/validate-task.yml"
15+
- "test-cases/task.schema.json"
16+
- "test-cases/**/task.json"
17+
- "test-cases/**/extra_info/**"
18+
workflow_dispatch:
19+
20+
jobs:
21+
validate-task:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v6
31+
with:
32+
python-version: "3.11"
33+
34+
- name: Install validator
35+
run: python -m pip install "jsonschema==4.26.0"
36+
37+
- name: Collect changed task files
38+
id: changed
39+
shell: bash
40+
run: |
41+
set -euo pipefail
42+
43+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
44+
find test-cases -path "*/task.json" -o -path "*/extra_info/*" > changed-files.txt
45+
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
46+
base="${{ github.event.pull_request.base.sha }}"
47+
git diff --name-only "$base"...HEAD > changed-files.txt
48+
elif [[ "${{ github.event_name }}" == "push" && "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
49+
git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" > changed-files.txt
50+
else
51+
find test-cases -path "*/task.json" -o -path "*/extra_info/*" > changed-files.txt
52+
fi
53+
54+
echo "Changed files:"
55+
cat changed-files.txt
56+
57+
- name: Validate changed tasks
58+
run: |
59+
python - <<'PY'
60+
import json
61+
import sys
62+
from pathlib import Path
63+
64+
from jsonschema import Draft202012Validator
65+
66+
repo = Path(".")
67+
schema_path = repo / "test-cases" / "task.schema.json"
68+
changed_paths = [
69+
Path(line.strip())
70+
for line in Path("changed-files.txt").read_text().splitlines()
71+
if line.strip()
72+
]
73+
74+
schema = json.loads(schema_path.read_text())
75+
validator = Draft202012Validator(schema)
76+
77+
validate_all = schema_path in changed_paths
78+
task_files: set[Path] = set()
79+
changed_json_files: set[Path] = set()
80+
81+
if validate_all:
82+
task_files.update(repo.glob("test-cases/**/task.json"))
83+
84+
for path in changed_paths:
85+
if not str(path).startswith("test-cases/"):
86+
continue
87+
if path.name == "task.json" and path.exists():
88+
task_files.add(path)
89+
changed_json_files.add(path)
90+
continue
91+
if "extra_info" in path.parts:
92+
extra_index = path.parts.index("extra_info")
93+
task_dir = Path(*path.parts[:extra_index])
94+
task_file = task_dir / "task.json"
95+
if task_file.exists():
96+
task_files.add(task_file)
97+
if path.suffix == ".json" and path.exists():
98+
changed_json_files.add(path)
99+
100+
errors: list[str] = []
101+
102+
for json_file in sorted(changed_json_files):
103+
try:
104+
json.loads(json_file.read_text())
105+
except Exception as exc:
106+
errors.append(f"{json_file}: invalid JSON: {exc}")
107+
108+
for task_file in sorted(task_files):
109+
try:
110+
task = json.loads(task_file.read_text())
111+
except Exception as exc:
112+
errors.append(f"{task_file}: invalid JSON: {exc}")
113+
continue
114+
115+
for error in sorted(validator.iter_errors(task), key=lambda item: list(item.path)):
116+
location = "/" + "/".join(str(part) for part in error.path)
117+
errors.append(f"{task_file}{location}: {error.message}")
118+
119+
extra_info = task.get("extra_info") or []
120+
if not isinstance(extra_info, list):
121+
continue
122+
for index, item in enumerate(extra_info):
123+
if not isinstance(item, dict) or not item.get("path"):
124+
continue
125+
extra_path = task_file.parent / item["path"]
126+
if not extra_path.exists():
127+
errors.append(
128+
f"{task_file}: extra_info[{index}].path does not exist: {item['path']}"
129+
)
130+
131+
if errors:
132+
print("Task validation failed:")
133+
for error in errors:
134+
print(f"- {error}")
135+
sys.exit(1)
136+
137+
print(f"Validated {len(task_files)} task file(s) and {len(changed_json_files)} changed JSON file(s).")
138+
PY
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"job_url": "https://boards.greenhouse.io/example/jobs/1234567",
2+
"job_url": "https://job-boards.greenhouse.io/codepath/jobs/4526154007",
33
"job_title": "Senior Software Engineer",
4-
"company": "Example Corp"
5-
}
4+
"company": "CodePath"
5+
}

test-cases/v1/086-job-search-hr-cv-autofill-greenhouse-meta/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
"task_id": 86,
55
"metaclass": "job-search-hr",
66
"class": "cv-autofill",
7-
"description": "Extract information from resume.pdf and fill out the Meta Senior Software Engineer application on Greenhouse",
7+
"description": "Extract information from resume.pdf and fill out the CodePath Senior Software Engineer application on Greenhouse",
88
"sites_involved": [
99
"greenhouse.com"
1010
],
11-
"platform": "greenhouse-meta",
11+
"platform": "greenhouse-codepath",
1212
"common_info": {
1313
"email_credentials": "credentials to use the assigned disposable email account",
1414
"user_info": "alex_green_personal_info.json; the dummy user's personal information",
1515
"user_resume": "PDF resume with disposable email account injected"
1616
}
1717
},
18-
"instruction": "Extract information from resume.pdf and fill out the Meta Senior Software Engineer application on Greenhouse",
18+
"instruction": "Extract information from resume.pdf and fill out the CodePath Senior Software Engineer application on Greenhouse",
1919
"eval_schema": {
2020
"url_pattern": "boards-api\\.greenhouse\\.io/v1/boards/.+/jobs/\\d+|job-boards\\.greenhouse\\.io/.+/jobs/\\d+",
2121
"method": "POST"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"job_url": "https://boards.greenhouse.io/example/jobs/1234567",
3-
"job_title": "Senior Software Engineer",
4-
"company": "Example Corp"
5-
}
2+
"job_url": "https://simplify.jobs/p/d4eaf15e-63f7-4024-931c-f8cb52184dc4/Applied-Scientist",
3+
"job_title": "Applied Scientist",
4+
"company": "Amazon"
5+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"review_text": "Excellent service and product quality. The user experience is intuitive and well-designed. Would recommend to colleagues.",
3-
"rating": 5,
3+
"rating": 4,
44
"pros": "Easy to use, great customer support, reliable service",
55
"cons": "Pricing could be more competitive for small teams"
66
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"project_type": "bathroom renovation",
3-
"description": "Full bathroom renovation for a standard-size condo bathroom (approx. 5x8 ft). Looking to replace the bathtub with a walk-in shower, update the vanity and mirror, install new tile flooring, and add a heated towel rack. Prefer modern minimalist style with neutral tones.",
4-
"budget_range": "$8,000 - $15,000 CAD",
5-
"timeline": "4-6 weeks",
6-
"location": "Toronto, ON (condo building)",
7-
"special_requirements": "Must comply with condo renovation rules. Need quiet hours (no work before 9am or after 5pm)."
8-
}
2+
"project_type": "research portfolio",
3+
"description": "Portfolio for tracking three 2026 research sub-projects: Scaling Laws Study, Agent Evaluation Benchmark, and Safety Red-Teaming.",
4+
"budget_range": "N/A",
5+
"timeline": "2026",
6+
"location": "Online",
7+
"special_requirements": "Create the portfolio named Research Projects 2026 and include the three sub-projects."
8+
}

test-cases/v1/501-creation-init-general-asana/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"extra_info": [
2828
{
2929
"path": "extra_info/project_description.json",
30-
"description": "Project description with scope, budget, and requirements"
30+
"description": "Portfolio and sub-project details"
3131
}
3232
]
3333
}
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
{
2-
"listing_title": "Bright 1BR in Toronto Annex, Furnished, July-August Sublet",
3-
"description": "Spacious furnished one-bedroom apartment in the heart of Toronto's Annex neighborhood. Walking distance to U of T campus, TTC subway, and Bloor Street shops and restaurants. The unit features hardwood floors, in-suite laundry, a fully equipped kitchen, and a sunny south-facing balcony. Perfect for visiting scholars or summer interns.",
4-
"price": 2400,
5-
"currency": "CAD",
6-
"period": "monthly",
7-
"available_from": "2026-07-01",
8-
"available_to": "2026-08-31",
9-
"furnished": true,
10-
"bedrooms": 1,
11-
"bathrooms": 1,
12-
"amenities": [
13-
"In-suite laundry",
14-
"Dishwasher",
15-
"Balcony",
16-
"Air conditioning",
17-
"WiFi included"
18-
],
19-
"photos": [
20-
"living_room.jpg",
21-
"bedroom.jpg",
22-
"kitchen.jpg",
23-
"balcony.jpg"
24-
],
2+
"listing_title": "Software Engineer",
3+
"company": "Pinecrest Tech",
4+
"location": "Toronto, ON",
5+
"salary_range": "$115,000 - $145,000 CAD",
6+
"description": "Pinecrest Tech is hiring a Software Engineer to build reliable web services and internal tools for AI product workflows.",
7+
"requirements": "3+ years of experience with Python or Go, TypeScript, cloud infrastructure, and relational databases.",
258
"contact_email": "alex.green.uoft@clawbench.cc"
26-
}
9+
}

test-cases/v1/566-job-search-hr-job-search-ziprecruiter/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"extra_info": [
2525
{
2626
"path": "extra_info/listing_details.json",
27-
"description": "Sublet listing details including description, amenities, and photos"
27+
"description": "Software Engineer job listing details"
2828
}
2929
]
3030
}
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
{
2-
"listing_title": "Bright 1BR in Toronto Annex, Furnished, July-August Sublet",
3-
"description": "Spacious furnished one-bedroom apartment in the heart of Toronto's Annex neighborhood. Walking distance to U of T campus, TTC subway, and Bloor Street shops and restaurants. The unit features hardwood floors, in-suite laundry, a fully equipped kitchen, and a sunny south-facing balcony. Perfect for visiting scholars or summer interns.",
4-
"price": 2400,
5-
"currency": "CAD",
6-
"period": "monthly",
7-
"available_from": "2026-07-01",
8-
"available_to": "2026-08-31",
9-
"furnished": true,
10-
"bedrooms": 1,
11-
"bathrooms": 1,
12-
"amenities": [
13-
"In-suite laundry",
14-
"Dishwasher",
15-
"Balcony",
16-
"Air conditioning",
17-
"WiFi included"
18-
],
19-
"photos": [
20-
"living_room.jpg",
21-
"bedroom.jpg",
22-
"kitchen.jpg",
23-
"balcony.jpg"
24-
],
2+
"listing_title": "Software Engineer",
3+
"company": "Pinecrest Tech",
4+
"location": "Toronto, ON",
5+
"salary_range": "$115,000 - $145,000 CAD",
6+
"description": "Pinecrest Tech is hiring a Software Engineer to build reliable web services and internal tools for AI product workflows.",
7+
"requirements": "3+ years of experience with Python or Go, TypeScript, cloud infrastructure, and relational databases.",
258
"contact_email": "alex.green.uoft@clawbench.cc"
26-
}
9+
}

0 commit comments

Comments
 (0)