Skip to content

Commit 333da51

Browse files
committed
small fixes
1 parent 53fd331 commit 333da51

File tree

6 files changed

+130
-35
lines changed

6 files changed

+130
-35
lines changed

.github/workflows/build-and-deploy-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Deno
1313
uses: denoland/setup-deno@v2
1414
with:
15-
deno-version: v2.3.5
15+
deno-version: v2.4.0
1616

1717
- name: Build Deno SPA
1818
run: |

.github/workflows/build-and-deploy-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up Deno
2626
uses: denoland/setup-deno@v2
2727
with:
28-
deno-version: v2.3.5
28+
deno-version: v2.4.0
2929

3030
- name: Build Deno application
3131
run: |

.github/workflows/test-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Deno
1313
uses: denoland/setup-deno@v2
1414
with:
15-
deno-version: v2.3.5
15+
deno-version: v2.4.0
1616

1717
- name: Install dependencies
1818
run: |
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
services:
3030
postgres:
31-
image: postgres:17
31+
image: pgvector/pgvector:pg17
3232
env:
3333
POSTGRES_PASSWORD: password
3434
POSTGRES_USER: user
@@ -47,7 +47,7 @@ jobs:
4747
- name: Set up Deno
4848
uses: denoland/setup-deno@v2
4949
with:
50-
deno-version: v2.3.5
50+
deno-version: v2.4.0
5151

5252
- name: Install dependencies
5353
run: |

packages/core/src/api/manifest/router.test.ts

Lines changed: 112 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
type dependencyManifestTypes,
1111
manifestApiTypes,
1212
} from "@stackcore/shared";
13+
import { downloadJsonFromBucket } from "../../bucketStorage/index.ts";
1314

1415
// Helper function to provide default project configuration values
1516
function getDefaultProjectConfig() {
@@ -80,13 +81,62 @@ Deno.test("create a manifest", async () => {
8081
.where("name", "=", "Test Project")
8182
.executeTakeFirstOrThrow();
8283

84+
const sampleManifest: dependencyManifestTypes.DependencyManifest = {
85+
"src/index.py": {
86+
id: "src/index.py",
87+
filePath: "src/index.py",
88+
language: "python",
89+
metrics: {
90+
linesCount: 12,
91+
codeLineCount: 8,
92+
characterCount: 200,
93+
codeCharacterCount: 150,
94+
dependencyCount: 1,
95+
dependentCount: 0,
96+
cyclomaticComplexity: 3,
97+
},
98+
dependencies: {
99+
"./utils": {
100+
id: "./utils",
101+
isExternal: false,
102+
symbols: {},
103+
},
104+
},
105+
dependents: {},
106+
symbols: {
107+
"MyClass": {
108+
id: "MyClass",
109+
type: "class" as const,
110+
metrics: {
111+
linesCount: 12,
112+
codeLineCount: 8,
113+
characterCount: 200,
114+
codeCharacterCount: 150,
115+
dependencyCount: 1,
116+
dependentCount: 0,
117+
cyclomaticComplexity: 3,
118+
},
119+
description: "",
120+
dependencies: {
121+
"./utils.py": {
122+
id: "./utils.py",
123+
isExternal: false,
124+
symbols: {},
125+
},
126+
},
127+
dependents: {},
128+
},
129+
},
130+
},
131+
};
132+
83133
// Create a manifest via API
84134
const { url, method, body } = manifestApiTypes.prepareCreateManifest({
85135
projectId: project.id,
86136
branch: "main",
87137
commitSha: "abc123",
88138
commitShaDate: new Date(),
89-
manifest: { test: "data" },
139+
manifest: sampleManifest,
90140
});
91141

92142
const createResponse = await api.handle(
@@ -116,6 +166,10 @@ Deno.test("create a manifest", async () => {
116166
assertEquals(manifest.branch, "main");
117167
assertEquals(manifest.commitSha, "abc123");
118168
assertEquals(manifest.version, 1);
169+
170+
// Verify manifest was created in bucket
171+
const manifestContent = await downloadJsonFromBucket(manifest.manifest);
172+
assertEquals(manifestContent, sampleManifest);
119173
} finally {
120174
await resetTables();
121175
await destroyKyselyDb();
@@ -774,16 +828,61 @@ Deno.test("get manifest details", async () => {
774828

775829
// Create manifest
776830
const manifestService = new ManifestService();
831+
const sampleManifest: dependencyManifestTypes.DependencyManifest = {
832+
"src/index.py": {
833+
id: "src/index.py",
834+
filePath: "src/index.py",
835+
language: "python",
836+
metrics: {
837+
linesCount: 12,
838+
codeLineCount: 8,
839+
characterCount: 200,
840+
codeCharacterCount: 150,
841+
dependencyCount: 1,
842+
dependentCount: 0,
843+
cyclomaticComplexity: 3,
844+
},
845+
dependencies: {
846+
"./utils": {
847+
id: "./utils",
848+
isExternal: false,
849+
symbols: {},
850+
},
851+
},
852+
dependents: {},
853+
symbols: {
854+
"MyClass": {
855+
id: "MyClass",
856+
type: "class" as const,
857+
metrics: {
858+
linesCount: 12,
859+
codeLineCount: 8,
860+
characterCount: 200,
861+
codeCharacterCount: 150,
862+
dependencyCount: 1,
863+
dependentCount: 0,
864+
cyclomaticComplexity: 3,
865+
},
866+
description: "",
867+
dependencies: {
868+
"./utils.py": {
869+
id: "./utils.py",
870+
isExternal: false,
871+
symbols: {},
872+
},
873+
},
874+
dependents: {},
875+
},
876+
},
877+
},
878+
};
777879
const createResponse = await manifestService.createManifest(
778880
userId,
779881
project.id,
780882
"main",
781883
"abc123",
782884
new Date(),
783-
{
784-
test: "data",
785-
complex: { nested: "value" },
786-
} as unknown as dependencyManifestTypes.DependencyManifest,
885+
sampleManifest,
787886
);
788887

789888
if ("error" in createResponse) {
@@ -817,14 +916,6 @@ Deno.test("get manifest details", async () => {
817916
assertEquals(manifest.commitSha, "abc123");
818917
assertEquals(manifest.version, 1);
819918
assertEquals(manifest.manifest.length > 0, true);
820-
821-
// get the content of the manifest from the bucket
822-
const manifestContentResponse = await fetch(
823-
manifest.manifest,
824-
);
825-
const manifestContent = await manifestContentResponse.json();
826-
assertEquals(manifestContent.test, "data");
827-
assertEquals(manifestContent.complex.nested, "value");
828919
} finally {
829920
await resetTables();
830921
await destroyKyselyDb();
@@ -1162,7 +1253,7 @@ Deno.test("get manifest audit", async () => {
11621253

11631254
// Create manifest with sample dependency manifest structure
11641255
const manifestService = new ManifestService();
1165-
const sampleManifest = {
1256+
const sampleManifest: dependencyManifestTypes.DependencyManifest = {
11661257
"src/index.py": {
11671258
id: "src/index.py",
11681259
filePath: "src/index.py",
@@ -1197,7 +1288,7 @@ Deno.test("get manifest audit", async () => {
11971288
dependentCount: 0,
11981289
cyclomaticComplexity: 3,
11991290
},
1200-
description: "MyClass description",
1291+
description: "",
12011292
dependencies: {
12021293
"./utils.py": {
12031294
id: "./utils.py",
@@ -1244,18 +1335,18 @@ Deno.test("get manifest audit", async () => {
12441335
assertEquals(typeof auditManifest, "object");
12451336

12461337
// Check that it has the expected file entry
1247-
assertEquals(typeof auditManifest["src/index.ts"], "object");
1248-
assertEquals(auditManifest["src/index.ts"].id, "src/index.ts");
1249-
assertEquals(typeof auditManifest["src/index.ts"].alerts, "object");
1250-
assertEquals(typeof auditManifest["src/index.ts"].symbols, "object");
1338+
assertEquals(typeof auditManifest["src/index.py"], "object");
1339+
assertEquals(auditManifest["src/index.py"].id, "src/index.py");
1340+
assertEquals(typeof auditManifest["src/index.py"].alerts, "object");
1341+
assertEquals(typeof auditManifest["src/index.py"].symbols, "object");
12511342

12521343
// Check that the symbol is present
12531344
assertEquals(
1254-
typeof auditManifest["src/index.ts"].symbols["MyClass"],
1345+
typeof auditManifest["src/index.py"].symbols["MyClass"],
12551346
"object",
12561347
);
12571348
assertEquals(
1258-
auditManifest["src/index.ts"].symbols["MyClass"].id,
1349+
auditManifest["src/index.py"].symbols["MyClass"].id,
12591350
"MyClass",
12601351
);
12611352
} finally {

packages/core/src/db/migrations/0002.migration.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Kysely } from "kysely";
1+
import { type Kysely, sql } from "kysely";
22
import {
33
downloadJsonFromBucket,
44
uploadJsonToBucket,
@@ -7,6 +7,9 @@ import type { dependencyManifestTypes } from "@stackcore/shared";
77

88
// deno-lint-ignore no-explicit-any
99
export async function up(db: Kysely<any>): Promise<void> {
10+
// Create vector extension
11+
await db.executeQuery(sql`CREATE EXTENSION vector;`.compile(db));
12+
1013
const manifestRecords = await db.selectFrom("manifest").selectAll()
1114
.execute();
1215

@@ -34,6 +37,7 @@ export async function up(db: Kysely<any>): Promise<void> {
3437
}
3538

3639
// deno-lint-ignore no-explicit-any
37-
export async function down(_db: Kysely<any>): Promise<void> {
38-
// Do nothing
40+
export async function down(db: Kysely<any>): Promise<void> {
41+
// Drop vector extension
42+
await db.executeQuery(sql`DROP EXTENSION vector;`.compile(db));
3943
}

packages/shared/src/stripe.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
export const BASIC_PRODUCT = "basic";
2-
export const PRO_PRODUCT = "pro";
3-
export const PREMIUM_PRODUCT = "premium";
4-
export const CUSTOM_PRODUCT = "custom";
1+
export const BASIC_PRODUCT = "BASIC";
2+
export const PRO_PRODUCT = "PRO";
3+
export const PREMIUM_PRODUCT = "PREMIUM";
4+
export const CUSTOM_PRODUCT = "CUSTOM";
55

66
export type StripeProduct =
77
| typeof BASIC_PRODUCT
88
| typeof PRO_PRODUCT
99
| typeof PREMIUM_PRODUCT
1010
| typeof CUSTOM_PRODUCT;
1111

12-
export const MONTHLY_BILLING_CYCLE = "monthly";
13-
export const YEARLY_BILLING_CYCLE = "yearly";
12+
export const MONTHLY_BILLING_CYCLE = "MONTHLY";
13+
export const YEARLY_BILLING_CYCLE = "YEARLY";
1414

1515
export type StripeBillingCycle =
1616
| typeof MONTHLY_BILLING_CYCLE

0 commit comments

Comments
 (0)