HassamGani commited on
Queue: the person can still answer about the main job after a side job's late change
Browse filesA side job's change adds a phase after the main job's last one. The main job's human facts kept their own phase
lists, so in that last phase the person could no longer say who a vague exclusion meant or which customers were in
scope, and a fair clarifying question went unanswered. Facts live in the main job's last phase now stay live in the
phases after it.
- reorgbench/gen/queue.py +7 -1
- tests/test_generator.py +14 -0
reorgbench/gen/queue.py
CHANGED
|
@@ -477,12 +477,18 @@ def build_queue(seed: int, attempt: int = 0, split: str = "train") -> tuple[Task
|
|
| 477 |
"queue", "which jobs in the ops queue to do, sign-off, other requests in #ops-queue",
|
| 478 |
"Do the jobs in #ops-queue that the VP of Customer Success or the CFO signed off, unless one of them called "
|
| 479 |
"it off later. Leave anything else.")]
|
|
|
|
|
|
|
|
|
|
| 480 |
for j, (t, g) in enumerate(zip(tasks, gens)):
|
| 481 |
for f in t.human_facts:
|
| 482 |
if f.id in (SIGNOFF.id, CI.id):
|
| 483 |
continue
|
|
|
|
|
|
|
|
|
|
| 484 |
human.append(HumanFact(f"j{j}_{f.id}" if j else f.id, f"{g.story['subject']}: {f.about}",
|
| 485 |
-
f"For the {g.story['subject']}: {f.text}",
|
| 486 |
n = sum(len(g.cohort) for g in gens)
|
| 487 |
if shared:
|
| 488 |
ck = _settled_first(shared)
|
|
|
|
| 477 |
"queue", "which jobs in the ops queue to do, sign-off, other requests in #ops-queue",
|
| 478 |
"Do the jobs in #ops-queue that the VP of Customer Success or the CFO signed off, unless one of them called "
|
| 479 |
"it off later. Leave anything else.")]
|
| 480 |
+
# a side job's late change adds phases after the main job's last one; it doesn't touch the main job's scope, so
|
| 481 |
+
# whatever the person could say about the main job in its last phase they can still say then
|
| 482 |
+
last, extra = len(main.phases) - 1, list(range(len(main.phases), len(phases)))
|
| 483 |
for j, (t, g) in enumerate(zip(tasks, gens)):
|
| 484 |
for f in t.human_facts:
|
| 485 |
if f.id in (SIGNOFF.id, CI.id):
|
| 486 |
continue
|
| 487 |
+
ph = f.phases if j == 0 else None
|
| 488 |
+
if ph is not None and last in ph:
|
| 489 |
+
ph = [*ph, *extra]
|
| 490 |
human.append(HumanFact(f"j{j}_{f.id}" if j else f.id, f"{g.story['subject']}: {f.about}",
|
| 491 |
+
f"For the {g.story['subject']}: {f.text}", ph))
|
| 492 |
n = sum(len(g.cohort) for g in gens)
|
| 493 |
if shared:
|
| 494 |
ck = _settled_first(shared)
|
tests/test_generator.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
"""The generator: deterministic, held-out templates stay out of the public splits, and its knobs reach the tasks."""
|
| 2 |
|
|
|
|
|
|
|
| 3 |
import pytest
|
| 4 |
|
| 5 |
from reorgbench.gen import PUBLIC_SEEDS, QUEUE_SEEDS, TEMPLATES, Knobs, generate, generated_tasks
|
|
@@ -190,6 +192,18 @@ def test_ops_queue_runs_every_story_at_once():
|
|
| 190 |
assert {c.id for c in t.phases[-1].checkpoints if c.id.startswith("j1_")} - before
|
| 191 |
|
| 192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
def test_held_out_queue_takes_its_main_job_from_that_split(monkeypatch):
|
| 194 |
from reorgbench.gen import TEMPLATES
|
| 195 |
from reorgbench.gen.queue import generate_queue, sample
|
|
|
|
| 1 |
"""The generator: deterministic, held-out templates stay out of the public splits, and its knobs reach the tasks."""
|
| 2 |
|
| 3 |
+
import re
|
| 4 |
+
|
| 5 |
import pytest
|
| 6 |
|
| 7 |
from reorgbench.gen import PUBLIC_SEEDS, QUEUE_SEEDS, TEMPLATES, Knobs, generate, generated_tasks
|
|
|
|
| 192 |
assert {c.id for c in t.phases[-1].checkpoints if c.id.startswith("j1_")} - before
|
| 193 |
|
| 194 |
|
| 195 |
+
@pytest.mark.parametrize("seed", [3, 8, 10])
|
| 196 |
+
def test_queue_person_can_still_answer_about_the_main_job_after_a_side_job_change(seed):
|
| 197 |
+
# the side job's change is the last phase; what the person could say about the main job just before it, such
|
| 198 |
+
# as who a vague exclusion means, they can still say afterwards
|
| 199 |
+
from reorgbench.gen.queue import generate_queue
|
| 200 |
+
t = generate_queue(seed)
|
| 201 |
+
last = len(t.phases) - 1
|
| 202 |
+
main = [f for f in t.human_facts if not re.match(r"j\d+_", f.id) and f.phases is not None]
|
| 203 |
+
assert any(last - 1 in f.phases for f in main)
|
| 204 |
+
assert all(last in f.phases for f in main if last - 1 in f.phases)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
def test_held_out_queue_takes_its_main_job_from_that_split(monkeypatch):
|
| 208 |
from reorgbench.gen import TEMPLATES
|
| 209 |
from reorgbench.gen.queue import generate_queue, sample
|