Skip to content

✨ feat(lab): LAB-H04 assert helpers for DOC-02 verdicts - #267

Merged
konih merged 1 commit into
mainfrom
feat/lab-h04-assert
Aug 5, 2026
Merged

konih merged 1 commit into
mainfrom
feat/lab-h04-assert

Conversation

@konih

@konih konih commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Integrator ephemeral PR for LAB-H04 (assert helpers).
  • Branch already rebased on origin/main (changelog-sync tip); meta tests green.

Test plan

  • bash hack/test/lab_assert_meta_test.sh
  • bash hack/test/lab_harness_meta_suite.sh

Offline-sourceable count/checksum compare helpers that emit LAB-DOC-02
verdicts (plus BLOCKED) and never coerce skip/blocked/limit into pass.
Copilot AI lite review requested due to automatic review settings August 5, 2026 10:56
@konih
konih merged commit 6ecd9e5 into main Aug 5, 2026
24 of 25 checks passed
@konih
konih deleted the feat/lab-h04-assert branch August 5, 2026 10:57

Copilot AI 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.

Pull request overview

Adds a new Bash “lab assert” helper library and a meta-test suite to ensure LAB-DOC-02 verdict mappings and comparison helpers (counts + checksum) behave consistently and never coerce non-pass states into pass.

Changes:

  • Introduces hack/lab/lib/assert.sh with verdict validation, structured JSON emitters, count comparison, checksum comparison, and outcome→verdict mapping helpers.
  • Adds hack/test/lab_assert_meta_test.sh to validate allowed verdicts, pass/fail semantics, reason requirements, JSON shapes, and comparison-to-verdict mapping.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
hack/test/lab_assert_meta_test.sh Adds a meta-test harness to validate verdict mapping and comparison helper behavior.
hack/lab/lib/assert.sh Adds the assert/verdict helper library (verdict rules + counts/checksum comparison + mapping).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hack/lab/lib/assert.sh
Comment on lines +97 to +101
def keys_order: ["source", "store", "inventory", "sink"];
def as_counts:
if type != "object" then error("counts must be a JSON object") end
| . as $o
| reduce keys_order[] as $k ({}; .[$k] = ($o[$k] // null));
Comment thread hack/lab/lib/assert.sh
Comment on lines +114 to +121
)" || {
printf 'lab_assert: compare_counts failed to parse JSON\n' >&2
return 1
}

printf '%s\n' "${result}"
[[ "$(jq -r '.outcome' <<<"${result}")" == "match" ]]
}
Comment thread hack/lab/lib/assert.sh
Comment on lines +88 to +91
if [[ -z "${expected}" || -z "${actual}" ]]; then
printf 'lab_assert: compare_counts requires expected and actual JSON\n' >&2
return 1
fi
Comment on lines +137 to +144
# Function may print JSON on stdout even on mismatch — accept stderr or stdout.
cmp_body="${cmp_mismatch:-$(cat "${TMP}/cmp.err")}"
# Re-run capturing both streams into a file via a subshell that ignores exit.
cmp_body="$(
set +e
lab_assert_compare_counts "${match_expected}" "${mismatch_actual}" >"${TMP}/cmp.out" 2>"${TMP}/cmp.err2"
cat "${TMP}/cmp.out"
)"
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants