Three scripts to support blog system improvements:
1. fix-blog-dates.js
- Fixes empty {} published_at values in database
- Sets proper ISODate values for 3 blogs
- Also updates moderation.approved_at for consistency
2. add-blog-categories.js
- Adds category field to all blog posts
- Maps content to standardized categories (Framework Updates,
Implementation, Case Studies)
- Enables category filtering functionality
3. add-vetting-notice-to-architectural-boundaries.js
- Adds comprehensive human vetting notice
- Documents AI-curated content review process
- Shows governance working end-to-end with inst_017 compliance
Applied to both tractatus_dev and tractatus_prod databases.
Ref: SESSION_HANDOFF_2025-10-23_WEBSITE_AUDIT.md
107 lines
4.1 KiB
JavaScript
107 lines
4.1 KiB
JavaScript
/**
|
|
* Add Human Vetting Notice to Architectural Boundaries Banner
|
|
* Demonstrates AI-curated content requires extra scrutiny
|
|
*/
|
|
|
|
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';
|
|
|
|
const ENHANCED_BANNER = `
|
|
<div class="bg-green-50 border-l-4 border-green-500 p-4 mb-6">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor">
|
|
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"/>
|
|
</svg>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-green-800">Content Revised - inst_017 Compliance</h3>
|
|
<div class="mt-2 text-sm text-green-700">
|
|
<p><strong>Human Vetting Process:</strong> This AI-curated blog was initially withheld from production deployment pending human review. After revision to meet inst_017 compliance, it was approved for publication.</p>
|
|
<p class="mt-2">The original content contained absolute assurance language ("guarantees") that violated inst_017. The content has been revised to use evidence-based language:</p>
|
|
<ul class="list-disc ml-5 mt-2 space-y-1">
|
|
<li>"guarantees needed" → "level of assurance needed"</li>
|
|
<li>"logical guarantees" → "deterministic constraints"</li>
|
|
<li>"verifiable guarantees" → "verifiable enforcement"</li>
|
|
</ul>
|
|
<p class="mt-2"><strong>This demonstrates governance working end-to-end.</strong> AI-curated content triggers additional scrutiny. When violations are detected, content is withheld, revised, and approved by human reviewers before publication. Rather than silent editing, we document the entire process transparently.</p>
|
|
<p class="mt-2 text-xs italic">Note: The revised language is more precise and accurate. "Deterministic constraints" better describes what architecture provides than "guarantees," which implies perfection.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
|
|
async function updateBanner() {
|
|
const client = new MongoClient(DEV_URI);
|
|
|
|
try {
|
|
console.log('🔧 Adding Human Vetting Notice to Architectural Boundaries\n');
|
|
console.log('═'.repeat(70));
|
|
|
|
await client.connect();
|
|
const db = client.db(DEV_DB);
|
|
const collection = db.collection('blog_posts');
|
|
|
|
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}"`);
|
|
|
|
// Replace existing green banner
|
|
const bannerRegex = /<div class="bg-green-50 border-l-4 border-green-500[^>]*>[\s\S]*?<\/div>\s*<\/div>\s*<\/div>/;
|
|
|
|
if (!bannerRegex.test(blog.content)) {
|
|
console.log('⚠️ No green banner found to replace');
|
|
return false;
|
|
}
|
|
|
|
const updatedContent = blog.content.replace(bannerRegex, ENHANCED_BANNER);
|
|
|
|
const result = await collection.updateOne(
|
|
{ slug: SLUG },
|
|
{ $set: { content: updatedContent } }
|
|
);
|
|
|
|
if (result.modifiedCount === 1) {
|
|
console.log('\n═'.repeat(70));
|
|
console.log(`\n✨ Banner enhanced successfully!`);
|
|
console.log(`\nAdded:`);
|
|
console.log(` • Human vetting process explanation`);
|
|
console.log(` • End-to-end governance demonstration`);
|
|
console.log(` • AI-curated content scrutiny notice`);
|
|
console.log(`\nNext: Deploy to production with date fixes\n`);
|
|
return true;
|
|
} else {
|
|
console.log('❌ Failed to update blog');
|
|
return false;
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error:', error.message);
|
|
throw error;
|
|
} finally {
|
|
await client.close();
|
|
}
|
|
}
|
|
|
|
// Run if called directly
|
|
if (require.main === module) {
|
|
updateBanner()
|
|
.then((success) => {
|
|
process.exit(success ? 0 : 1);
|
|
})
|
|
.catch(error => {
|
|
console.error('\n💥 Failed:', error);
|
|
process.exit(1);
|
|
});
|
|
}
|
|
|
|
module.exports = { updateBanner };
|