Skip to content
Open
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
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"devDependencies": {
"@babel/preset-env": "^7.29.2",
"@babel/preset-react": "^7.28.5",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/node": "^20.11.24",
"@types/node-cron": "^3.0.11",
"@types/sqlite3": "^3.1.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^30.3.0",
"jest-util": "^30.2.0",
"ts-jest": "^29.1.2",
"jest-util": "^30.3.0",
"ts-jest": "^29.4.6",
Comment on lines 32 to +35
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest-related devDependencies are now a mix of Jest v29 (jest) and Jest v30 packages (jest-environment-jsdom, jest-util). This pulls Jest 30 internals into the lockfile and can cause subtle resolver/version skew. Prefer aligning all Jest packages to the same major version (or removing jest-util/jest-environment-jsdom if they aren’t needed for this repo’s Jest config).

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says "Adds ts-jest" but ts-jest was already present; this change is a version bump. Please adjust the PR description (or commit message) so it accurately reflects what changed.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For Jest 29.7.0, what are the officially supported versions (or required major versions) of ts-jest, jest-util, and jest-environment-jsdom?

💡 Result:

For Jest 29.7.0: - ts-jest: major version 29 (e.g., ^29.0.0 to ^29.4.6), as ts-jest follows Jest's major version numbering and explicitly supports Jest ^29.0.0 || ^30.0.0 in its peer dependencies. - jest-util: ^29.7.0 (same major.minor as Jest core packages). - jest-environment-jsdom: ^29.7.0 (same major.minor as Jest core packages; version 29.7.0 exists and depends on jest-util among other ^29 packages).

Citations:


🏁 Script executed:

cat package.json | head -40

Repository: RohanExploit/VishwaGuru

Length of output: 1108


Align Jest ecosystem packages to the same major version.

The project uses jest 29.7.0 but has jest-util and jest-environment-jsdom at 30.x while ts-jest remains at 29.4.6. Mixing Jest major versions across the ecosystem commonly causes test failures and configuration conflicts. Either upgrade all packages to 30.x or downgrade jest-util and jest-environment-jsdom to 29.x to match the core jest dependency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 34 - 35, The project mixes Jest major versions:
core "jest" is 29.7.0 while "jest-util" and "jest-environment-jsdom" are 30.x;
align them by either upgrading "jest" and "ts-jest" to 30.x or downgrading
"jest-util" and "jest-environment-jsdom" to 29.x to match "jest" 29.7.0;
specifically update the package.json entries for "jest", "jest-util",
"jest-environment-jsdom", and "ts-jest" so all share the same major version,
then reinstall dependencies and run the test suite to verify compatibility.

"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
Expand Down
2 changes: 1 addition & 1 deletion scheduler/dailyRefinementJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Issue } from "../services/types";

// Load environmental or fallback to test.db or production db
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above dbPath is now misleading: the fallback is no longer a test DB or backend/app.db—it resolves to ../data/issues.db (and can be overridden via DB_PATH). Please update the comment to match the actual behavior to avoid confusion during ops/debugging.

Suggested change
// Load environmental or fallback to test.db or production db
// Use DB_PATH env var if set, otherwise fall back to ../data/issues.db

Copilot uses AI. Check for mistakes.
const dbPath =
process.env.DB_PATH || path.join(__dirname, "../../backend/app.db");
process.env.DB_PATH || path.join(__dirname, "../data/issues.db");
Comment on lines 10 to +11
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the default SQLite path, but there’s no test that would fail if this regressed (e.g., asserting what path is used when DB_PATH is unset). Consider making the path derivation injectable/exported and adding a focused Jest test so the intended default (data/issues.db) is enforced.

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Create the fallback directory before opening the SQLite file.

This path fix is good, but it can still fail on fresh environments if ../data doesn’t exist. Ensure the parent directory exists before new sqlite3.Database(...) is called.

Suggested patch
 import * as cron from "node-cron";
 import * as sqlite3 from "sqlite3";
 import * as path from "path";
+import * as fs from "fs";
 import { TrendAnalyzer } from "../services/trendAnalyzer";
 import { AdaptiveWeights } from "../services/adaptiveWeights";
 import { IntelligenceIndex } from "../services/intelligenceIndex";
 import { Issue } from "../services/types";

 // Load environmental or fallback to test.db or production db
 const dbPath =
   process.env.DB_PATH || path.join(__dirname, "../data/issues.db");
+fs.mkdirSync(path.dirname(dbPath), { recursive: true });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scheduler/dailyRefinementJob.ts` at line 11, The code computes the DB path
using process.env.DB_PATH || path.join(__dirname, "../data/issues.db") but may
attempt to open the SQLite file before its parent directory exists; before
calling new sqlite3.Database(...) ensure the directory for that computed dbPath
exists (use path.dirname(dbPath) and create it with recursive mkdir), then
proceed to open the database so new sqlite3.Database(...) won't fail on fresh
environments.


export class DailyRefinementJob {
private db: sqlite3.Database;
Expand Down
Loading