/** * Remove fictional content from Inflection Point document * Fix inst_016/017/018 violations while preserving conceptual value */ const { MongoClient } = require('mongodb'); async function run() { const client = new MongoClient('mongodb://localhost:27017'); await client.connect(); const db = client.db('tractatus_dev'); const collection = db.collection('documents'); console.log('═══════════════════════════════════════════════════════════'); console.log(' FIXING INFLECTION POINT DOCUMENT'); console.log('═══════════════════════════════════════════════════════════\n'); const doc = await collection.findOne({ slug: 'executive-summary-tractatus-inflection-point' }); if (!doc) { console.log('❌ Document not found'); process.exit(1); } console.log(`📄 Document: ${doc.title}`); console.log(` Sections: ${doc.sections?.length || 0}\n`); if (!doc.sections) { console.log('❌ No sections found'); process.exit(1); } const updates = []; const sectionsToRemove = []; // Section 1: "The Key Finding" - Fix fictional "six months of production deployment" const section1 = doc.sections.find(s => s.title === 'The Key Finding'); if (section1) { console.log('🔧 Section 1: Fixing fictional production deployment claim...'); // Remove the "six months of production deployment" fiction let cleanedExcerpt = section1.excerpt .replace(/After six months of production deployment,?\s*/i, '') .replace(/we've reached/i, 'We\'ve identified') .replace(/We've reached/i, 'We\'ve identified'); let cleanedHtml = section1.content_html .replace(/After six months of production deployment,?\s*/i, '') .replace(/we've reached/i, 'we\'ve identified') .replace(/We've reached/i, 'We\'ve identified'); updates.push({ section: section1, field: 'excerpt + content_html', oldValue: 'Removed "six months of production deployment" fiction', newValue: 'Changed to "identified" instead of "reached after deployment"' }); section1.excerpt = cleanedExcerpt; section1.content_html = cleanedHtml; } // Section 2: "The Numbers That Matter" - REMOVE ENTIRELY (fabricated comparison table) const section2Idx = doc.sections.findIndex(s => s.title === 'The Numbers That Matter'); if (section2Idx >= 0) { console.log('🗑️ Section 2: Removing fabricated statistics table entirely...'); updates.push({ section: doc.sections[section2Idx], field: 'REMOVED', oldValue: 'The Numbers That Matter - fabricated comparison table', newValue: 'Section removed - contained fictional performance metrics' }); sectionsToRemove.push(section2Idx); } // Section 7: "Evidence That Matters: The Test That Changed Everything" - REMOVE ENTIRELY const section7Idx = doc.sections.findIndex(s => s.title === 'Evidence That Matters: The Test That Changed Everything'); if (section7Idx >= 0) { console.log('🗑️ Section 7: Removing fabricated test evidence...'); updates.push({ section: doc.sections[section7Idx], field: 'REMOVED', oldValue: 'Evidence That Matters - fabricated test results', newValue: 'Section removed - contained fictional metrics' }); sectionsToRemove.push(section7Idx); } // Remove sections in reverse order to avoid index shifting issues sectionsToRemove.sort((a, b) => b - a).forEach(idx => { doc.sections.splice(idx, 1); }); // Renumber sections after removals doc.sections.forEach((section, idx) => { section.number = idx + 1; }); // Update the document const result = await collection.updateOne( { slug: 'executive-summary-tractatus-inflection-point' }, { $set: { sections: doc.sections, updated_at: new Date() } } ); console.log('\n═══════════════════════════════════════════════════════════'); console.log(' CLEANUP SUMMARY'); console.log('═══════════════════════════════════════════════════════════\n'); console.log(`Changes made: ${updates.length}`); updates.forEach((update, idx) => { console.log(`\n${idx + 1}. ${update.section.title || 'Section'}`); console.log(` Field: ${update.field}`); console.log(` ${update.oldValue}`); }); console.log(`\n✅ Document updated: ${result.modifiedCount} document(s)`); console.log(`📊 Final section count: ${doc.sections.length}\n`); await client.close(); } run().catch(console.error);