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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@
"test:unit": "vitest run test/unit",
"test:integration": "vitest run test/integration",
"test:upstream-contract": "vitest run test/contract/upstream-contract.test.ts",
"test:engine-parity": "vitest run test/contract/engine-parity.test.ts",
"test:changed": "vitest run --changed=origin/main",
"test:workers": "vitest run --config vitest.workers.config.ts",
"test:coverage": "vitest run --coverage",
"test:smoke:production": "node scripts/smoke-production.mjs",
"test:smoke:observability": "node scripts/smoke-observability-traces.mjs",
"test:smoke:browser:install": "playwright install chromium",
"test:smoke:browser": "node scripts/smoke-ui-browser.mjs",
"test:ci": "git diff --check && npm run actionlint && npm run db:migrations:check && npm run db:schema-drift:check && npm run selfhost:env-reference:check && npm run selfhost:validate-observability && npm run cf-typegen:check && npm run typecheck && npm run test:coverage && npm run test:workers && npm run build:mcp && npm run test:mcp-pack && npm run build:miner && npm run test:miner-pack && npm run rees:test && npm run ui:openapi:check && npm run ui:openapi:settings-parity && npm run ui:version-audit && npm run docs:drift-check && npm run command-reference:check && npm run ui:lint && npm run ui:typecheck && npm run ui:test && npm run ui:build",
"test:ci": "git diff --check && npm run actionlint && npm run db:migrations:check && npm run db:schema-drift:check && npm run selfhost:env-reference:check && npm run selfhost:validate-observability && npm run cf-typegen:check && npm run typecheck && npm run test:coverage && npm run test:engine-parity && npm run test:workers && npm run build:mcp && npm run test:mcp-pack && npm run build:miner && npm run test:miner-pack && npm run rees:test && npm run ui:openapi:check && npm run ui:openapi:settings-parity && npm run ui:version-audit && npm run docs:drift-check && npm run command-reference:check && npm run ui:lint && npm run ui:typecheck && npm run ui:test && npm run ui:build",
"test:release": "npm run test:ci && npm run changelog:check",
"test:release:mcp": "npm run test:ci && npm run changelog:check:mcp",
"test:watch": "vitest",
Expand Down
25 changes: 25 additions & 0 deletions scripts/record-engine-parity-goldens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { mkdirSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

import { buildPredictedGateVerdict } from "../src/rules/predicted-gate.ts";
import { predictedGateFixtures } from "../test/fixtures/engine-parity/predicted-gate/index.ts";

const repoRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
const goldenDir = join(repoRoot, "test/fixtures/engine-parity/predicted-gate/golden");

mkdirSync(goldenDir, { recursive: true });

for (const fixture of predictedGateFixtures) {
const verdict = buildPredictedGateVerdict({
input: fixture.input,
manifest: fixture.manifest,
repo: fixture.repo,
issues: fixture.issues,
pullRequests: fixture.pullRequests,
...(fixture.changedPaths ? { changedPaths: fixture.changedPaths } : {}),
});
writeFileSync(join(goldenDir, `${fixture.id}.json`), `${JSON.stringify(verdict, null, 2)}\n`, "utf8");
}

process.stdout.write(`Recorded ${predictedGateFixtures.length} predicted-gate goldens in ${goldenDir}\n`);
48 changes: 48 additions & 0 deletions test/contract/engine-parity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Golden-snapshot parity suite for predicted-gate (#2286).
*
* Each fixture under `test/fixtures/engine-parity/predicted-gate/` is run through the public
* `buildPredictedGateVerdict` re-export surface (`src/rules/predicted-gate.ts`) and compared
* byte-for-byte against a committed golden JSON in `golden/`. This catches silent drift when
* engine extraction or refactors change gate output without updating fixtures.
*
* To intentionally refresh goldens after a deliberate gate-behavior change, run:
* `npx tsx scripts/record-engine-parity-goldens.ts`
*/
import { readFileSync, readdirSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";

import { buildPredictedGateVerdict } from "../../src/rules/predicted-gate";
import { predictedGateFixtures } from "../fixtures/engine-parity/predicted-gate";

const FIXTURE_DIR = join(process.cwd(), "test", "fixtures", "engine-parity", "predicted-gate");
const GOLDEN_DIR = join(FIXTURE_DIR, "golden");

describe("predicted-gate engine parity (#2286)", () => {
it("has one committed golden per scenario fixture", () => {
const scenarioFiles = readdirSync(FIXTURE_DIR)
.filter((name) => name.endsWith(".ts") && name !== "index.ts" && !name.startsWith("_"))
.sort();
const goldenFiles = readdirSync(GOLDEN_DIR)
.filter((name) => name.endsWith(".json"))
.sort();

expect(goldenFiles).toEqual(scenarioFiles.map((name) => name.replace(/\.ts$/, ".json")));
expect(predictedGateFixtures).toHaveLength(scenarioFiles.length);
});

it.each(predictedGateFixtures)("$id matches the committed golden output", (fixture) => {
const golden = JSON.parse(readFileSync(join(GOLDEN_DIR, `${fixture.id}.json`), "utf8"));
const verdict = buildPredictedGateVerdict({
input: fixture.input,
manifest: fixture.manifest,
repo: fixture.repo,
issues: fixture.issues,
pullRequests: fixture.pullRequests,
...(fixture.changedPaths ? { changedPaths: fixture.changedPaths } : {}),
});

expect(verdict).toEqual(golden);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "success",
"title": "Gittensory Orb Review Agent passed",
"summary": "No configured hard blocker was found. Advisory findings, if any, stay advisory.",
"readinessScore": 95,
"blockers": [],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"predicted": true,
"basis": "public_config",
"pack": "oss-anti-slop",
"conclusion": "success",
"title": "Gittensory Orb Review Agent passed",
"summary": "No configured hard blocker was found. Advisory findings, if any, stay advisory.",
"readinessScore": 95,
"blockers": [],
"warnings": [],
"funnel": {
"message": "This repo runs the Gittensor anti-slop gate. Gittensor lets GitHub contributors earn for open-source work like this — register to start earning.",
"registerUrl": "https://gittensor.io"
},
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "failure",
"title": "Gittensory Orb Review Agent: Linked issue overlaps another open PR",
"summary": "Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.",
"readinessScore": 69,
"blockers": [
{
"code": "duplicate_pr_risk",
"title": "Linked issue overlaps another open PR",
"detail": "Other open pull requests reference the same linked issue set: #42.",
"action": "Review the related PRs before spending reviewer time on duplicate work."
}
],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "success",
"title": "Gittensory Orb Review Agent passed",
"summary": "No configured hard blocker was found. Advisory findings, if any, stay advisory.",
"readinessScore": 95,
"blockers": [],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. The size-hold prediction uses changed FILE count only, not changed LINE count (line-diff stats are not available pre-submission), so it may under-predict a hold for a PR with many changed lines across few files. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "failure",
"title": "Gittensory Orb Review Agent: No linked issue detected",
"summary": "No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.",
"readinessScore": 80,
"blockers": [
{
"code": "missing_linked_issue",
"title": "No linked issue detected",
"detail": "No closing reference or linked issue number was found in the PR metadata/body.",
"action": "If this PR is intended to solve an issue, link it explicitly in the PR body."
}
],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "failure",
"title": "Gittensory Orb Review Agent: Pre-merge check not satisfied: Tests for src",
"summary": "Pre-merge check not satisfied: Tests for src — Update the PR to satisfy the check, then re-run the gate.",
"readinessScore": 95,
"blockers": [
{
"code": "pre_merge_check_required",
"title": "Pre-merge check not satisfied: Tests for src",
"detail": "This PR does not satisfy the maintainer pre-merge check \"Tests for src\": the title must contain \"ZZZ-never\".",
"action": "Update the PR to satisfy the check, then re-run the gate."
}
],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. The size-hold prediction uses changed FILE count only, not changed LINE count (line-diff stats are not available pre-submission), so it may under-predict a hold for a PR with many changed lines across few files. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "success",
"title": "Gittensory Orb Review Agent passed",
"summary": "No configured hard blocker was found. Advisory findings, if any, stay advisory.",
"readinessScore": 95,
"blockers": [],
"warnings": [],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"predicted": true,
"basis": "public_config",
"pack": "gittensor",
"conclusion": "success",
"title": "Gittensory Orb Review Agent passed",
"summary": "No configured hard blocker was found. Advisory findings, if any, stay advisory.",
"readinessScore": 80,
"blockers": [],
"warnings": [
{
"code": "readiness_score_below_threshold",
"title": "Readiness score is below the configured threshold",
"detail": "The public readiness score is 80/100, below the repository threshold of 90/100.",
"action": "Use the readiness panel as advisory maintainer context; the score does not block this PR."
}
],
"funnel": null,
"note": "Predicted from the repo's public .gittensory.yml gate config + safe defaults. The maintainer may have private dashboard overrides not reflected here, and the dual-model AI-consensus blocker is only evaluated on a real PR. The slop score is NOT evaluated pre-submission (it needs the diff content) and may still fail the real gate. Provide the PR's changed paths to also predict the focus-manifest path policy, the size/guardrail hold, and any pre-merge check scoped to changed paths; without them only path-independent title/description/label pre-merge checks are predicted. Every author is gated the same: a configured hard blocker fails the gate regardless of confirmed-contributor status (which affects only on-chain scoring)."
}
Loading