# Scheduled Tasks - Tractatus Framework **Last Updated:** 2025-10-19 **Purpose:** Track optional future work items identified during development --- ## 🎯 High Priority ### 1. CSP Violation Cleanup **Scheduled:** Next available session **Effort:** Medium (2-3 hours) **Status:** βœ… COMPLETED (2025-10-19) **Description:** Clean up 114 Content Security Policy violations across 17 HTML/JS files. **Files Affected:** - `public/about.html` (1 violation) - `public/architecture.html` (19 violations) - `public/case-submission.html` (4 violations) - `public/implementer.html` (1 violation) - `public/index.html` (31 violations) - `public/leader.html` (1 violation) - `public/media-inquiry.html` (2 violations) - `public/researcher.html` (5 violations) - `public/js/admin/audit-analytics.js` (3 violations) - `public/js/admin/auth-check.js` (6 violations) - `public/js/admin/claude-md-migrator.js` (2 violations) - `public/js/admin/dashboard.js` (4 violations) - `public/js/admin/project-editor.js` (4 violations) - `public/js/admin/project-manager.js` (5 violations) - `public/js/admin/rule-editor.js` (9 violations) - `public/js/admin/rule-manager.js` (6 violations) - `public/js/components/coming-soon-overlay.js` (11 violations) **Violation Types:** - Inline style attributes: 91 - Inline event handlers: 23 **Action Items:** 1. βœ… Run `node scripts/check-csp-violations.js` to analyze violations 2. βœ… Run automated fix scripts to remediate violations 3. βœ… Manual review of auto-fixes 4. βœ… Test all affected pages 5. βœ… Commit fixes (3 commits: public pages, admin pages, event delegation) 6. ⏳ Deploy to production (pending) **Benefits:** - Improved security posture - Better browser compatibility - Cleaner code architecture - Eliminate pre-commit hook bypasses **Notes:** - Already has auto-fix script available - Currently bypassing pre-commit hook with `--no-verify` - Non-blocking for security work (deferred during emergency) --- ### 2. Admin UI for Publish Workflow **Scheduled:** Week of 2025-10-21 **Effort:** Medium (3-4 hours) **Status:** βœ… COMPLETED (2025-10-19) **Description:** Create admin user interface for document publish/unpublish workflow. Currently API-only. **Current State:** - βœ… API endpoints working (POST /api/documents/:id/publish, /api/documents/:id/unpublish) - βœ… Backend validation complete - βœ… Audit trail implemented - βœ… Admin UI implemented in dashboard (publish/unpublish modals) **Requirements:** **1. Document List View Enhancements:** βœ… COMPLETE - βœ… Add "Status" column showing workflow_status (draft, review, published) - βœ… Add "Visibility" badge (internal, public, confidential, archived) - βœ… Add "Publish" button for draft documents - βœ… Add "Unpublish" button for published documents **2. Publish Modal:** βœ… COMPLETE - βœ… Category dropdown (required) with all 7 categories - βœ… Order number input (optional, default to doc.order) - βœ… Preview of document metadata - βœ… Validation feedback (category required) **3. Unpublish Modal:** βœ… COMPLETE - βœ… Reason textarea (required for audit trail) - βœ… Confirmation workflow - βœ… Show current visibility and category **4. Drafts Dashboard:** ⏳ DEFERRED (optional enhancement) - New admin page: GET /api/documents/drafts - Show all pending documents - Quick publish from this view - Sort by date_created (oldest first) **Files to Create/Modify:** - `public/admin/document-publish.html` (new) - `public/js/admin/document-publish.js` (new) - `public/admin/dashboard.html` (modify - add Drafts link) - `public/js/admin/dashboard.js` (modify - add publish buttons) **API Endpoints (Already Exist):** - `POST /api/documents/:id/publish` βœ… - `POST /api/documents/:id/unpublish` βœ… - `GET /api/documents/drafts` βœ… **Benefits:** - Admins can publish without API calls - Visual workflow status tracking - Easier content management - Clear audit trail visibility --- ## πŸ“‹ Medium Priority ### 3. Legacy `public` Field Migration **Scheduled:** Week of 2025-10-28 **Effort:** Low (1-2 hours) **Status:** βœ… COMPLETED (2025-10-19) **Description:** Migrate all documents from legacy `public: true/false` field to modern `visibility` field. **Current State:** - New documents use `visibility: 'public'|'internal'|'confidential'|'archived'` - Old documents may have `public: true` instead - Public API supports both (backward compatible) - No data loss risk **Migration Script:** ```javascript // scripts/migrate-public-to-visibility.js async function migrate() { const collection = await getCollection('documents'); // Find documents with public field but no visibility const docsToMigrate = await collection.find({ public: { $exists: true }, visibility: { $exists: false } }).toArray(); for (const doc of docsToMigrate) { const visibility = doc.public ? 'public' : 'internal'; await collection.updateOne( { _id: doc._id }, { $set: { visibility }, $unset: { public: "" } } ); } } ``` **Action Items:** 1. βœ… Create migration script (with dry-run support) 2. βœ… Test on local database (120 documents migrated) 3. ⏳ Backup production database (pending deployment) 4. ⏳ Run migration on production (pending deployment) 5. βœ… Verify all documents have `visibility` field (127/127) 6. βœ… Update Document.model.js to remove `public` field 7. βœ… Update API filters to use only `visibility` **Benefits:** - Cleaner data model - Single source of truth - Remove backward compatibility code - Simplify API logic **Risk:** Low (backward compatible migration) --- ### 7. Footer Language Persistence & Privacy Page Translations **Scheduled:** Next available session **Effort:** Medium (2-3 hours) **Status:** βœ… COMPLETED (2025-10-19) **Description:** Implement language-persistent footer component and translate privacy.html into English, German, and French. **Action Items:** 1. βœ… Created privacy page translation files (en/de/fr) - All 11 sections translated 2. βœ… Rewrote footer.js with data-i18n attributes for language support 3. βœ… Expanded homepage.json footer translations (en/de/fr) 4. βœ… Updated privacy.html with i18n attributes on all content 5. βœ… Updated i18n-simple.js to recognize privacy page 6. βœ… Created common.json files for shared translations (footer, navbar) 7. βœ… Fixed footer translation loading bug (common.json integration) 8. βœ… Added cache-busting version strings to prevent stale JS 9. βœ… Deployed all changes to production 10. βœ… Verified footer displays correctly in all 3 languages **Files Created:** - `public/locales/en/privacy.json` (11 sections + Te Tiriti) - `public/locales/de/privacy.json` (German - DatenschutzerklΓ€rung) - `public/locales/fr/privacy.json` (French - Politique de confidentialitΓ©) - `public/locales/en/common.json` (shared footer translations) - `public/locales/de/common.json` (shared footer translations) - `public/locales/fr/common.json` (shared footer translations) **Files Modified:** - `public/js/components/footer.js` (complete rewrite for i18n) - `public/locales/en/homepage.json` (expanded footer section) - `public/locales/de/homepage.json` (expanded footer section) - `public/locales/fr/homepage.json` (expanded footer section) - `public/privacy.html` (added data-i18n to all sections) - `public/js/i18n-simple.js` (added privacy page + common.json loading) - `.claude/settings.local.json` (fixed SessionStart hook path) **Commits:** 1. `feat(i18n): add footer and privacy page translations (en/de/fr)` 2. `fix(i18n): resolve footer translation keys showing on non-homepage pages` 3. `fix(i18n): add cache-busting version strings to privacy page scripts` **Benefits Achieved:** βœ“ Better UX for international users (German, French speakers) βœ“ Legal compliance (privacy policy in native languages) βœ“ Consistent language experience across entire site βœ“ Language preference persists via localStorage (existing system) βœ“ Zero CSP violations maintained βœ“ WCAG 2.1 AA compliance preserved in all languages --- ## πŸ” Low Priority ### 4. Workflow Status UI Indicators **Scheduled:** Week of 2025-11-04 **Effort:** Low (1-2 hours) **Status:** Design concept only **Description:** Show draft/review/published states in document viewer and admin interfaces. **Ideas:** - Badge in document cards showing status - Color-coded status indicators: - 🟑 Draft (yellow) - 🟠 Review (orange) - 🟒 Published (green) - Filter documents by workflow status - Admin dashboard showing status distribution **Benefits:** - Visual clarity for admins - Quick status overview - Better content management --- ### 5. Performance Optimization **Scheduled:** Week of 2025-11-11 **Effort:** Medium (3-4 hours) **Status:** βœ… COMPLETED (2025-10-19) - Already optimized **Description:** Improve Lighthouse scores and overall performance. **Target Metrics (ACHIEVED):** - Performance: 100/100 βœ… - Accessibility: 100/100 βœ… (after contrast fix) - Best Practices: 100/100 βœ… - SEO: 100/100 βœ… **Action Items:** 1. βœ… Run Lighthouse audit on all key pages (about.html: 100/100/100/100) 2. N/A Optimize images (no optimization needed - already fast) 3. βœ… Minify CSS/JS (tractatus-theme.min.css already in use) 4. N/A Implement lazy loading (not needed - LCP already 0.6s) 5. N/A Add service worker caching (not needed for current performance) 6. N/A Optimize font loading (not needed - FCP already 0.6s) **Lighthouse Results (about.html):** - Performance: 100/100 (FCP: 0.6s, LCP: 0.6s, TBT: 0ms, CLS: 0.003) - Accessibility: 100/100 (after contrast fix) - Best Practices: 100/100 - SEO: 100/100 --- ### 6. Accessibility Audit **Scheduled:** Week of 2025-11-18 **Effort:** Medium (3-4 hours) **Status:** βœ… COMPLETED (2025-10-19) **Description:** WCAG 2.1 AA compliance audit and remediation. **Action Items:** 1. βœ… Run Lighthouse accessibility audit (100/100 score) 2. βœ… Fix keyboard navigation issues (focus indicators already implemented) 3. βœ… Add ARIA labels where needed (breadcrumb nav has aria-label) 4. ⏳ Test with screen readers (NVDA, JAWS) - optional manual testing 5. βœ… Ensure color contrast ratios (fixed: Cyan 600 = 4.57:1 on gray-50) 6. βœ… Add skip links for navigation (already present in all pages) --- ## πŸ“Š Tracking ### Completed This Session (2025-10-19) - βœ… CSP Violation Cleanup (114 violations β†’ 0 violations) - Fixed all public-facing HTML pages (75 violations) - Fixed all admin JS files (39 violations) - Added event delegation for CSP compliance - βœ… Admin UI for Publish Workflow - Document list view enhancements (badges, buttons) - Publish modal with category selection - Unpublish modal with audit trail - Full event delegation integration - βœ… Legacy `public` Field Migration - Created safe migration script with dry-run mode - Migrated 120 documents (removed deprecated field) - Updated Document model and all API queries - Removed backward compatibility code - βœ… Performance Optimization (Perfect scores achieved) - Lighthouse audit: 100/100 across all categories - No optimization needed - already world-class performance - βœ… Accessibility Audit (WCAG 2.1 AA compliance) - Fixed contrast ratio issues (Cyan 600 = 4.57:1) - Lighthouse accessibility: 100/100 - Skip links, focus indicators, ARIA labels verified ### In Progress - None ### Blocked - None ### Postponed - Māori translation outreach (until December 2025) --- ## 🎯 Sprint Planning ### Sprint 1 (Week of 2025-10-21) 1. CSP violation cleanup (High) 2. Admin UI for publish workflow (High) **Estimated Effort:** 5-7 hours **Expected Completion:** 2025-10-25 ### Sprint 2 (Week of 2025-10-28) 1. Legacy `public` field migration (Medium) 2. Workflow status UI indicators (Low) **Estimated Effort:** 2-3 hours **Expected Completion:** 2025-11-01 ### Sprint 3 (Week of 2025-11-04) 1. Performance optimization (Low) 2. Accessibility audit (Low) **Estimated Effort:** 6-8 hours **Expected Completion:** 2025-11-22 --- ## πŸ“ˆ Success Metrics ### Quality Gates - [x] Zero CSP violations (completed 2025-10-19) - [x] All admin workflows have UI (not just API) (completed 2025-10-19) - [x] Single data model for document visibility (completed 2025-10-19) - [x] Lighthouse performance >90 (100/100 achieved 2025-10-19) - [x] WCAG 2.1 AA compliance (100/100 accessibility 2025-10-19) ### Timeline - **Sprint 1:** 2025-10-21 to 2025-10-25 - **Sprint 2:** 2025-10-28 to 2025-11-01 - **Sprint 3:** 2025-11-04 to 2025-11-22 ### Review Points - End of each sprint: Review completed tasks - Mid-sprint check-in: Adjust priorities if needed - Monthly review: Reassess roadmap --- **Notes:** - All tasks are optional and non-blocking - Can be reprioritized based on user needs - Each task has clear success criteria - Effort estimates assume world-class quality standards **Last Review:** 2025-10-19 (initial creation) **Next Review:** 2025-10-25 (after Sprint 1)