Skip to content

fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] [OMN-7998] - #257

Merged
jonahgabriel merged 8 commits into
mainfrom
jonah/fix-compliance-detached-head-2026-04-13
Apr 13, 2026
Merged

jonahgabriel merged 8 commits into
mainfrom
jonah/fix-compliance-detached-head-2026-04-13

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • _check_command now substitutes {pr} and {repo} placeholders before running any shell command, so DoD checks in contract YAML files work in GitHub Actions merge-ref (detached HEAD) context without relying on implicit git branch resolution
  • pre-commit commands are demoted to WARN (not BLOCK) when pre-commit is not installed in the runner; install it locally to run the check
  • contracts/OMN-7996.yaml and contracts/OMN-7998.yaml updated: bare gh pr view / gh pr checks --watch replaced with gh pr view {pr} --repo {repo} / gh pr checks {pr} --repo {repo} (removes --watch which blocks indefinitely in CI)
  • Two new unit tests cover the placeholder substitution path and the pre-commit-absent warn path

Affected PRs

Fixes the failing Contract Compliance Check gate on:

  • OmniNode-ai/omnidash#586 (OMN-7996)
  • OmniNode-ai/omnidash#587 (OMN-7998)

Test plan

  • uv run pytest tests/test_contract_compliance_check.py -v — all 23 tests pass
  • pre-commit run --all-files — clean
  • Self-dogfood: uv run python scripts/ci/run_contract_compliance_check.py --pr 586 --repo OmniNode-ai/omnidash --contracts-dir contracts — dod-001/002/003 PASS, dod-004 WARN (pre-commit installed locally, no BLOCK)
  • CI on this PR must pass Contract Compliance Check

Summary by CodeRabbit

  • New Features

    • PR/repo-scoped compliance checks now validate PR state and base branch (main) and require merge timestamps when applicable.
  • Bug Fixes

    • Invalid repository identifiers now produce a BLOCK result.
    • CI pre-commit handling improved: checks skip with WARN when tooling is unavailable; pre-commit config presence is asserted.
  • Tests

    • Added tests for placeholder substitution, repo validation, workspace forwarding, and pre-commit behavior.
  • Chores

    • Contract summary text updated.

…context [OMN-7996, OMN-7998]

- _check_command now substitutes {pr} and {repo} placeholders before execution,
  so contract YAML DoD checks don't rely on git branch context
- pre-commit commands demoted to WARN (not BLOCK) when pre-commit is not installed in runner
- contracts/OMN-7996.yaml and OMN-7998.yaml updated to use parameterized gh calls
  (gh pr view {pr} --repo {repo} ...) and gh pr checks without --watch
- Two new tests: placeholder substitution and pre-commit-absent warn path
@github-actions
github-actions Bot enabled auto-merge April 13, 2026 11:23
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@jonahgabriel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 45 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 45 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b793ac3a-c00c-4bb2-b5fa-2dc278953741

📥 Commits

Reviewing files that changed from the base of the PR and between 37d0839 and 99280e5.

📒 Files selected for processing (2)
  • contracts/OMN-7996.yaml
  • contracts/OMN-7998.yaml
📝 Walkthrough

Walkthrough

Updated contract YAML evidence to use {pr}/{repo} placeholders, narrowed gh query fields and filters, changed some check types; extended the compliance runner to validate and substitute repo/placeholders, run commands in the workspace, and special-case pre-commit handling; added tests for these behaviors.

Changes

Cohort / File(s) Summary
Contract Definitions
contracts/OMN-7996.yaml, contracts/OMN-7998.yaml
Replaced unscoped gh queries with parameterized commands using {pr} and --repo {repo}, expanded --json fields and text filtering (state/baseRefName/mergedAt), converted some command checks to test_passes or file_exists, and updated summary text.
Command Execution Logic
scripts/ci/run_contract_compliance_check.py
Changed _run to accept optional cwd; updated _check_command signature to accept pr_number and repo; validate repo against org/repo regex and BLOCK on invalid; substitute {pr}/{repo} into commands; special-case pre-commit presence and CI behavior; run commands with cwd=workspace; route command checks through updated call.
Test Coverage
tests/test_contract_compliance_check.py
Added tests for {pr}/{repo} placeholder substitution, forwarding cwd to subprocess, blocking invalid repo (BLOCK with “Invalid”), and multiple pre-commit scenarios (missing -> WARN/skipped; missing in CI -> WARN; present in CI -> executes and PASS).

Sequence Diagram(s)

sequenceDiagram
    participant Runner as Compliance Runner
    participant Validator as Repo Validator
    participant PreCommit as Pre-commit Checker
    participant Shell as Subprocess (sh / gh / which)

    Runner->>Validator: receive `repo` value
    Validator-->>Runner: valid / invalid
    alt invalid
        Runner-->>Runner: return BLOCK (Invalid repo)
    else valid
        Runner->>Runner: substitute `{pr}` and `{repo}` into command
        Runner->>PreCommit: is command a pre-commit invocation?
        alt pre-commit command
            PreCommit->>Shell: which pre-commit
            Shell-->>PreCommit: found / not found
            alt not found and (CI or local)
                Runner-->>Runner: return WARN (skipped pre-commit)
            else found
                Runner->>Shell: run substituted command in workspace (cwd)
                Shell-->>Runner: output / exit status
            end
        else other command
            Runner->>Shell: run substituted command in workspace (cwd)
            Shell-->>Runner: output / exit status
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hop through YAML, placeholder-bright,
Swapping {pr} and {repo} by moonlight,
I sniff for pre-commit, skip with a frown,
Or run in the workspace — carrot crown. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: fixing contract_compliance_check to handle detached-HEAD contexts in PR merge via placeholder substitution and repo parameterization, with specific issue references.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/fix-compliance-detached-head-2026-04-13

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: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@contracts/OMN-7996.yaml`:
- Around line 33-34: The current check item uses check_type: "command" with the
GH CLI invocation, which bypasses the repository's standardized handling in
_check_test_passes; replace this entry to use check_type: "test_passes" (keeping
the same gh pr checks payload or equivalent identifier) so the framework invokes
_check_test_passes and converts non-green states into BLOCK/WARN as intended;
locate the YAML entry with check_type: "command" and check_value: "gh pr checks
{pr} --repo {repo} --json name,state" and change the type to test_passes so the
standardized logic is used.
- Around line 22-28: The current command checks under id "dod-002" only request
mergedAt/state and can succeed even if the PR is not targeting main; update the
check_value to query baseRefName along with state/mergedAt (use gh pr view
--repo {repo} {pr} --json baseRefName,state,mergedAt) and make the -q expression
assert baseRefName == "main" and the expected state/mergedAt (e.g. for merged:
.baseRefName=="main" and .mergedAt!=null, or for open: .baseRefName=="main" and
.state=="OPEN"); modify the check_value strings in both places to use a combined
JSON query so the command returns non‑zero when the branch or state/timestamp is
not as expected and ensure this change is applied to the check where check_type
is "command" (id "dod-002") and any related _check_command usage.

In `@contracts/OMN-7998.yaml`:
- Around line 33-34: The current contract entry uses check_type: "command" with
check_value "gh pr checks {pr} --repo {repo} --json name,state"; replace this
with check_type: "test_passes" (or the equivalent token your schema expects) so
that the existing _check_test_passes logic is invoked instead of running the raw
command; specifically, change the check_type field for the entry containing
check_value "gh pr checks {pr} --repo {repo} --json name,state" to "test_passes"
so _check_test_passes will parse check names and convert non-green states into
BLOCK/WARN as intended.
- Around line 22-28: The gh command checks (the check_value entries that call
"gh pr view {pr} --repo {repo} --json state -q .state" and "gh pr view {pr}
--repo {repo} --json mergedAt -q .mergedAt" under id "dod-002") only fetch
state/mergedAt and can succeed for PRs not targeting main; update those checks
to assert baseRefName=="main" as well and fail with a non-zero exit when either
condition is not met — i.e., call gh pr view to fetch both baseRefName and
state/mergedAt and combine checks so the shell returns non-zero unless
baseRefName equals "main" and state==MERGED (or mergedAt is non-empty) to ensure
the check truly verifies the PR targets main and is merged.

In `@tests/test_contract_compliance_check.py`:
- Around line 152-161: The test test_check_command_placeholder_substitution
currently only verifies exit status and would pass without actual substitution;
update it to mock the internal runner function (e.g., _run) and assert that _run
was invoked with the command string after placeholders are substituted (e.g.,
"echo pr=586 repo=OmniNode-ai/omnidash") when calling _check_command with
pr_number=586 and repo="OmniNode-ai/omnidash"; keep the existing assertion for
result but add the mock assertion to ensure placeholders are actually replaced
before execution.
🪄 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

Run ID: 98faea2e-dc30-4440-84d6-d5e57a2b7129

📥 Commits

Reviewing files that changed from the base of the PR and between ed1599a and 3fd0431.

📒 Files selected for processing (4)
  • contracts/OMN-7996.yaml
  • contracts/OMN-7998.yaml
  • scripts/ci/run_contract_compliance_check.py
  • tests/test_contract_compliance_check.py

Comment thread contracts/OMN-7996.yaml Outdated
Comment thread contracts/OMN-7996.yaml Outdated
Comment thread contracts/OMN-7998.yaml Outdated
Comment thread contracts/OMN-7998.yaml Outdated
Comment thread tests/test_contract_compliance_check.py Outdated
…ful tests + state assertion

- Validate {repo} against ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ before substitution;
  adversarial values return BLOCK instead of reaching sh -c
- test_check_command_placeholder_substitution now captures the executed command
  and asserts 586/OmniNode-ai/omnidash appear and no literal {pr}/{repo} remain
- Add test_check_command_invalid_repo_blocks for the new validation path
- dod-001 in OMN-7996 and OMN-7998: pipe state through grep -E '^(OPEN|MERGED)$'
  so CLOSED PRs fail the check
- pre-commit demotion now also triggers on CI=true env var (finding #4)
- Add test_check_command_precommit_skipped_in_ci for CI gate path
- Fix truncated summary in contracts/OMN-7996.yaml (finding #5)

@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

🧹 Nitpick comments (2)
tests/test_contract_compliance_check.py (2)

202-209: Make the CI pre-commit test hermetic.

This test depends on whatever which pre-commit returns on the host, so it does not actually force the “installed but still skipped because CI=true” path. Mock _run to report pre-commit present and keep the assertion focused on the CI-specific behavior.

Suggested tightening
 def test_check_command_precommit_skipped_in_ci(
     tmp_path: Path, monkeypatch: pytest.MonkeyPatch
 ) -> None:
     """In CI=true, pre-commit is always skipped regardless of installation."""
     monkeypatch.setenv("CI", "true")
-    result, detail = _check_command("pre-commit run --all-files", tmp_path)
+    with patch(
+        "run_contract_compliance_check._run",
+        return_value=(0, "/usr/bin/pre-commit", ""),
+    ):
+        result, detail = _check_command("pre-commit run --all-files", tmp_path)
     assert result == _RESULT_WARN
     assert "CI" in detail or "skipped" in detail
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_contract_compliance_check.py` around lines 202 - 209, The test
test_check_command_precommit_skipped_in_ci is non-hermetic because it relies on
the real PATH; modify it to monkeypatch/mock the internal helper _run (the one
used by _check_command) to return a result that indicates "pre-commit" is
present (e.g., a successful which-like response) while still setting CI=true, so
_check_command exercises the "installed but skipped due to CI" branch; ensure
the mock only affects the external check and keep the existing assertions that
result == _RESULT_WARN and that the detail contains "CI" or "skipped".

177-186: Assert that invalid repo input never reaches _run.

This currently proves the return value, but not the “reject before execution” guarantee. If _check_command() regressed and still spawned a subprocess before returning BLOCK, this test would miss it.

Suggested tightening
 def test_check_command_invalid_repo_blocks(tmp_path: Path) -> None:
     """Adversarial repo value must be rejected before shell substitution."""
-    result, detail = _check_command(
-        "gh pr view {pr} --repo {repo}",
-        tmp_path,
-        pr_number=1,
-        repo="evil; rm -rf /",
-    )
+    with patch("run_contract_compliance_check._run") as run:
+        result, detail = _check_command(
+            "gh pr view {pr} --repo {repo}",
+            tmp_path,
+            pr_number=1,
+            repo="evil; rm -rf /",
+        )
     assert result == _RESULT_BLOCK
     assert "Invalid" in detail
+    run.assert_not_called()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_contract_compliance_check.py` around lines 177 - 186, Modify the
test to assert that _run is never invoked by monkeypatching the module-level
_run used by _check_command to a stub that raises if called (e.g., def
_run_should_not_be_called(*a, **k): raise AssertionError("_run was called");
monkeypatch.setattr(<module_where__check_command_is_defined> , "_run",
_run_should_not_be_called)), then call _check_command("gh pr view {pr} --repo
{repo}", tmp_path, pr_number=1, repo="evil; rm -rf /") and assert the returned
result is _RESULT_BLOCK and the detail contains "Invalid"; this ensures the
function returns BLOCK before any subprocess is spawned. Ensure you reference
the same _check_command and _run symbols from the module under test when
patching.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/ci/run_contract_compliance_check.py`:
- Around line 216-256: The command-check currently runs shell commands in the
process CWD so --workspace is ignored; modify the _run(...) helper to accept a
cwd: Path|None and pass cwd=str(cwd) (or None) into subprocess.run(...,
cwd=...), then update _check_command to call _run(["which","pre-commit"],
timeout=5, cwd=_workspace) and _run(["sh","-c", cmd_str], timeout=60,
cwd=_workspace) (ensure _workspace is passed as a Path and converted in _run).
This ensures both the pre-commit existence check and the command invocation
honor the workspace override.
- Around line 244-255: The current condition treats CI as a reason to skip
pre-commit (in_ci or rc_which != 0), which disables enforcement in CI; change
the logic so we only skip when pre-commit is not installed. In the block that
checks cmd_str.lstrip().startswith("pre-commit"), keep the _run(["which",
"pre-commit"], ...) call and then only branch on rc_which != 0 (remove the in_ci
OR), printing the same warn message and returning _RESULT_WARN and the message
if pre-commit is missing; otherwise proceed to run the pre-commit check even
when CI=true (use the existing variables cmd_str, in_ci, rc_which, _run, and the
return values _RESULT_WARN).

---

Nitpick comments:
In `@tests/test_contract_compliance_check.py`:
- Around line 202-209: The test test_check_command_precommit_skipped_in_ci is
non-hermetic because it relies on the real PATH; modify it to monkeypatch/mock
the internal helper _run (the one used by _check_command) to return a result
that indicates "pre-commit" is present (e.g., a successful which-like response)
while still setting CI=true, so _check_command exercises the "installed but
skipped due to CI" branch; ensure the mock only affects the external check and
keep the existing assertions that result == _RESULT_WARN and that the detail
contains "CI" or "skipped".
- Around line 177-186: Modify the test to assert that _run is never invoked by
monkeypatching the module-level _run used by _check_command to a stub that
raises if called (e.g., def _run_should_not_be_called(*a, **k): raise
AssertionError("_run was called");
monkeypatch.setattr(<module_where__check_command_is_defined> , "_run",
_run_should_not_be_called)), then call _check_command("gh pr view {pr} --repo
{repo}", tmp_path, pr_number=1, repo="evil; rm -rf /") and assert the returned
result is _RESULT_BLOCK and the detail contains "Invalid"; this ensures the
function returns BLOCK before any subprocess is spawned. Ensure you reference
the same _check_command and _run symbols from the module under test when
patching.
🪄 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

Run ID: 4dac8430-f801-41dc-a309-4b1c297d3296

📥 Commits

Reviewing files that changed from the base of the PR and between 3fd0431 and 3c0c73b.

📒 Files selected for processing (4)
  • contracts/OMN-7996.yaml
  • contracts/OMN-7998.yaml
  • scripts/ci/run_contract_compliance_check.py
  • tests/test_contract_compliance_check.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • contracts/OMN-7996.yaml
  • contracts/OMN-7998.yaml

Comment thread scripts/ci/run_contract_compliance_check.py Outdated
Comment thread scripts/ci/run_contract_compliance_check.py
@jonahgabriel jonahgabriel changed the title fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] Apr 13, 2026
@jonahgabriel jonahgabriel changed the title fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] Apr 13, 2026
@jonahgabriel jonahgabriel changed the title fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] fix(ci): resolve contract_compliance_check detached-HEAD in PR merge context [OMN-7996] [OMN-7998] Apr 13, 2026
…tighter precommit gate [OMN-7996, OMN-7998]

- dod-001: extend gh pr view to query baseRefName; awk gate fails if base != main
- dod-003: switch from raw command to test_passes check type in both contracts
- _check_command: pass workspace as cwd to subprocess so --workspace is honored
- CI demotion: narrow from CI=true alone to (binary absent AND in CI); installed pre-commit enforces even in CI
- test: assert exact rendered shell string in substitution test; add workspace cwd test; add present-in-CI enforces test
…e-commit gate

Replace {pr}/{repo} template literals with actual values (PR 588,
OmniNode-ai/omnidash). Replace pre-commit runtime command with
file_exists check for .pre-commit-config.yaml — pre-commit is not
installed in CI runners.

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/test_contract_compliance_check.py`:
- Around line 217-259: Update the tests to deterministically exercise the non-CI
and CI paths and to validate that the actual subprocess calls occur: in
test_check_command_precommit_missing_not_ci_warns add a monkeypatch fixture and
call monkeypatch.delenv("CI", raising=False) so CI is unset, then assert the
detail equals the exact expected message returned by _check_command for a
missing pre-commit (use the literal string produced by _check_command) instead
of a loose "skipped" containment; in
test_check_command_precommit_present_in_ci_enforces capture the patched _run
(assign the context manager to a mock like mock_run) and after calling
_check_command assert mock_run.call_count == 2 and that the second call's
args/kwargs correspond to running "pre-commit run --all-files" so you prove the
pre-commit run actually executed while CI is set, and keep the result assertion
against _RESULT_PASS.
🪄 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

Run ID: 3736e663-6a15-4c68-8908-2921fcbc0e56

📥 Commits

Reviewing files that changed from the base of the PR and between 3c0c73b and 9f06654.

📒 Files selected for processing (4)
  • contracts/OMN-7996.yaml
  • contracts/OMN-7998.yaml
  • scripts/ci/run_contract_compliance_check.py
  • tests/test_contract_compliance_check.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • contracts/OMN-7998.yaml
  • contracts/OMN-7996.yaml

Comment thread tests/test_contract_compliance_check.py Outdated
…heck

dod-002 previously only checked mergedAt existed; CodeRabbit flagged
it can pass on PRs not targeting main. Now asserts both non-empty
mergedAt and baseRefName==main via awk, consistent with dod-001.
- delenv CI in missing-not-ci test to pin non-CI path
- assert exact detail string instead of loose "skipped" containment
- capture _run calls in present-in-ci test to prove subprocess ran
…placeholder literals [OMN-7996, OMN-7998]

OMN-7998: dod-002 used mergedAt check which always BLOCKs on open PRs since
mergedAt is null. Changed to same OPEN|MERGED base-branch assertion as dod-001.

OMN-7996: dod-001 and dod-002 had {pr}/{repo} placeholder literals never
replaced with actual values. Substituted PR 586 / OmniNode-ai/omnidash.
Changed dod-004 from pre-commit run (fails in CI) to file_exists check.

@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.

🧹 Nitpick comments (1)
tests/test_contract_compliance_check.py (1)

233-246: Consider asserting the exact detail message for consistency.

This test asserts "skipped" in detail while the sibling test on line 230 asserts the exact message. For consistency and to prevent false positives, consider asserting the exact detail string.

Suggested tightening
     assert result == _RESULT_WARN
-    assert "skipped" in detail
+    assert detail == "pre-commit check skipped (binary absent in CI)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_contract_compliance_check.py` around lines 233 - 246, Replace the
loose substring check in test_check_command_precommit_absent_and_ci_warns with
an exact equality assertion for the detail message: update the assertion that
currently does assert "skipped" in detail to assert detail == "<use the exact
detail string used by the sibling test>" so it matches the exact message
produced by _check_command when pre-commit is absent (and still returns
_RESULT_WARN); locate the sibling test’s exact expected string and copy it here
to ensure consistency with _check_command behavior and the other test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/test_contract_compliance_check.py`:
- Around line 233-246: Replace the loose substring check in
test_check_command_precommit_absent_and_ci_warns with an exact equality
assertion for the detail message: update the assertion that currently does
assert "skipped" in detail to assert detail == "<use the exact detail string
used by the sibling test>" so it matches the exact message produced by
_check_command when pre-commit is absent (and still returns _RESULT_WARN);
locate the sibling test’s exact expected string and copy it here to ensure
consistency with _check_command behavior and the other test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5473df4-dd8f-4c65-b77e-986771552a52

📥 Commits

Reviewing files that changed from the base of the PR and between 9f06654 and 37d0839.

📒 Files selected for processing (2)
  • contracts/OMN-7998.yaml
  • tests/test_contract_compliance_check.py

@jonahgabriel
jonahgabriel merged commit 1e17e6a into main Apr 13, 2026
23 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/fix-compliance-detached-head-2026-04-13 branch April 13, 2026 16:42
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