Skip to content

Add share-safe proof report artifacts - #209

Merged
mohanagy merged 22 commits into
mainfrom
issue-189-share-safe-report
May 18, 2026
Merged

mohanagy merged 22 commits into
mainfrom
issue-189-share-safe-report

Conversation

@mohanagy

@mohanagy mohanagy commented May 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add companion report.share-safe.json artifacts for compare, review-compare, and runner-backed benchmark flows
  • centralize share-safe path and text sanitization for artifact reports and harden redaction across traversal, UNC, protocol-relative URL, rooted ://, and file:// edge cases
  • update docs/changelog and expand regression coverage for share-safe artifact behavior

Closes #189

Testing

  • npm run typecheck
  • npm run build
  • npm run test:run

Summary by CodeRabbit

  • New Features

    • Added report.share-safe.json output for compare, review-compare, and benchmark --exec runs: sanitized, placeholder-based paths for safe sharing while keeping full local report.json.
    • Added a share-safe sanitization utility to rewrite/redact paths and URL-like tokens for shareable reports.
  • Documentation

    • Updated guides and tutorials to describe share-safe reporting behavior.
  • Tests

    • Expanded unit tests to cover share-safe report generation and sanitization.

Review Change Stack

mohanagy and others added 21 commits May 18, 2026 08:00
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 18, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e729a14b-4452-49fa-b949-0ff04753db03

📥 Commits

Reviewing files that changed from the base of the PR and between 1e91aed and 21ec37f.

📒 Files selected for processing (5)
  • src/infrastructure/compare.ts
  • src/infrastructure/review-compare.ts
  • tests/unit/compare-native-agent.test.ts
  • tests/unit/compare.test.ts
  • tests/unit/review-compare.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/unit/review-compare.test.ts
  • src/infrastructure/review-compare.ts

📝 Walkthrough

Walkthrough

This PR adds share-safe report generation across benchmark, compare, and review-compare: each proof run now writes a second artifact, report.share-safe.json, where paths and sensitive text are sanitized to stable placeholders while the full local report.json is preserved.

Changes

Share-safe report generation

Layer / File(s) Summary
Share-safe path sanitization utility
src/shared/share-safe-artifacts.ts
New module exporting ShareSafePathRoots, toShareSafeArtifactPath(), and sanitizeShareSafeText(); implements regex/tokenization and root-aware rewriting to produce <artifact-root> / <project-root> placeholders or basename fallbacks.
Benchmark share-safe report generation
src/infrastructure/benchmark/runner.ts, tests/unit/benchmark.test.ts
BenchmarkPromptArtifacts gains share_safe_report. runBenchmarkPrompt now writes local portable report.json and a share-safe report.share-safe.json with artifact paths converted via toShareSafeArtifactPath. Tests validate artifact paths and local vs share-safe report shapes.
Compare share-safe report generation
src/infrastructure/compare.ts, tests/unit/compare.test.ts, tests/unit/compare-native-agent.test.ts
ComparePromptArtifactPaths and native-agent paths gain share_safe_report. writeCompareReport / writeNativeAgentReport now emit both portable report.json and sanitized report.share-safe.json, recursively sanitizing stderr/evidence and path-like fields using share-safe helpers. Extensive tests cover pack_only, evidence/stderr, traversal, Windows/UNC, protocol-relative URLs, and direct sanitizeShareSafeText assertions.
Review-compare share-safe report generation
src/infrastructure/review-compare.ts, tests/unit/review-compare.test.ts
ReviewComparePromptArtifactPaths gains share_safe_report. Helpers rewrite answer/prompt/report artifact paths and sanitize stderr; writeReport now writes both portable and share-safe JSON outputs. Tests assert placeholder paths and stderr redaction while local reports remain unchanged.
Documentation
CHANGELOG.md, docs/proof-workflows.md, docs/tutorials/getting-started.md
Changelog and docs updated to document report.share-safe.json, its placeholder behavior, and that local report.json remains available.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • mohanagy/graphify-ts#28: Modifies src/infrastructure/compare.ts native_agent compare/report generation; overlaps with share-safe additions to native-agent reporting.
  • mohanagy/graphify-ts#30: Extends review-compare infrastructure; this PR builds on that flow by adding share-safe report emission and sanitization.
  • mohanagy/graphify-ts#65: Changes in compare native-agent reporting that intersect with this PR’s compare share-safe report changes.

"I'm a rabbit in the code-hill glade,
I hop and hide each noisy path we've laid.
Reports double-up—local kept near,
share-safe copies dress paths clear,
Hop, share, no secrets on parade." 🐇📁

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add share-safe proof report artifacts' clearly and concisely summarizes the main change: adding new share-safe report artifacts to the proof workflow system.
Description check ✅ Passed The PR description includes a clear summary of changes, references the related issue (#189), and lists all required testing commands (typecheck, build, test:run).
Linked Issues check ✅ Passed The PR fully meets all acceptance criteria from issue #189: adds share-safe artifacts for compare/review-compare/benchmark, centralizes sanitization logic, documents changes, expands tests, and preserves full local reports.
Out of Scope Changes check ✅ Passed All code changes are directly related to implementing share-safe report artifacts; documentation updates, test coverage, and utility functions are all within scope of issue #189.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-189-share-safe-report

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/infrastructure/compare.ts (1)

64-70: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Native-agent compare still misses the new share-safe report contract.

This wires report.share-safe.json into the prompt-pack compare path only. --baseline-mode native_agent still goes through NativeAgentCompareReport/writeNativeAgentReport() and emits just report.json, so one supported compare workflow does not get the advertised share-safe companion artifact.

Also applies to: 273-304

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/infrastructure/compare.ts` around lines 64 - 70, The compare flow is not
emitting the share-safe companion artifact for native-agent baseline mode;
update the NativeAgentCompareReport implementation (and its writer function
writeNativeAgentReport) to generate and write the share-safe report alongside
report.json using the share_safe_report path defined in
ComparePromptArtifactPaths, ensuring the same serialization/shape as
report.share-safe.json produced by the prompt-pack path; also apply the same
change to the other similar logic block referenced around the 273-304 region so
both code paths produce the share-safe artifact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/infrastructure/benchmark/runner.ts`:
- Around line 253-291: The mapping into the share-safe report is using
cwd-relative values from localReportArtifacts, so toShareSafeArtifactPath falls
back to basenames for temp files; fix by resolving each artifact path to an
absolute path under shareSafeRoots.artifactRoot before calling
toShareSafeArtifactPath. In the block that builds the share-safe artifacts (the
Object.entries(localReportArtifacts).map(...) and the share_safe_report
assignment), detect non-absolute paths and resolve them against
shareSafeRoots.artifactRoot (e.g., via path.resolve or equivalent) then pass
that absolute path into toShareSafeArtifactPath; do the same for
artifacts.share_safe_report so writeFileSync writes absolute-rooted share-safe
entries.

In `@src/infrastructure/review-compare.ts`:
- Around line 157-164: rewriteShareSafeStderr currently only strips path-like
data via sanitizeShareSafeText but leaves credential-shaped values (e.g.
"OPENAI_API_KEY=...", "API_KEY=...", "Bearer ...") intact; update
rewriteShareSafeStderr (or add a helper used by it) to run an additional
credential-redaction pass on stderr values using conservative regexes that match
common env-assignment and bearer/token patterns (keywords like API_KEY, SECRET,
TOKEN, PASS, KEY and "Bearer <token>") and replace the secret portions with a
fixed mask (e.g. "<REDACTED>") either before or after calling
sanitizeShareSafeText; reference the existing function name
rewriteShareSafeStderr and reuse or extend
sanitizeShareSafeText/ShareSafePathRoots so all branches (verbose/compact)
return redacted, share-safe output.

---

Outside diff comments:
In `@src/infrastructure/compare.ts`:
- Around line 64-70: The compare flow is not emitting the share-safe companion
artifact for native-agent baseline mode; update the NativeAgentCompareReport
implementation (and its writer function writeNativeAgentReport) to generate and
write the share-safe report alongside report.json using the share_safe_report
path defined in ComparePromptArtifactPaths, ensuring the same
serialization/shape as report.share-safe.json produced by the prompt-pack path;
also apply the same change to the other similar logic block referenced around
the 273-304 region so both code paths produce the share-safe artifact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 57bee4f3-e576-4c25-af20-dc2f8b87350c

📥 Commits

Reviewing files that changed from the base of the PR and between daf564f and 1e91aed.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • docs/proof-workflows.md
  • docs/tutorials/getting-started.md
  • src/infrastructure/benchmark/runner.ts
  • src/infrastructure/compare.ts
  • src/infrastructure/review-compare.ts
  • src/shared/share-safe-artifacts.ts
  • tests/unit/benchmark.test.ts
  • tests/unit/compare.test.ts
  • tests/unit/review-compare.test.ts

Comment thread src/infrastructure/benchmark/runner.ts Resolved
Comment thread src/infrastructure/review-compare.ts Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mohanagy

Copy link
Copy Markdown
Owner Author

Addressed the remaining review follow-ups in 21ec37f.

  • native_agent compare now emits report.share-safe.json alongside report.json
  • the share-safe native report sanitizes artifact/result paths, including result_path
  • Windows-sensitive compare/review-compare assertions now avoid JSON-escaped path mismatches

@mohanagy
mohanagy merged commit 635473f into main May 18, 2026
7 checks passed
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.

[P1][Artifacts] Add share-safe report mode

1 participant