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
2 changes: 1 addition & 1 deletion src/extraction-prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Each memory contains three levels:
\`\`\`json
{
"category": "cases",
"abstract": "LanceDB BigInt error -> Use Number() coercion before arithmetic",
"abstract": "LanceDB BigInt numeric handling issue",
"overview": "## Problem\\nLanceDB 0.26+ returns BigInt for numeric columns\\n\\n## Solution\\nCoerce values with Number(...) before arithmetic",
"content": "When LanceDB returns BigInt values, wrap them with Number() before doing arithmetic operations."
}
Expand Down
68 changes: 68 additions & 0 deletions test/issue-640-bigint-prompt.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* Issue #640 Test: cases category prompt should be descriptive, not imperative
*
* Test verifies that the abstract format change prevents LLM from skipping
* [cases] category memories.
*
* Run: npx tsx test/issue-640-bigint-prompt.test.mjs
*/

// Helper to check if prompt is misleading
function isPromptMisleading(abstract) {
const misleadingPatterns = [
"-> use",
"error ->",
"solution:",
"use number()",
"coercion",
"before arithmetic",
];
const lower = abstract.toLowerCase();
for (const pattern of misleadingPatterns) {
if (lower.includes(pattern.toLowerCase())) {
return true;
}
}
return false;
}

// Test cases
const testCases = [
{
abstract: "LanceDB BigInt error -> Use Number() coercion before arithmetic",
expectedMisleading: true,
description: "Old format (buggy) - should be detected as misleading",
},
{
abstract: "LanceDB BigInt numeric handling issue",
expectedMisleading: false,
description: "New format (fixed) - should NOT be misleading",
},
];

console.log("=== Issue #640: BigInt Prompt Format Test ===\n");

let passed = 0;
let failed = 0;

for (const tc of testCases) {
const isMisleading = isPromptMisleading(tc.abstract);
const ok = isMisleading === tc.expectedMisleading;

console.log(`[${tc.description}]`);
console.log(` Abstract: "${tc.abstract}"`);
console.log(` Misleading: ${isMisleading} (expected: ${tc.expectedMisleading})`);
console.log(` Result: ${ok ? "✅ PASS" : "❌ FAIL"}`);
console.log("");

if (ok) passed++;
else failed++;
}

console.log("----------------------------------------");
console.log(`Total: ${passed} passed, ${failed} failed`);
console.log("----------------------------------------");

if (failed > 0) {
process.exit(1);
}
Loading