fix: inline FAQ markdown rendering and add inst_040

## Bug Fixes
- Fixed inline FAQ markdown rendering with error handling
- Added try-catch around marked.parse() for inline FAQs
- Added fallback to plain text with line breaks on parse failure
- Enhanced logging for FAQ rendering diagnostics

## New Instruction (inst_040)
Created rule requiring complete coverage when user says "all":
- "update all pages" means EVERY page, not representative subset
- Must identify complete scope before starting
- Verify ALL items processed before marking complete
- Ask user to prioritize if scope >20 items

## Rationale
User reported inline FAQs showing raw markdown instead of formatted HTML.
Root cause: createInlineFAQItemHTML lacked error handling that was added
to createFAQItemHTML in previous version. Both functions now have consistent
error handling with logging.

User directive: When saying "all", Claude must not choose subset.

## Version
- Bumped to 1.0.5
- Force update enabled
- Synced inst_040 to production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TheFlow 2025-10-14 12:51:08 +13:00
parent a54eb6cffd
commit ce6d4f9085
5 changed files with 72 additions and 15 deletions

View file

@ -932,20 +932,62 @@
],
"active": true,
"notes": "CRITICAL CONTENT ACCURACY GAP 2025-10-12 - User identified that most documents still reference 'five services' instead of 'six services'. PluralisticDeliberationOrchestrator was added as 6th service in Phase 5 but existing documentation not updated. Combined with ongoing rule violation checks (inst_016, inst_017) this creates comprehensive content accuracy protocol. User quote: 'very few of the documents refer correctly to the new 6th service! most still refer to 5' and 'we need to actually reexamine the content, not only for rule violations but also for currency'. This instruction ensures systematic content review during card presentation implementation, preventing outdated/inaccurate content from being deployed with improved UI/UX."
},
{
"id": "inst_040",
"text": "When user says 'all' (e.g., 'update all pages', 'fix all instances', 'check all files'), Claude MUST NOT choose to work on a subset. The word 'all' is an EXPLICIT requirement for COMPLETE coverage - every single item in scope must be processed. BEFORE starting work on 'all' requests: (1) Identify the COMPLETE list of items in scope (use find, grep, ls commands), (2) Present the full list to user for confirmation if scope is ambiguous, (3) Work through EVERY item systematically, (4) Verify ALL items were processed before marking task complete. If scope is too large for single session (>20 items), ask user to prioritize or break into smaller batches. NEVER silently skip items or decide 'these N are representative enough'.",
"timestamp": "2025-10-14T13:00:00Z",
"quadrant": "OPERATIONAL",
"persistence": "HIGH",
"temporal_scope": "PERMANENT",
"verification_required": "MANDATORY",
"explicitness": 1.0,
"source": "user",
"session_id": "2025-10-14-faq-fixes",
"parameters": {
"trigger_words": [
"all",
"every",
"each"
],
"examples": [
"update all pages",
"fix all instances",
"check all files",
"update every page",
"fix each occurrence"
],
"prohibited_actions": [
"working_on_subset",
"representative_sample",
"partial_completion",
"silent_skipping"
],
"required_actions": [
"identify_complete_scope",
"confirm_if_ambiguous",
"process_every_item",
"verify_complete_coverage"
],
"scope_too_large_threshold": 20,
"large_scope_action": "ask_user_to_prioritize_or_batch"
},
"active": true,
"notes": "IDENTIFIED 2025-10-14 - User directive: 'create a rule that stipulates that when the user says \"all\" as in \"update all...\" Claude may not choose to work on a subset'. Context: Footer standardization where user asked to update all pages, and Claude initially only updated FAQ page footer then used script for remaining pages. User expects 'all' to mean complete coverage without exceptions or representative samples. This prevents pattern where Claude selectively applies changes to subset of items when user explicitly requested universal application."
}
],
"stats": {
"total_instructions": 39,
"active_instructions": 39,
"total_instructions": 40,
"active_instructions": 40,
"by_quadrant": {
"STRATEGIC": 7,
"OPERATIONAL": 17,
"OPERATIONAL": 18,
"TACTICAL": 1,
"SYSTEM": 10,
"STOCHASTIC": 0
},
"by_persistence": {
"HIGH": 35,
"HIGH": 36,
"MEDIUM": 2,
"LOW": 0,
"VARIABLE": 0

View file

@ -655,7 +655,7 @@
<!-- Version Management & PWA -->
<script src="/js/version-manager.js"></script>
<script src="/js/faq.js?v=1760427000"></script>
<script src="/js/faq.js?v=1760430000"></script>
</body>
</html>

View file

@ -2918,11 +2918,16 @@ function setupModalListeners() {
*/
function renderInlineFAQs() {
const container = document.getElementById('inline-faq-container');
if (!container) return;
if (!container) {
console.error('[FAQ] inline-faq-container not found');
return;
}
// Get top 6 most important FAQs (mix of all audiences)
const topFAQs = FAQ_DATA.filter(faq => [19, 12, 27, 13, 1, 2].includes(faq.id));
console.log(`[FAQ] Rendering ${topFAQs.length} inline FAQs (marked available: ${typeof marked !== 'undefined'})`);
// Sort by ID to maintain order
const sorted = topFAQs.sort((a, b) => a.id - b.id);
@ -2977,7 +2982,17 @@ function createInlineFAQItemHTML(faq) {
// Parse markdown answer
let answerHtml = faq.answer;
if (typeof marked !== 'undefined') {
answerHtml = marked.parse(faq.answer);
try {
answerHtml = marked.parse(faq.answer);
} catch (error) {
console.error('[FAQ] Inline markdown parsing failed for FAQ', faq.id, error);
// Fallback to plain text with line breaks
answerHtml = `<p>${faq.answer.replace(/\n\n/g, '</p><p>').replace(/\n/g, '<br>')}</p>`;
}
} else {
console.warn('[FAQ] marked.js not loaded for inline FAQs - using plain text');
// Fallback to plain text with line breaks
answerHtml = `<p>${faq.answer.replace(/\n\n/g, '</p><p>').replace(/\n/g, '<br>')}</p>`;
}
return `

View file

@ -5,7 +5,7 @@
* - PWA functionality
*/
const CACHE_VERSION = '1.0.4';
const CACHE_VERSION = '1.0.5';
const CACHE_NAME = `tractatus-v${CACHE_VERSION}`;
const VERSION_CHECK_INTERVAL = 3600000; // 1 hour in milliseconds

View file

@ -1,12 +1,12 @@
{
"version": "1.0.4",
"buildDate": "2025-10-14T13:00:00Z",
"version": "1.0.5",
"buildDate": "2025-10-14T13:15:00Z",
"changelog": [
"Fixed modal scrolling - changed to h-[85vh] with min-h-0 for proper flex scroll",
"Removed Quick Actions section from FAQ page",
"Standardized footer across all pages with newsletter link",
"Enhanced markdown parsing with error handling"
"Fixed inline FAQ markdown rendering with error handling",
"Added logging for FAQ rendering diagnostics",
"Enhanced markdown fallback for both modal and inline FAQs",
"Created inst_040: 'all' keyword requires complete coverage"
],
"forceUpdate": true,
"minVersion": "1.0.4"
"minVersion": "1.0.5"
}