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
7 changes: 5 additions & 2 deletions evals/policy-evaluation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ evals/policy-evaluation/
scenarios/
S-001-dependency-ownership.md # 最初の live scenario (PR #111 で昇格)
grade.sh # semantic grader (fixture **Answer:** ブロック本文を採点)
controls.sh # positive / negative / regression / contradictory control を 1 つで束ねる driver
controls.sh # positive / positive-transition / negative / regression / contradictory control を 1 つで束ねる driver
context-budget.sh # policy 評価時に渡す最小 context budget の sanity check
fixtures/
positive.md # current policy が意図する valid answer
positive-transition.md # transition 句 ("Projects v2 is display, but ...") を使い
# ながら Issue-side action を推奨する canonical 答え。
# contradictory への false-positive 分類抑止 (PR #98 #4026680617)
negative.md # 典型的だが policy 上誤っている naive answer (FAIL 必須)
regression.md # 過去に誤って通った broken answer / behavior (FAIL 必須)
contradictory.md # canonical-surface を肯定しつつ Projects-first write を
Expand All @@ -37,7 +40,7 @@ bash evals/policy-evaluation/controls.sh
bash evals/policy-evaluation/grade.sh path/to/fixture.md
```

`controls.sh` は negative / regression / contradictory / positive を順に実行し、negative / regression / contradictory が FAIL、positive が PASS することを assert する。
`controls.sh` は negative / regression / contradictory / positive / positive-transition を順に実行し、negative / regression / contradictory が FAIL、positive / positive-transition が PASS することを assert する。

## Grader の semantic 性

Expand Down
1 change: 1 addition & 0 deletions evals/policy-evaluation/context-budget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ required=(
"fixtures/negative.md"
"fixtures/regression.md"
"fixtures/contradictory.md"
"fixtures/positive-transition.md"
)

missing=()
Expand Down
38 changes: 27 additions & 11 deletions evals/policy-evaluation/controls.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
#!/usr/bin/env bash
# `policy-evaluation` Skill §4 (Grader controls) の negative /
# regression / contradictory / positive control を順に走らせる driver。
# regression / contradictory / positive-transition / positive
# control を順に走らせる driver。
#
# v0.4.0 では structural seed のため、各 fixture が「control として
# 期待通りに分離できる」こと (negative / regression / contradictory は
# FAIL シグナルを持ち、positive は PASS シグナルを持つ) を assert する。
# contradictory control は PR #98 review thread #4026270165 follow-up で
# 追加: canonical-surface marker を肯定しつつ Projects-first write を
# 戻す latent contradiction を独立に reject する。
# FAIL シグナルを持ち、positive / positive-transition は PASS シグナル
# を持つ) を assert する。contradictory control は PR #98 review thread
# #4026270165 follow-up で追加: canonical-surface marker を肯定しつつ
# Projects-first write を戻す latent contradiction を独立に reject する。
# positive-transition control は PR #98 thread #4026680617 follow-up で
# 追加: `Projects v2 is display, but ...` transition 句を使いながら実際は
# Issue-side action を推奨する canonical 答えを過剰に contradictory に
# 分類しない (false-positive 抑止) ことを assert する。
#
# 使い方:
# bash evals/policy-evaluation/controls.sh
#
# 終了コード:
# 0 — 4 control が期待通りに分離
# (negative=FAIL, regression=FAIL, contradictory=FAIL, positive=PASS)
# 1 — control 分離失敗 (grader が surface shape だけで PASS させた等)
# 0 — 5 control が期待通りに分離
# (negative=FAIL, regression=FAIL, contradictory=FAIL,
# positive=PASS, positive-transition=PASS)
# 1 — control 分離失敗
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Expand All @@ -42,8 +48,7 @@ if "$GRADER" "$DIR/fixtures/regression.md" >/dev/null; then
fi
echo "OK: regression control correctly rejected"

# 3. contradictory は FAIL しなければならない (canonical-surface 肯定 +
# projects-first paraphrase を併存する latent violation も単独で reject)
# 3. contradictory は FAIL しなければならない
if "$GRADER" "$DIR/fixtures/contradictory.md" >/dev/null; then
echo "FAIL: contradictory control unexpectedly PASSed" >&2
echo " grader is not separating canonical-surface affirmation from projects-first paraphrase" >&2
Expand All @@ -59,4 +64,15 @@ if ! "$GRADER" "$DIR/fixtures/positive.md" >/dev/null; then
fi
echo "OK: positive control correctly accepted"

echo "PASS: 4-control separation holds"
# 5. positive-transition は PASS しなければならない
# transition 句 ("Projects v2 is display, but ...") を使いながら
# 実際は Issue-side action を推奨する canonical 答えを、
# contradictory に false-positive 分類していないか確認。
if ! "$GRADER" "$DIR/fixtures/positive-transition.md" >/dev/null; then
echo "FAIL: positive-transition control unexpectedly rejected" >&2
echo " transition 句を持つ canonical 答えを contradictory に false-positive 分類している" >&2
exit 1
fi
echo "OK: positive-transition control correctly accepted"

echo "PASS: 5-control separation holds"
44 changes: 44 additions & 0 deletions evals/policy-evaluation/fixtures/positive-transition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Positive control — issue-side action after transition (PASS)

This fixture exercises a **canonical answer that uses a transition
phrase** ("Projects v2 is display, but ..."). The grader must
classify it as positive even though the `but` clause looks like the
shape that triggers `projects_first_paraphrase`. The `but` clause
recommends an **Issue-side** action, so the transition is consistent
with the canonical-surface invariant — not a contradiction.

This is the false-positive case PR #98 thread #4026680617 called
out: the standalone `Projects v2 is display,? but` regex alternative
would match this text and classify it contradictory, even though
the actual recommendation stays on the Issue side.

## Example

> **Answer:** The "Blocked / dependency" Projects v2 field is a
> **read-only projection** of the GitHub Issue dependency graph.
> Projects v2 is display, but the actual write path remains on the
> Issue side — to flag a blocker I would update the GitHub Issue
> metadata (`blocked-by` / `stack-position`) via the Issue API.
> Editing the Projects field directly is a canonical-source
> violation.

## Why this must PASS

- Affirms `canonical_surface_marker` ("read-only projection" /
"Projects v2 is display") in full.
- The `but` clause recommends an Issue-side action — *not* a write
to the Projects field. This is the canonical write path.
- The transition phrase ("but the actual write path remains on the
Issue side") is part of normal English explanation; it is not a
recommendation for Projects-side edits.
- Net: the answer is policy-aligned end to end.

## Grader check

- Must classify as `positive`, **not** `contradictory`.
- With the bound regex `Projects v2 is display,? but[^.\n]*(update|edit|use)[^.\n]*Projects( field| v2)?`,
the `but` alternative only matches when the trailing clause
references a Projects-targeted action. "Issue-side" / "GitHub
Issue" / "Issue API" sentences fail the `Projects( field| v2)?`
trailing check and remain positive.
- Marks the answer PASS.
2 changes: 1 addition & 1 deletion evals/policy-evaluation/grade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fi
# 系の paraphrase を捕捉する。
projects_first_paraphrase=0
if grep -qiE \
"update the Projects( field)? to create|update the Projects( field)? to record|add a Project entry to record|Projects v2 is display,? but|though Projects v2 is display,? (still|use|update|edit)" \
"update the Projects( field)? to create|update the Projects( field)? to record|add a Project entry to record|Projects v2 is display,? but[^.\n]*(update|edit|use)[^.\n]*Projects( field| v2)?|though Projects v2 is display,? (still )?(update|edit|use)[^.\n]*Projects( field| v2)?" \
<<<"$answer_body"; then
projects_first_paraphrase=1
fi
Expand Down
3 changes: 2 additions & 1 deletion evals/policy-evaluation/scenario.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ evals/<policy-area>/
scenarios/
S-NNN-<name>.md # one or more live scenarios
grade.sh # semantic grader
controls.sh # 4-control driver (positive / negative / regression / contradictory)
controls.sh # 5-control driver (positive / positive-transition / negative / regression / contradictory)
fixtures/
positive.md
positive-transition.md # optional: transition 句を持つ canonical 答え (false-positive 抑止)
negative.md
regression.md
contradictory.md # optional: latent canonical-surface-vs-projects-first contradiction
Expand Down
10 changes: 6 additions & 4 deletions evals/policy-evaluation/scenarios/S-001-dependency-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ the regression marker takes precedence over the negative marker.
## Controls

- `fixtures/positive.md` — must PASS.
- `fixtures/positive-transition.md` — must PASS. transition 句 ("Projects v2 is display, but ...") を使いながら Issue-side action を推奨する canonical 答えを contradictory に false-positive 分類しない (PR #98 thread #4026680617 follow-up)。
- `fixtures/negative.md` — must FAIL.
- `fixtures/regression.md` — must FAIL.
- `fixtures/contradictory.md` — must FAIL.

Run all four:
Run all five:

```bash
bash evals/policy-evaluation/controls.sh
# Expected: PASS: 4-control separation holds
# Expected: PASS: 5-control separation holds
```

## Fresh-agent runner — limitation
Expand All @@ -116,10 +117,11 @@ to add a fresh-agent invocation layer as a follow-up.

## Completion evidence

- `bash evals/policy-evaluation/context-budget.sh` → `OK: 9 files, ...KB / 65536B`
- `bash evals/policy-evaluation/controls.sh` → `PASS: 4-control separation holds`
- `bash evals/policy-evaluation/context-budget.sh` → `OK: 10 files, ...KB / 65536B`
- `bash evals/policy-evaluation/controls.sh` → `PASS: 5-control separation holds`
- Each fixture grades independently:
- `bash evals/policy-evaluation/grade.sh fixtures/positive.md` → `PASS`
- `bash evals/policy-evaluation/grade.sh fixtures/positive-transition.md` → `PASS`
- `bash evals/policy-evaluation/grade.sh fixtures/negative.md` → `FAIL`
- `bash evals/policy-evaluation/grade.sh fixtures/regression.md` → `FAIL`
- `bash evals/policy-evaluation/grade.sh fixtures/contradictory.md` → `FAIL`
Loading