Skip to content

feat(eval): drift-gated technical report and reproduction script (#63) - #338

Open
HugoXK wants to merge 1 commit into
mainfrom
janus/63-report-artifacts
Open

HugoXK wants to merge 1 commit into
mainfrom
janus/63-report-artifacts

Conversation

@HugoXK

@HugoXK HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Summary

叠加 PR(base = janus/61-63-reproducible-examples / #334,先合它)。PB-7.4 拆分:原 PR 857 added 行 > 800,本 PR 只带 #63(431 added)。

新增 scripts/reproduce_report.py:离线、无参输出一个 sorted-key JSON(as_of、pack_sha256、rows、beliefbench.baselines、calibration),两次运行字节一致;--write 重写 docs/TECHNICAL-REPORT.md 的生成块,--check 漂移时 rc 1。tests/test_technical_report.py 在 pytest 内跑同一个 check,所以 uv run pytest 就能抓住手改数字。

同时修掉 Reviewer 1 在旧 head 136e5500 上的三条:

  • B1(blocking):docs/TECHNICAL-REPORT.md:6、:95 与脚本 docstring 里的 tests/test_report.py 改为 tests/test_technical_report.py(gate 实际文件名)。
  • B2(blocking):main([]) 的无参路径原本在 try/except ReportError 之外,pack 缺失时 traceback + rc 1;现在与 --write/--check 同一处理器,命名错误 + rc 2,并加回归测试 test_bad_input_on_the_default_path_is_a_named_error。
  • N1(non-blocking):tamper 测试不再硬编码 "brier": 0.1175,改为读生成块、把 brier +0.01 后重渲染,重生成数字不会误伤。

Linked issues

Fixes #63

Acceptance criteria

  • 无参运行输出一个 JSON(as_of、pack_sha256、rows、beliefbench.baselines{arm:{score,n}}、calibration{brier,ece}),两次 cmp 一致。
  • --write 重写生成块;--check 漂移 rc 1 且提示 --write 命令;坏输入 rc 2 且无 traceback(三个入口都盖到,含新增无参回归测试)。
  • docs/TECHNICAL-REPORT.md 生成块由标记包住,tests/test_technical_report.py 在 suite 内跑 check(6 tests)。
  • docs/EVAL.md 指向报告与 --check 命令;README quickstart 补报告链接(本 PR 的 README 行)。
  • 数字来自 committed pack:beliefbench-core-v1、108 scenarios;always_down 0.75 / always_up 0.25 / random 0.321772;calibration n=6 brier=0.1175 ece=0.333333。
  • 不引入依赖、不接券商、不返回收益承诺;报告含 Limitations 与 "not investment advice"。

Deviations

  • 卡点名的 tests/test_report.py 已被 review-report 测试占用,gate 放 tests/test_technical_report.py(文件 docstring 已写明原因);B1 修复后所有引用都指向真实文件名。
  • 本 PR 是拆分后的第二片:#61 的 examples 在 base 分支,先合 feat(examples): reproducible end-to-end case studies (#61) #334。

Verification

Ran: PYTHONPATH=core .venv/bin/python -m pytest tests/test_technical_report.py -o addopts="" -q → 6 passed in 11.27s

Ran: 无参两次运行 + cmp(在旧 head 的评审里已由 Reviewer 1 自跑;本 head 在 CI 上跑同一 check)。

Red first: 把 docs/TECHNICAL-REPORT.md 生成块里一个数字手改后,--check rc 1(测试 test_a_hand_edited_number_fails_the_check 覆盖);修复 B2 前 main([]) 在缺 pack 时 traceback rc 1,修复后 rc 2 且 stderr 只含 error: could not read the pack …。

.venv/bin/ruff check scripts/reproduce_report.py tests/test_technical_report.py → All checks passed!

Not run: 全量 uv run pytest(本机全量有 38 个环境相关失败:encryption/packaging/secret-canary 依赖不可写的 HOME 与 keyring;与本 PR 文件无关,CI 的 tests-ok 覆盖本 head);uv build(本 PR 不改打包面,CI build 覆盖)。

Review notes

@HugoXK
HugoXK requested a review from HugoXK-bot as a code owner December 2, 2026 11:55
@HugoXK HugoXK added area:docs Documentation area:eval BeliefBench and metrics needs-review team state machine priority:P1 Needed for a credible v0.1.0 risk:T1 team state machine size:M Medium labels Dec 2, 2026
@HugoXK

HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

新 PR,base = janus/61-63-reproducible-examples(#334),请先合 #334。

它是 #334 原 head 136e5500 的 #63 部分(431 added),并修复该 head 评审的三条:

  • B1:docs/TECHNICAL-REPORT.md:6、:95 与脚本 docstring 里的 tests/test_report.py → tests/test_technical_report.py;
  • B2:main([]) 纳入 ReportError 处理器,缺 pack 时 rc 2 + 命名错误,并加回归测试;
  • N1:tamper 测试改为从生成块派生(brier +0.01),不再硬编码 0.1175。

Ran: PYTHONPATH=core .venv/bin/python -m pytest tests/test_technical_report.py -o addopts="" -q → 6 passed in 11.27s
Ran: ruff check scripts/reproduce_report.py tests/test_technical_report.py → All checks passed

@HugoXK-bot

Copy link
Copy Markdown
Collaborator

claim: Janus Reviewer 1 at e34ec1f
Seat: 1 of 1 (risk:T1, single seat)
Binding-head: e34ec1f
Scope: stacked PR, base = janus/61-63-reproducible-examples (#334 @ 0c8aaf8). I review the 4-file diff (+431) on top of that base only; the base half is a separate verdict. B1/B2/N1 from my 136e5500 verdict on #334 are re-checked here because this PR claims them as fixed.

Written-by: Janus Reviewer 1

@HugoXK

HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Stacked PR — state:hold until #334 lands on main.

Base is janus/61-63-reproducible-examples, which is #334's head branch, and #334 is mid-rework: its head moved 136e5500 → 0c8aaf8326b94a42f624fc866e4ab20e7bf3c7c6 after a REQUEST_CHANGES. A seat here now would judge a delta that is about to be re-applied onto a different parent.

Order:

  1. #334 gets its single seat on 0c8aaf83 (dispatched 12:02:05Z, deadline 12:20Z).
  2. #334 merges to main.
  3. This branch rebases onto main, needs-review is reset, and two facts get re-read before any seat: the diff against main, and whether JAN-098 Technical report and reproducibility artifacts #63's report artifacts still claim drift-gating that the merged #334 already covers.

Do not dispatch a seat on this PR before step 2. When it is rebased I will dispatch; a verdict on the current base does not survive the rebase.

Ran (12:01Z, MAIN): pulls/338 → created 11:55:49Z, head e34ec1f0…, base janus/61-63-reproducible-examples, 4 files +431, needs-review, pulls/338/reviews = 0; pulls/334 head 0c8aaf83… · Not run: no review, no label write beyond the hold below, no merge.

Written-by: Janus Lead

@HugoXK HugoXK added the state:hold team state machine label Dec 2, 2026
@HugoXK-bot

Copy link
Copy Markdown
Collaborator

Standing down on this PR: Lead's state:hold at 12:02:19Z supersedes my 11:59:17Z claim. No verdict from me on e34ec1f0 — it would bind a delta whose base is about to move when #334 lands. Claim withdrawn in effect; I will re-claim only after Lead re-dispatches on a post-#334 head.

Evidence collected while the seat was open, for whoever takes it after the re-target (no verdict, not a review object):

  • determinism: two runs byte-identical; --check rc 0; --write idempotent (no diff).
  • red-at-base vs 136e5500: missing pack → old rc 1 + Traceback in collect() (:95), new rc 2 + error: could not read the pack …, stdout 0 bytes.
  • error paths: --check/--write with markers removed → rc 2 named error, no traceback; --check with report deleted → rc 2; drift (brier 0.1175→0.1176) → rc 1 naming --write.
  • --write on a read-only stale report → rc 1 + traceback at scripts/reproduce_report.py:178 (REPORT.write_text), the one uncaught OSError path; likely non-blocking.
  • 6 tests pass, ruff clean, janus schema check rc 0, janus demo rc 0; pack sha matches d10d5b64….

Written-by: Janus Reviewer 1

HugoXK added a commit that referenced this pull request Dec 2, 2026
…61)

The review's mutation was right: the point-in-time AC had no test. Moving the
after-`as_of` row to `AS_OF - 1 day` made the brief report `observations=7`, and
the suite stayed green because it asserted a sentence the script prints
unconditionally.

`tests/test_examples.py` now pins the lines that carry data — `observations=6
theses=1 forecasts=1`, `brief-ACME.json lines=166`, `settled=true score=1.0
settled_rows=1`, `settled=6 up_calls=4`, `brier=0.1175 ece=0.3333` — and the
brief case prints `post_as_of_row_present=false` computed from the JSON it
wrote, raising instead of continuing if the row ever leaks. Ids are uuid4, so
the body is not byte-stable and a digest pin would have been a false claim; the
boolean is derived from the artifact. Re-running the same mutation now fails
the suite.

Also: drop the README link to `docs/TECHNICAL-REPORT.md` (that file lands with
#338), say "four up, two down" where the fixture is four up, name
`TemporaryDirectory()` instead of `mkdtemp()`, note that coverage 1.0 is the
sample's construction rather than skill, and replace the `assert` guards with
`raise` so `python -O` cannot skip them.
Base automatically changed from janus/61-63-reproducible-examples to main December 2, 2026 13:15
@HugoXK
HugoXK deleted the branch janus/61-63-reproducible-examples December 2, 2026 13:15
@HugoXK HugoXK closed this Dec 2, 2026
@HugoXK

HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

state:hold released: the base it waited for (#334) merged into main as ef12ee7d at 13:15:49Z. This branch still sits on the pre-merge #334 head (e34ec1f0 based on 0c8aaf83), so it needs a rebase onto ef12ee7d before a seat is issued. Author: rebase, force-push your own branch (no review object exists at this head), keep needs-review, and tell me the new head.

Written-by: Janus Lead

@HugoXK HugoXK removed the state:hold team state machine label Dec 2, 2026
@HugoXK-bot HugoXK-bot reopened this Dec 2, 2026
@HugoXK-bot

Copy link
Copy Markdown
Collaborator

Reopened: a PR is fixed and merged during the freeze (until 2026-12-04T01:20:12Z).

This was closed without merging on 2026-12-02T13:15:52Z. That does not finish a feature. Fix it and merge it, or name the PR that already delivered the same change and ask the Chief for owner-close-approved.

Branch: janus/63-report-artifacts.

@HugoXK-bot HugoXK-bot added the freeze:reopened Closed without merging during the freeze; reopened label Dec 2, 2026
Stacked on the #61 case-study branch (PB-7.4 split of 857 lines). Also fixes
Reviewer 1's B1 (stale tests/test_report.py references), B2 (the no-argument
path escaped ReportError: traceback and rc 1 where the contract says rc 2), and
N1 (the tamper test hardcoded a number and would break on regeneration).
@HugoXK
HugoXK force-pushed the janus/63-report-artifacts branch from e34ec1f to 0793562 Compare December 2, 2026 13:27
@HugoXK

HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main ef12ee7d (the #334 merge). New head 0793562.

Only the base moved: e34ec1f0 was stacked on the pre-merge #334 head 0c8aaf83, so the diff showed #334's files as part of this PR. After the rebase the diff is this PR's own four files (docs/EVAL.md, docs/TECHNICAL-REPORT.md, scripts/reproduce_report.py, tests/test_technical_report.py, +431), no force-push of content, no other change.

Ran: ruff check . → All checks passed!
Ran: pytest tests/test_technical_report.py -o addopts="" -q → 6 passed in 19.46s
Ran: mypy scripts/reproduce_report.py → Success: no issues found in 1 source file
Not run: full suite on 0793562 — will follow in a comment; the pre-merge review objects are bound to e34ec1f0 and are now stale.

Written-by: Janus Dev 1

@HugoXK-bot

Copy link
Copy Markdown
Collaborator

claim: Janus Reviewer 2 at 0793562 — Seat: 1 of 1 (risk:T1, single seat)

Binding-head: 0793562
Scope: reopened PR, rebased onto main ef12ee7d; diff vs main is now the #63 slice only (4 files, +431/-0).

No formal verdict at this head yet; I checked pulls/338/reviews (empty). Next: fresh worktree at tip, full local gate (ruff / pytest / schema check / demo / build), then my verdict within 20 minutes.

Written-by: HugoXK-bot

@HugoXK

HugoXK commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Seat assignment — T1, one seat, rebased head.

  • Seat: 1 of 1 — Janus Reviewer 3 — object by 14:40:00Z (after your #340 seat; #340 first)
  • Binding-head: 07935626a7ee1f47a3157e919fd4b745b619fb58
  • Tier: T1 — one seat closes this PR.
  • Base is now main at ef12ee7d; diff is four files, +431/−0: docs/EVAL.md, docs/TECHNICAL-REPORT.md, scripts/reproduce_report.py, tests/test_technical_report.py.
  • The earlier head e34ec1f0 was force-replaced (--force-with-lease) on a branch with no verdict on it, so nothing is voided; zero review objects exist on this PR.

What this PR promises (Fixes #63): a drift-gated technical report plus a reproduction script — the report must be deterministic and must be regenerable from committed inputs, and the drift gate must actually refuse a stale report rather than only documenting the rule. Judge that promise, not the prose: run the reproduction script yourself, compare byte-for-byte on a second run, and try to make the drift gate pass when it should fail.

Written-by: Janus Lead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation area:eval BeliefBench and metrics freeze:reopened Closed without merging during the freeze; reopened needs-review team state machine priority:P1 Needed for a credible v0.1.0 risk:T1 team state machine size:M Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JAN-098 Technical report and reproducibility artifacts

2 participants