/** * Fix "Architectural Boundaries" Blog - Remove inst_017 Violations * Replace absolute guarantee language with evidence-based alternatives */ const { MongoClient } = require('mongodb'); const DEV_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; const DEV_DB = process.env.MONGODB_DB || 'tractatus_dev'; const SLUG = 'why-ai-safety-requires-architectural-boundaries-not-just-training'; // Replacement mapping: prohibited term → evidence-based alternative const REPLACEMENTS = [ { old: 'training alone cannot provide the guarantees needed for high-stakes systems', new: 'training alone cannot provide the level of assurance needed for high-stakes systems', context: 'Opening paragraph - claims about training limitations' }, { old: 'Training creates statistical patterns, not logical guarantees', new: 'Training creates statistical patterns, not deterministic constraints', context: 'Training Paradox section - explaining fundamental limitation' }, { old: 'only architecture provides verifiable guarantees', new: 'only architecture provides verifiable enforcement', context: 'Conclusion - architectural benefits' } ]; async function fixBlog() { const client = new MongoClient(DEV_URI); try { console.log('šŸ”§ Fixing "Architectural Boundaries" Blog\n'); console.log('═'.repeat(70)); await client.connect(); const db = client.db(DEV_DB); const collection = db.collection('blog_posts'); // Fetch the blog const blog = await collection.findOne({ slug: SLUG }); if (!blog) { console.log(`\nāŒ Blog not found: ${SLUG}`); return false; } console.log(`\nāœ… Found blog: "${blog.title}"`); console.log(` Author: ${blog.author.name} (${blog.author.type})`); console.log(` Current status: ${blog.status}`); let updatedContent = blog.content; let changeCount = 0; console.log('\nšŸ“ Applying replacements:\n'); REPLACEMENTS.forEach((replacement, idx) => { if (updatedContent.includes(replacement.old)) { updatedContent = updatedContent.replace(replacement.old, replacement.new); changeCount++; console.log(` ${idx + 1}. āœ… ${replacement.context}`); console.log(` OLD: "${replacement.old}"`); console.log(` NEW: "${replacement.new}"\n`); } else { console.log(` ${idx + 1}. āš ļø Pattern not found: ${replacement.context}`); console.log(` Searched for: "${replacement.old}"\n`); } }); if (changeCount === 0) { console.log('āš ļø No changes made - patterns not found in content'); return false; } // Add banner explaining the fix const banner = `

Content Revised - inst_017 Compliance

This blog was originally AI-curated in October 2025 and contained absolute assurance language ("guarantees") that violated inst_017. The content has been revised to use evidence-based language:

  • "guarantees needed" → "level of assurance needed"
  • "logical guarantees" → "deterministic constraints"
  • "verifiable guarantees" → "verifiable enforcement"

This demonstrates governance working retrospectively. When new rules are added (inst_017 in late October 2025), they can be applied to existing content. Rather than unpublish or silently edit, we're documenting the revision process transparently.

Note: The revised language is more precise and accurate. "Deterministic constraints" better describes what architecture provides than "guarantees," which implies perfection.

`; // Insert banner after title (first line starting with #) const lines = updatedContent.split('\n'); const titleIndex = lines.findIndex(line => line.trim().startsWith('# ')); if (titleIndex >= 0) { lines.splice(titleIndex + 1, 0, banner); updatedContent = lines.join('\n'); console.log('āœ… Added compliance banner after title\n'); } // Update the blog const result = await collection.updateOne( { slug: SLUG }, { $set: { content: updatedContent, 'moderation.ai_analysis.valid': true // Mark as passing moderation } } ); if (result.modifiedCount === 1) { console.log('═'.repeat(70)); console.log(`\n✨ Blog updated successfully!`); console.log(` Changes made: ${changeCount}`); console.log(` Moderation status: Updated to valid=true`); console.log(`\nNext steps:`); console.log(`1. Review at: http://localhost:9000/blog-post.html?slug=${SLUG}`); console.log(`2. Deploy to production if approved\n`); return true; } else { console.log('āŒ Failed to update blog in database'); return false; } } catch (error) { console.error('āŒ Error:', error.message); throw error; } finally { await client.close(); } } // Run if called directly if (require.main === module) { fixBlog() .then((success) => { process.exit(success ? 0 : 1); }) .catch(error => { console.error('\nšŸ’„ Failed:', error); process.exit(1); }); } module.exports = { fixBlog, REPLACEMENTS };