Skip to content

feat(nim): add transactional benchmark evidence boundary - #890

Merged
seonghobae merged 8 commits into
mainfrom
feat/nim-benchmark-evidence-boundary
Aug 27, 2026
Merged

feat(nim): add transactional benchmark evidence boundary#890
seonghobae merged 8 commits into
mainfrom
feat/nim-benchmark-evidence-boundary

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Outcome

Adds the first independently reviewable slice of #86: a fail-closed evidence boundary for optional NVIDIA NIM benchmarks. It validates versioned task/scorer identities and publishes exactly JSON, CSV, Markdown, and provenance as one same-filesystem directory transaction.

Boundaries

Verification on exact head 3fef47b74700f1fdc2401e39491e0077f3423ec4

  • uvx ruff check contextual_orchestrator/nim_evidence.py tests/test_nim_evidence.py
  • uv run --with pytest --with pytest-cov pytest -q tests/test_nim_evidence.py --cov=contextual_orchestrator.nim_evidence --cov-branch --cov-report=term-missing — 13 passed; 99 statements and 50 branches at 100%
  • uv run --extra test --with pytest pytest -q — 2366 passed in 740.60s

Remaining #86 work

Dynamic live catalog/capability probing, Rust-owned paired uncertainty/Pareto analysis, full benchmark policy comparison, and protected-main operational acceptance remain open under #86.

Closes no issue; contributes to #86.


Open in Devin Review

Summary by CodeRabbit

  • 새 기능

    • 선택적 NVIDIA NIM 벤치마크 결과를 엄격하게 검증하고 안전하게 게시할 수 있습니다.
    • 작업 및 스코어러 식별자, 실행 출처 등 전체 provenance를 기록합니다.
    • JSON, CSV, Markdown 및 provenance 결과를 하나의 완전한 세트로 원자적으로 교체합니다.
    • 게시 실패나 충돌 발생 시 기존 결과를 복구하며, 검증되지 않은 데이터는 게시하지 않습니다.
  • 문서

    • 벤치마크 증거 형식, 필수 결과물, 검증 및 복구 동작을 문서화했습니다.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 3 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f30a96f-9ffc-4b5d-857e-69b5f8bebc21

📥 Commits

Reviewing files that changed from the base of the PR and between 05c0c99 and 86124f4.

📒 Files selected for processing (2)
  • contextual_orchestrator/nim_evidence.py
  • tests/test_nim_evidence.py
📝 Walkthrough

Walkthrough

NVIDIA NIM 벤치마크 증거 경계를 추가했다. 매니페스트와 provenance를 엄격히 검증하고, 네 개의 artifact를 잠금 기반으로 원자적으로 게시한다. 게시 실패와 충돌 잔여물을 복구하며, 계약 테스트와 문서로 동작을 정의한다.

Changes

NIM 증거 경계

Layer / File(s) Summary
증거 스키마와 검증 계약
contextual_orchestrator/nim_evidence.py, tests/test_nim_evidence.py, docs/nim-benchmark-evidence-boundary.md, CHANGELOG.md
NIM 증거 스키마 상수, artifact 이름, 결정적 JSON SHA-256 계산을 추가했다. task manifest와 provenance의 필수 필드, 형식, 허용 필드를 검증한다. 관련 계약 테스트와 경계 문서를 추가했다.
원자적 artifact 게시와 복구
contextual_orchestrator/nim_evidence.py, tests/test_nim_evidence.py
정확히 네 개의 비어 있지 않은 artifact를 staging 디렉터리에 기록한다. sibling lock으로 게시를 직렬화하고, 기존 final 디렉터리를 backup으로 교체한 뒤 staging을 원자적으로 게시한다. 실패, 충돌 잔여물, symlink, 읽기 전용 경로와 잠금 오류를 fail-closed 방식으로 처리한다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: 🟡 Moderate · up to 05c0c

The change publishes benchmark evidence transactionally, but newly created evidence directories may be world-writable and therefore tamperable by other local users, weakening artifact integrity; merge should wait for an explicit restrictive permission mode. Two failure-path tests also need platform-safe path comparisons.

Sequence Diagram(s)

sequenceDiagram
  participant Caller as 호출자
  participant Publisher as publish_artifact_set
  participant Lock as 게시 잠금
  participant Filesystem as 파일 시스템
  Caller->>Publisher: artifact와 output_directory 전달
  Publisher->>Publisher: payload 및 provenance 검증
  Publisher->>Lock: sibling lock 획득
  Lock->>Filesystem: staging 기록 및 기존 final backup
  Filesystem->>Publisher: staging을 final로 원자적 교체
  Publisher->>Lock: 잠금 해제
  Publisher-->>Caller: 완료 또는 NimEvidenceError
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 선택적 NVIDIA NIM 벤치마크를 위한 트랜잭션 증거 경계 추가라는 PR의 주요 변경 사항을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/nim-benchmark-evidence-boundary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 17:34
devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 17:43
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 18:21
devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 18:27
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 18:34
@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 18:44
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 18:49
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 26, 2026 20:24
@seonghobae
seonghobae enabled auto-merge (squash) August 26, 2026 20:39
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +216 to +221
try:
os.replace(staging, final)
except BaseException:
if backup is not None and backup.exists():
os.replace(backup, final)
raise

@devin-ai-integration devin-ai-integration Bot Aug 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Failed restore leaves target missing until next publish

If os.replace(staging, final) fails and the restore os.replace(backup, final) also fails, the finally block removes staging and final is left absent, with old data only in the .name.backup-* directory. The next publish's _recover_publication restores it, so the loss is transient, not permanent.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

…ories

- Compare staging cleanup locks by resolving parent paths
@opencode-agent
opencode-agent Bot disabled auto-merge August 27, 2026 00:18

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +209 to +217
for name, payload in artifacts.items():
(staging / name).write_bytes(payload)
if final_mode is not None:
staging.chmod(final_mode)
if final.exists():
backup = final.parent / f".{final.name}.backup-{uuid.uuid4().hex}"
os.replace(final, backup)
try:
os.replace(staging, final)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: No fsync before atomic rename commit

Staging files are written and committed with os.replace (contextual_orchestrator/nim_evidence.py:209-217) without fsyncing the files or the parent directory. After power loss right after the rename, POSIX does not guarantee the contents or the rename are durable. The crash-recovery guarantee holds only against process crashes, not power loss.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae
seonghobae merged commit 7e1488e into main Aug 27, 2026
30 checks passed
@seonghobae
seonghobae deleted the feat/nim-benchmark-evidence-boundary branch August 27, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant