Repository navigation
✨ feat(lab): add report generator and redaction gate (LAB-H06) - #268
Merged
Merged
Conversation
Emit DOC-02 summary.md + checksums from H05 evidence trees; block publication on seeded secret patterns. Thin H09 golden schema covered via synthetic sample-bundle and lab_report_schema_golden_test.sh.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an offline lab report generator and accompanying redaction + golden-schema tests, backed by a synthetic DOC-02–shaped sample evidence bundle.
Changes:
- Introduces
hack/lab/report.shto generatesummary.mdandchecksums.txtfor an evidence run directory. - Adds redaction scanning/gating library (
hack/lab/lib/redact.sh) and meta/golden tests to validate report output and redaction behavior. - Adds a synthetic
hack/lab/testdata/sample-bundlefixture used by the tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hack/test/lab_report_schema_golden_test.sh | Golden checks for report output schema/anchors and checksums format. |
| hack/test/lab_report_redaction_meta_test.sh | End-to-end meta test: clean fixture passes, seeded fake secrets fail; invokes golden schema test. |
| hack/lab/testdata/sample-bundle/timings/.keep | Ensures timings dir exists in the synthetic bundle. |
| hack/lab/testdata/sample-bundle/scenario-matrix.md | Fixture scenario matrix content used by report/tests. |
| hack/lab/testdata/sample-bundle/pprof/.keep | Ensures pprof dir exists in the synthetic bundle. |
| hack/lab/testdata/sample-bundle/manifest.md | Fixture manifest used by summary generation and anchor checks. |
| hack/lab/testdata/sample-bundle/limitations.md | Fixture limitations content used by summary generation and “honesty gate” checks. |
| hack/lab/testdata/sample-bundle/RUN_ID.txt | Fixture run id source used by report. |
| hack/lab/testdata/sample-bundle/RETENTION.notes | Fixture documentation about retention/size expectations. |
| hack/lab/testdata/sample-bundle/README.md | Fixture documentation and RUN_ID note. |
| hack/lab/report.sh | New report generator CLI (summary + checksums) with redaction gate. |
| hack/lab/lib/redact.sh | New redaction scan/gate library used by report and tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+187
to
+194
| _lab_report_write_summary "${RUN_DIR}" | ||
| _lab_report_write_checksums "${RUN_DIR}" | ||
|
|
||
| # Redaction gate last: seeded secrets must fail; clean synthetic sample passes. | ||
| if ! lab_redact_gate "${RUN_DIR}"; then | ||
| printf 'report: redaction gate failed — refuse publication for %s\n' "${RUN_DIR}" >&2 | ||
| exit 1 | ||
| fi |
| cat <<EOF | ||
| # Lab evidence summary — \`${run_id}\` | ||
|
|
||
| Publication draft for [lab evidence bundle](../../docs/operator-manual/lab-evidence-bundle.md). |
Comment on lines
+167
to
+184
| tmp="$(mktemp "${TMPDIR:-/tmp}/lab-checksums.XXXXXX")" | ||
|
|
||
| ( | ||
| cd "${run_dir}" | ||
| # Stable order; skip the checksums file we are writing and any prior copy. | ||
| find . -type f ! -name 'checksums.txt' -print | LC_ALL=C sort | while IFS= read -r f; do | ||
| rel="${f#./}" | ||
| if command -v sha256sum >/dev/null 2>&1; then | ||
| # sha256sum prints "digest path" — rewrite to relative path only. | ||
| digest="$(sha256sum -- "${rel}" | awk '{print $1}')" | ||
| else | ||
| digest="$(shasum -a 256 -- "${rel}" | awk '{print $1}')" | ||
| fi | ||
| printf '%s %s\n' "${digest}" "${rel}" | ||
| done | ||
| ) >"${tmp}" | ||
|
|
||
| mv "${tmp}" "${out}" |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
lab_report_redaction_meta_test.sh,lab_harness_meta_suite.shgreenTest plan
bash hack/test/lab_report_redaction_meta_test.shbash hack/test/lab_harness_meta_suite.sh