Skip to content

Chunk review_auto and calibrate retrieval ranking #96

Chunk review_auto and calibrate retrieval ranking

Chunk review_auto and calibrate retrieval ranking #96

Workflow file for this run

name: Context Engine Review
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
permissions:
contents: read
security-events: write
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- name: Check version literal consistency
run: node --import tsx scripts/ci/check-version-literals.ts
- name: Check stale-cache correctness guard coverage
run: npm run ci:check:stale-cache-guards
- name: Check retrieval dependency boundary guard
run: npm run ci:check:retrieval-dependency-boundary
- name: Check no-legacy provider references
run: npm run ci:check:no-legacy-provider
- name: Check retrieval config precedence contract
run: npm run ci:check:retrieval-config-precedence
- name: Check retrieval provider dist/source parity
run: npm run ci:check:retrieval-provider-dist-parity
- name: Run migrated-family targeted matrix gate
run: npm run ci:matrix:migrated-families
- name: Check WS owner assignment lock (WS13-WS21)
run: npm run ci:check:ws-owner-assignment-lock
- name: Check rollout governance artifact templates
run: npm run ci:check:governance-artifacts
- name: Check rollout governance runtime artifacts (optional)
run: |
if [ -f artifacts/governance/pre-rollout-baseline-checklist.md ] && \
[ -f artifacts/governance/freeze-checklist.md ] && \
[ -f artifacts/governance/final-release-summary.md ] && \
[ -f artifacts/governance/rollout-evidence-log.md ]; then
node --import tsx scripts/ci/check-governance-artifacts.ts \
--pre-rollout artifacts/governance/pre-rollout-baseline-checklist.md \
--freeze artifacts/governance/freeze-checklist.md \
--final-release artifacts/governance/final-release-summary.md \
--rollout-evidence artifacts/governance/rollout-evidence-log.md
else
echo "Governance artifacts check: SKIP (missing one or more files in artifacts/governance/)"
fi
- name: Check WS21 rollback drill evidence completeness
run: npm run ci:check:ws21-rollback-drill
- name: Run review_diff
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
CE_REVIEW_INCLUDE_SARIF: "true"
CE_REVIEW_INCLUDE_MARKDOWN: "true"
CE_REVIEW_FAIL_ON_SEVERITY: "CRITICAL"
run: npx --no-install tsx scripts/ci/review-diff.ts
- name: Run WS19 SLO threshold gate (review family)
run: node --import tsx scripts/ci/ws19-slo-gate.ts --family review --artifact artifacts/review_diff_result.json
- name: Run WS20 rollout stage gate (optional artifact)
run: |
if [ -f artifacts/ws20-stage-evidence.yaml ]; then
node --import tsx scripts/ci/ws20-stage-gate.ts --artifact artifacts/ws20-stage-evidence.yaml
elif [ -f artifacts/ws20-stage-evidence.yml ]; then
node --import tsx scripts/ci/ws20-stage-gate.ts --artifact artifacts/ws20-stage-evidence.yml
elif [ -f artifacts/ws20-stage-evidence.json ]; then
node --import tsx scripts/ci/ws20-stage-gate.ts --artifact artifacts/ws20-stage-evidence.json
elif [ -f artifacts/ws20-stage-evidence.md ]; then
node --import tsx scripts/ci/ws20-stage-gate.ts --artifact artifacts/ws20-stage-evidence.md
else
echo "WS20 stage gate: SKIP (no artifact at artifacts/ws20-stage-evidence.{yaml,yml,json,md})"
fi
- name: Check review timeout contract
run: npm run -s ci:check:review-timeout-contract
- name: Run review auto timeout smoke
run: npm run -s ci:check:review-auto-timeout-smoke
- name: Check rollout readiness with review auto timeout smoke artifact
run: node --import tsx scripts/ci/check-rollout-readiness.ts artifacts/review_auto_timeout_smoke.json
- name: Upload review artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: review-diff-artifacts
path: artifacts/
if-no-files-found: ignore
- name: Upload SARIF
if: >
always() &&
hashFiles('artifacts/review_diff.sarif') != '' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: artifacts/review_diff.sarif
- name: Post PR comment
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false &&
hashFiles('artifacts/review_diff.md') != ''
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('artifacts/review_diff.md', 'utf8');
const marker = '<!-- context-engine-review -->';
const fullBody = `${marker}\n${body}`;
const issue_number = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const { data: comments } = await github.rest.issues.listComments({
owner, repo, issue_number, per_page: 100,
});
const existing = comments.find(c => typeof c.body === 'string' && c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner, repo,
comment_id: existing.id,
body: fullBody,
});
} else {
await github.rest.issues.createComment({
owner, repo, issue_number,
body: fullBody,
});
}