Skip to content

Commit 5312a56

Browse files
feat(engine): add ENGINE_VERSION semver pin (#3475)
Closes #2284 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a979552 commit 5312a56

4 files changed

Lines changed: 32 additions & 0 deletions

File tree

packages/gittensory-engine/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ The logic is extracted from the app's `src/` in follow-up issues; this skeleton
1111
the meantime. The root `package.json` already globs `packages/*` in its `workspaces` field, so `npm ci`
1212
discovers this package with no additional wiring.
1313

14+
## Version pin
15+
16+
`ENGINE_VERSION` mirrors `package.json`'s `version` field and is exported from the package barrel so consumers can
17+
log or assert which engine build produced a deterministic result.
18+
1419
## Build
1520

1621
```

packages/gittensory-engine/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// backend and the gittensory-miner (scoring preview/model, predicted-gate types, reward-risk, slop signals,
55
// focus-manifest parse/compile core, duplicate-winner adjudication, and their engine-parity fixtures).
66
// More modules land in follow-up issues.
7+
export { ENGINE_VERSION } from "./version.js";
78
export {
89
pickTopRankedOpportunities,
910
rankOpportunityScore,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Published semver of `@jsonbored/gittensory-engine`. Keep in lockstep with `package.json` `version`
3+
* (enforced by `test/unit/engine-version.test.ts`).
4+
*/
5+
export const ENGINE_VERSION = "0.1.0";

test/unit/engine-version.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { readFileSync } from "node:fs";
2+
import { dirname, join } from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import { describe, expect, it } from "vitest";
5+
6+
import { ENGINE_VERSION } from "../../packages/gittensory-engine/src/version";
7+
8+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "../../packages/gittensory-engine/package.json");
9+
10+
describe("ENGINE_VERSION", () => {
11+
it("matches packages/gittensory-engine/package.json version", () => {
12+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as { version: string };
13+
expect(ENGINE_VERSION).toBe(pkg.version);
14+
});
15+
16+
it("is exported from the package barrel", async () => {
17+
const barrel = await import("../../packages/gittensory-engine/src/index");
18+
expect(barrel.ENGINE_VERSION).toBe(ENGINE_VERSION);
19+
expect(barrel.ENGINE_VERSION.length).toBeGreaterThan(0);
20+
});
21+
});

0 commit comments

Comments
 (0)