Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/openrouter-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FlyOverCoderKY/openrouter-pr-review-action
ref: 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
ref: 212775ffea22e806cddcb706c73a3df26fbcb6d0
path: .trusted-review-action
persist-credentials: false
- name: Resolve pending review request
Expand All @@ -401,7 +401,7 @@ jobs:
- name: Prepare shared review snapshot
id: profile_setup
if: inputs.review_profiles_enabled
uses: FlyOverCoderKY/openrouter-pr-review-action@5bb16c7a5ba87a802d7884ccbfa5e99d10978a49 # action#40 settled-dispute receipt validation
uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0 # action#41 rebase scope and review history
with:
role: setup
github_token: ${{ github.token }}
Expand Down Expand Up @@ -449,7 +449,7 @@ jobs:
id: openrouter_first
if: steps.profile_request.outputs.skip_review != 'true'
timeout-minutes: 25
uses: FlyOverCoderKY/openrouter-pr-review-action@5bb16c7a5ba87a802d7884ccbfa5e99d10978a49 # action#40 settled-dispute receipt validation
uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0 # action#41 rebase scope and review history
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
with:
Expand Down Expand Up @@ -544,8 +544,8 @@ jobs:
# never masks a failed or stale fresh first pass.
# - synchronize: a prior bot-authored initial review may carry only when its
# explicit reviewed commit is the current head or an ancestor of it.
# - force-push/divergence: historical carry is rejected; a fresh initial
# OpenRouter review on the new lineage is required.
# - force-push/divergence: historical carry is rejected; a fresh full-PR
# initial, full-PR verification, or rebase review on the new lineage is required.
openrouter-first-pass-gate:
name: openrouter-first-pass-gate
needs: [openrouter-first-pass]
Expand Down Expand Up @@ -604,7 +604,7 @@ jobs:
exit 1
fi

# A carry candidate must be a real bot-authored initial or full-PR verify
# A carry candidate must be a real bot-authored initial, full-PR verify, or rebase
# review. Verification requires a ledger. Initial partials
# are ledgerless by design. Both must expose the explicit Commit line,
# and that SHA must be identical to or an ancestor of the current
Expand Down Expand Up @@ -648,7 +648,8 @@ jobs:
(.body | contains("## OpenRouter pull-request review")) and
((.body | contains("**Mode:** `initial`")) or
((.body | contains("**Mode:** `verify`")) and
(.body | contains("**Scope:** `full-pr`")) and
((.body | contains("**Scope:** `full-pr` (full-pr)")) or
(.body | contains("**Scope:** `rebase` (full-pr)"))) and
(.body | contains("<!-- openrouter-review-ledger:v1:")))) and
((.body | contains("<!-- openrouter-review-ledger:v1:")) or
(.body | contains("**Verdict:** `partial`"))) and
Expand Down Expand Up @@ -714,7 +715,7 @@ jobs:
succeed "$existing_url" "OpenRouter first-pass at ${existing_sha} appeared in the current lineage; carried onto ${HEAD_SHA}."
fi
done
echo "::error::Timed out waiting for a lineage-valid OpenRouter first-pass review. A force-pushed/diverged head requires a fresh full initial review."
echo "::error::Timed out waiting for a lineage-valid OpenRouter first-pass review. A force-pushed/diverged head requires a completed full-PR or rebase review on the new lineage."
exit 1

openrouter-follow-up:
Expand Down Expand Up @@ -826,7 +827,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FlyOverCoderKY/openrouter-pr-review-action
ref: 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
ref: 212775ffea22e806cddcb706c73a3df26fbcb6d0
path: .trusted-review-action
persist-credentials: false
- name: Resolve pending review request
Expand All @@ -845,7 +846,7 @@ jobs:
- name: Prepare shared review snapshot
id: profile_setup
if: inputs.review_profiles_enabled && steps.seeded.outputs.ready == 'true'
uses: FlyOverCoderKY/openrouter-pr-review-action@5bb16c7a5ba87a802d7884ccbfa5e99d10978a49 # action#40 settled-dispute receipt validation
uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0 # action#41 rebase scope and review history
with:
role: setup
github_token: ${{ github.token }}
Expand Down Expand Up @@ -893,7 +894,7 @@ jobs:
id: openrouter_followup
if: steps.seeded.outputs.ready == 'true' && steps.profile_request.outputs.skip_review != 'true'
timeout-minutes: 25
uses: FlyOverCoderKY/openrouter-pr-review-action@5bb16c7a5ba87a802d7884ccbfa5e99d10978a49 # action#40 settled-dispute receipt validation
uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0 # action#41 rebase scope and review history
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/openrouter-profile-completion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FlyOverCoderKY/openrouter-pr-review-action
ref: 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
ref: 212775ffea22e806cddcb706c73a3df26fbcb6d0
path: .trusted-review-action
persist-credentials: false
- name: Resolve current profile evidence
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FlyOverCoderKY/openrouter-pr-review-action
ref: 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
ref: 212775ffea22e806cddcb706c73a3df26fbcb6d0
path: .trusted-review-action
persist-credentials: false
- name: Confirm current profile evidence
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FlyOverCoderKY/openrouter-pr-review-action
ref: 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
ref: 212775ffea22e806cddcb706c73a3df26fbcb6d0
path: .trusted-review-action
persist-credentials: false
- name: Publish only completed current proofs
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ Organization-wide defaults for [RetireGolden](https://github.com/RetireGolden).
Manual OpenRouter reruns review the full PR and continue its existing review
ledger, including finding IDs and rebuttals. Without a ledger they seed an
initial review. The optional `reset_review` boolean explicitly starts over;
leave it `false` for ordinary reruns. Pushes retain their latest-commit scope.
The stable completion gate recognizes a completed full-PR verification as
leave it `false` for ordinary reruns. Pushes normally retain latest-commit scope;
a rebase or force-push selects `rebase` scope for a full diff at all severities,
with historical reviews and replies. It preserves finding IDs and round
progression, checks whether earlier disputes still hold, and reopens them only
with evidence from current code. Fixed or retired findings remain historical
context. The action bounds this narrative and freezes it across prepared lanes.
The stable completion gate recognizes a completed rebase or full-PR verification as
well as an initial review, while retaining current-head and run-output checks.
This completion gate is separate from each repository's clean-review CI gate.

Expand All @@ -26,7 +31,7 @@ added in a PR becomes authoritative only after it merges.

Use concise prose to describe repository contracts, with nested files for
component-specific invariants. See the action's
[file format, offline lint/explain commands, and trust rules](https://github.com/FlyOverCoderKY/openrouter-pr-review-action/blob/5bb16c7a5ba87a802d7884ccbfa5e99d10978a49/docs/review-policy.md).
[file format, offline lint/explain commands, and trust rules](https://github.com/FlyOverCoderKY/openrouter-pr-review-action/blob/212775ffea22e806cddcb706c73a3df26fbcb6d0/docs/review-policy.md).
In this guidance rollout, `profile: code` and `profile: docs` are descriptive;
they do not select models by themselves.

Expand Down Expand Up @@ -234,7 +239,7 @@ Local workflow contract checks:
```sh
# Obtain the pinned public action contracts outside product source.
git clone --no-checkout https://github.com/FlyOverCoderKY/openrouter-pr-review-action .trusted-review-action
git -C .trusted-review-action checkout 5bb16c7a5ba87a802d7884ccbfa5e99d10978a49
git -C .trusted-review-action checkout 212775ffea22e806cddcb706c73a3df26fbcb6d0
export PYTHONPATH="$PWD/.trusted-review-action/src"
uv run --with jq --with pyyaml python -m unittest discover -s tests
node --test tests/profile-consumer.test.mjs tests/workflow-wakeup.test.mjs
Expand Down
5 changes: 4 additions & 1 deletion scripts/profile_consumer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,15 @@ function validateReceipt(value, bindings, raw) {
if (!['clean', 'issues', 'partial', 'error'].includes(value.verdict)) {
throw new Error('verdict is invalid');
}
if (!['full-pr', 'latest-commit'].includes(value.scope)) {
if (!['full-pr', 'latest-commit', 'rebase'].includes(value.scope)) {
throw new Error('scope is invalid');
}
if (!['initial', 'verify'].includes(value.mode)) {
throw new Error('mode is invalid');
}
if (value.scope === 'rebase' && value.mode !== 'verify') {
throw new Error('rebase requires verify mode');
}
const runUrl = value.run_url;
const runUrlRe = new RegExp(
`^https://[A-Za-z0-9][A-Za-z0-9.-]*/${value.repository.replace('/', '\\/')}/actions/runs/[1-9][0-9]*$`,
Expand Down
12 changes: 10 additions & 2 deletions tests/profile-consumer.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ function reviewBody(receipt, digest) {
'## OpenRouter pull-request review',
'',
'**Verdict:** `clean`',
'**Scope:** `full-pr` (full-pr)',
'**Mode:** `initial`',
`**Scope:** \`${receipt.scope}\` (full-pr)`,
`**Mode:** \`${receipt.mode}\``,
`**Commit:** \`${HEAD_SHA}\``,
`${RECEIPT_MARKER_PREFIX}${marker} -->`,
'**Profile:** satisfied',
Expand Down Expand Up @@ -314,6 +314,14 @@ function authorizeContext(store, overrides = {}) {
}

describe('authorizeProfileReceipt', () => {
it('authorizes rebase verification with current proof and rejects an initial rebase', async () => {
for (const mode of ['verify', 'initial']) {
const { github, store } = buildStore({ receiptOverrides: { scope: 'rebase', mode } });
const result = await authorizeProfileReceipt(github, authorizeContext(store));
assert.equal(result.authorized, mode === 'verify');
}
});

it('authorizes a current valid proof', async () => {
const { github, store } = buildStore();
const result = await authorizeProfileReceipt(github, authorizeContext(store));
Expand Down
5 changes: 4 additions & 1 deletion tests/test_profile_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def bundle_for(
"topic",
DiffPlan(
scope,
"full-pr" if scope == "full-pr" else "commit-range",
"full-pr" if scope in {"full-pr", "rebase"} else "commit-range",
BASE if scope != "full-pr" else BASE,
head_sha,
None,
Expand Down Expand Up @@ -473,6 +473,9 @@ def test_collect_initial_standard_and_verify_deep(self):
("standard", "baseline", "initial", "full-pr", JOB_INITIAL),
("deep", "manual", "initial", "full-pr", JOB_INITIAL),
("standard", "baseline", "verify", "latest-commit", JOB_VERIFY),
("standard", "baseline", "verify", "full-pr", JOB_VERIFY),
("standard", "baseline", "verify", "rebase", JOB_VERIFY),
("deep", "manual", "verify", "rebase", JOB_VERIFY),
):
with self.subTest(level=level, mode=mode):
store = self.make_store()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_profile_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(ROOT / '.github/workflows/openrouter-profile-completion.yml').read_text(encoding='utf-8'),
Loader=yaml.BaseLoader,
)
ACTION_PIN = '5bb16c7a5ba87a802d7884ccbfa5e99d10978a49'
ACTION_PIN = '212775ffea22e806cddcb706c73a3df26fbcb6d0'


def job_steps(workflow, job_id):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_review_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
JOBS = WORKFLOW['jobs']
CONFIG = JOBS['review-config']
ACTION_PIN = '5bb16c7a5ba87a802d7884ccbfa5e99d10978a49'
ACTION_PIN = '212775ffea22e806cddcb706c73a3df26fbcb6d0'
SCRIPT = next(step['run'] for step in CONFIG['steps'] if step.get('id') == 'config')
REGISTRY = json.dumps(
json.loads((ROOT / 'review-profiles.json').read_text(encoding='utf-8')),
Expand Down
8 changes: 7 additions & 1 deletion tests/test_review_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ def selected(
ledger=True,
author="github-actions[bot]",
verdict="clean",
kind="full-pr",
):
body = (
"## OpenRouter pull-request review\n"
f"**Mode:** `{mode}`\n**Scope:** `{scope}` (full-pr)\n"
f"**Mode:** `{mode}`\n**Scope:** `{scope}` ({kind})\n"
f"**Verdict:** `{verdict}`\n**Commit:** `{'a' * 40}`\n"
)
if ledger:
Expand All @@ -53,6 +54,11 @@ def selected(
def test_full_pr_verify_is_completion_evidence(self):
self.assertTrue(self.selected())

def test_rebase_verify_requires_full_diff_and_ledger(self):
self.assertTrue(self.selected(scope="rebase"))
self.assertFalse(self.selected(scope="rebase", ledger=False))
self.assertFalse(self.selected(scope="rebase", kind="single-commit"))

def test_initial_completion_still_works(self):
for verdict in ("clean", "issues", "partial"):
self.assertTrue(
Expand Down