Riksdagsmonitor Intelligence Platform โ€” API Documentation - v1.0.47
    Preparing search index...

    Hack23 Logo

    ๐Ÿ”„ Riksdagsmonitor โ€” State Diagrams

    ๐ŸŽญ System Behavior and State Transitions for Democratic Transparency
    ๐Ÿ“Š Lifecycle Management ยท Workflow States ยท AI-Driven Processes

    Owner Version Effective Date Review Cycle

    ๐Ÿ“‹ Document Owner: CEO | ๐Ÿ“„ Version: 1.2 | ๐Ÿ“… Last Updated: 2026-05-06 (UTC)
    ๐Ÿ”„ Review Cycle: Quarterly | โฐ Next Review: 2026-08-06
    ๐Ÿข Owner: Hack23 AB (Org.nr 5595347807) | ๐Ÿท๏ธ Classification: Public


    This document illustrates the key state transitions and behavioral models within the Riksdagsmonitor platform. These diagrams provide a comprehensive view of how system components change states in response to user interactions, data updates, workflow executions, and automated processes. All state models align with Hack23 AB's AI Policy and Secure Development Policy.

    DocumentFocusDescription
    ๐Ÿ›๏ธ Architecture๐Ÿ—๏ธ C4 ModelsSystem context, containers, components
    ๐Ÿ“Š Data Model๐Ÿ“Š DataEntity relationships and data dictionary
    ๐Ÿ”„ Flowchart๐Ÿ”„ ProcessesBusiness and data flow diagrams
    ๐Ÿ“ˆ State Diagram๐Ÿ“ˆ StatesSystem state transitions and lifecycles
    ๐Ÿง  Mindmap๐Ÿง  ConceptsSystem conceptual relationships
    ๐Ÿ’ผ SWOT๐Ÿ’ผ StrategyStrategic analysis and positioning
    ๐Ÿ›ก๏ธ Security Architecture๐Ÿ”’ SecurityCurrent security controls and design
    ๐Ÿš€ Future Security๐Ÿ”ฎ SecurityPlanned security improvements
    ๐ŸŽฏ Threat Model๐ŸŽฏ ThreatsSTRIDE/MITRE ATT&CK analysis
    ๐Ÿ”ง Workflows๐Ÿ”ง DevOpsCI/CD automation and pipelines
    ๐Ÿ›ก๏ธ CRA Assessmentโš–๏ธ ComplianceEU Cyber Resilience Act conformity
    ๐Ÿš€ Future Architecture๐Ÿ”ฎ EvolutionArchitectural evolution roadmap
    ๐Ÿ“Š Future Data Model๐Ÿ”ฎ DataEnhanced data architecture plans
    ๐Ÿ”„ Future Flowchart๐Ÿ”ฎ ProcessesImproved process workflows
    ๐Ÿ“ˆ Future State Diagram๐Ÿ”ฎ StatesAdvanced state management
    ๐Ÿง  Future Mindmap๐Ÿ”ฎ ConceptsCapability expansion plans
    ๐Ÿ’ผ Future SWOT๐Ÿ”ฎ StrategyFuture strategic opportunities

    1. ๐Ÿ“ฐ News Article Lifecycle States

    ๐Ÿ“Š Data Focus: Illustrates how news articles flow from generation to publication across 14 languages.

    ๐Ÿ”„ Process Focus: Shows state transitions as articles are generated, translated, validated, reviewed, and published.

    ๐Ÿค– AI Integration: Agentic workflows (Copilot + riksdag-regering-mcp) generate and translate content with human oversight.

    stateDiagram-v2
    [*] --> Draft

    Draft --> Translation: Content Generated
    Draft --> Error: Generation Failed

    Translation --> Validation: All Languages Complete
    Translation --> TranslationFailed: AI Hallucination/Context Loss

    Validation --> Review: All Checks Passed
    Validation --> ValidationFailed: data-translate Markers Remain

    Review --> Approved: Human Approval
    Review --> Rejected: Changes Requested

    Approved --> Published: PR Merged

    Published --> Rollback: Production Issue
    Published --> [*]

    TranslationFailed --> Draft: Retry Translation
    ValidationFailed --> Translation: Fix Translations
    Rejected --> Draft: Revise Content
    Error --> Draft: Fix and Retry
    Rollback --> Draft: Recreate Article

    note right of Draft
    Article generated by Copilot agent
    Swedish content from riksdag-regering-mcp
    data-translate markers added
    end note

    note right of Translation
    Multi-language translation (14 languages)
    EN, SV, DA, NO, FI, DE, FR, ES
    NL, AR, HE, JA, KO, ZH
    end note

    note right of Validation
    scripts/validate-news-translations.js
    Exit 0: All translations complete
    Exit 1: Markers detected
    end note

    note right of Published
    Deployed to production
    Immutable state
    Cannot transition back to DRAFT
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    DRAFTArticle generated by Copilot agent with Swedish content onlyWorkflow triggeredTranslation starts2-5 minutes
    TRANSLATIONMulti-language translation in progress (14 languages)Draft complete, data-translate markers presentAll languages translated3-8 minutes
    VALIDATIONAutomated validation checking for remaining markersTranslation completeValidation script exit 0 or 130-60 seconds
    REVIEWHuman review in pull requestValidation passed, PR createdApproved or rejected1-24 hours
    APPROVEDPR approved, awaiting mergeReviewer approvalPR merged1-60 minutes
    PUBLISHEDMerged to main, deployed to productionPR merged, deployment completeRollback (rare)Permanent
    ERRORGeneration failure requiring interventionAI error, API failureManual fix, retryVariable
    TRANSLATION_FAILEDTranslation error (hallucination, context loss)AI translation errorRetry translation5-15 minutes
    VALIDATION_FAILEDValidation script detected remaining markersscripts/validate-news-translations.js exit 1Fix translations5-10 minutes
    REJECTEDHuman reviewer requested changesChanges requestedRevise contentVariable
    ROLLBACKProduction issue, reverting changesCritical production bugRecreate article10-30 minutes
    From StateEventTo StateConditionsActions
    DRAFTtranslate_completeTRANSLATIONAll languages doneTrigger validation
    DRAFTgeneration_failedERRORAI error, API timeoutLog error, alert team
    TRANSLATIONvalidation_startVALIDATIONTranslation completeRun validate-news-translations.js
    TRANSLATIONtranslation_errorTRANSLATION_FAILEDHallucination detectedLog error, retry
    VALIDATIONvalidation_passedREVIEWExit code 0Create PR
    VALIDATIONvalidation_failedVALIDATION_FAILEDExit code 1, markers foundReturn to translation
    REVIEWapproveAPPROVEDReviewer approvalPrepare merge
    REVIEWrequest_changesREJECTEDFeedback providedNotify author
    APPROVEDmergePUBLISHEDAll checks passedDeploy to production
    PUBLISHEDproduction_issueROLLBACKCritical bug detectedRevert commit
    • PUBLISHED โ†’ DRAFT: โŒ BLOCKED - Published articles are immutable (cannot revert to draft)
    • VALIDATION_FAILED โ†’ PUBLISHED: โŒ BLOCKED - Cannot publish with untranslated markers
    • ERROR โ†’ PUBLISHED: โŒ BLOCKED - Must resolve errors before publishing
    • DRAFT โ†’ PUBLISHED: โŒ BLOCKED - Must pass through TRANSLATION โ†’ VALIDATION โ†’ REVIEW โ†’ APPROVED
    • TRANSLATION โ†’ REVIEW: โŒ BLOCKED - Must validate first
    Error StateDetectionRecoveryRetry LogicNotification
    ERRORAI generation fails, API timeoutManual fix, retry workflowMax 3 attempts, exponential backoff (1m, 2m, 4m)GitHub issue auto-created
    TRANSLATION_FAILEDAI hallucination, context lossAutomatic retry with refined promptMax 2 attempts, 5-minute delayWorkflow annotation
    VALIDATION_FAILEDdata-translate markers remainReturn to translation stepAutomatic retryWorkflow log
    REJECTEDHuman reviewer feedbackManual content revisionN/A (human-driven)PR comment
    ROLLBACKProduction bug detectedManual revert + recreateN/A (manual)GitHub issue, Slack alert

    ๐Ÿ“Š Data Focus: GitHub Actions workflows executing Copilot agents with MCP server integration.

    ๐Ÿ”„ Process Focus: Shows workflow lifecycle from scheduling through deployment.

    ๐Ÿค– AI Integration: Limited Risk AI system per Hack23 AI Policy requiring human oversight.

    stateDiagram-v2
    [*] --> Queued

    Queued --> Running: Workflow Starts
    Queued --> Cancelled: Manual Cancellation

    Running --> Generating: Copilot Agent Active

    Generating --> Translating: Content Generated
    Generating --> HallucinationDetected: AI Error Detected

    Translating --> Validating: Translation Complete
    Translating --> TranslationError: Translation Failed

    Validating --> Success: All Checks Passed
    Validating --> Failure: Validation Failed

    Success --> PRCreated: Pull Request Opened

    PRCreated --> PRReview: Awaiting Review

    PRReview --> Merged: PR Approved & Merged
    PRReview --> Closed: PR Rejected/Cancelled

    Merged --> Deployed: Deployment Complete
    Deployed --> [*]

    HallucinationDetected --> Failure
    TranslationError --> Failure
    Failure --> Logged: Error Logged
    Logged --> [*]
    Closed --> [*]
    Cancelled --> [*]

    note right of Queued
    Scheduled or manual trigger
    Awaiting GitHub Actions runner
    end note

    note right of Generating
    Copilot agent queries riksdag-regering-mcp
    Generates Swedish content
    Real-time monitoring active
    end note

    note right of HallucinationDetected
    AI-specific error state
    Prompt injection detection
    Context drift monitoring
    end note

    note right of PRReview
    Human oversight required
    Limited Risk AI system
    MUST review before merge
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    QUEUEDWorkflow scheduled, awaiting runnerCron trigger or manual dispatchRunner available10-60 seconds
    RUNNINGWorkflow executing, runner assignedRunner allocatedCopilot agent starts10-30 seconds
    GENERATINGCopilot agent generating contentAgent initialized, MCP connectedContent complete2-5 minutes
    TRANSLATINGMulti-language translationContent generatedAll languages done3-8 minutes
    VALIDATINGPlaywright + translation validationTranslation completeValidation exit 0 or 11-2 minutes
    SUCCESSAll checks passedValidation successfulPR created10-30 seconds
    FAILUREWorkflow failedError detectedLoggedImmediate
    HALLUCINATION_DETECTEDAI error (hallucination, prompt injection)AI monitoring alertError loggedImmediate
    TRANSLATION_ERRORTranslation failureTranslation step failedError loggedImmediate
    PR_CREATEDPull request openedSuccess state, PR API callReview requestedImmediate
    PR_REVIEWHuman review in progressPR createdApproved or closed1-24 hours
    MERGEDChanges merged to mainPR approved, merge button clickedDeployment startsImmediate
    DEPLOYEDChanges live in productionGitHub Pages deployment completeMonitoring active2-5 minutes
    CLOSEDPR rejected or cancelledReview rejected, manual closeWorkflow terminatedImmediate
    CANCELLEDWorkflow manually cancelledUser cancellationWorkflow terminatedImmediate
    LOGGEDError logged for auditAny failure stateWorkflow terminatedImmediate
    From StateEventTo StateConditionsActions
    QUEUEDrunner_allocatedRUNNINGRunner availableInitialize environment
    RUNNINGagent_startGENERATINGCopilot agent readyConnect MCP server
    GENERATINGcontent_completeTRANSLATINGSwedish content doneStart translation
    GENERATINGai_errorHALLUCINATION_DETECTEDHallucination/injectionLog error, alert
    TRANSLATINGtranslation_completeVALIDATINGAll languages doneRun validation
    TRANSLATINGtranslation_failedTRANSLATION_ERRORAI errorLog error
    VALIDATINGvalidation_successSUCCESSExit code 0Prepare PR
    VALIDATINGvalidation_failedFAILUREExit code 1Log failure
    SUCCESSpr_createdPR_CREATEDPR API successNotify team
    PR_CREATEDreview_requestedPR_REVIEWReviewer assignedAwait review
    PR_REVIEWapprove_and_mergeMERGEDHuman approvalMerge PR
    PR_REVIEWreject_or_closeCLOSEDHuman rejectionClose PR
    MERGEDdeployment_completeDEPLOYEDGitHub Pages updatedMonitor production
    AI StatePurposeDetection MethodMitigationAudit Log
    HALLUCINATION_DETECTEDDetect AI-generated false informationContent validation, fact-checkingRetry with refined prompt, human reviewโœ… Yes - workflow logs
    TRANSLATION_ERRORDetect translation quality issuesValidation script, marker detectionAutomatic retry, context preservationโœ… Yes - workflow logs
    GENERATINGAI content creation activeWorkflow state trackingReal-time monitoring, timeout (30 min)โœ… Yes - workflow logs
    PR_REVIEWHuman oversight requiredLimited Risk AI systemMUST review before productionโœ… Yes - PR history
    LOGGEDAudit trail for AI operationsAll failure statesCompliance reportingโœ… Yes - permanent logs

    Shared State File: workflow-state.json

    {
    "lastUpdate": "2026-02-15T15:30:00Z",
    "recentArticles": [
    {
    "slug": "2026-02-15-week-ahead-en.html",
    "timestamp": "2026-02-15T15:25:00Z",
    "workflow": "news-week-ahead",
    "title": "Week Ahead in Swedish Parliament",
    "topics": ["parliament", "schedule", "committees"]
    }
    ],
    "mcpQueryCache": {
    "hash123": {
    "query": "recent motions",
    "result": {...},
    "timestamp": "2026-02-15T14:00:00Z"
    }
    },
    "workflows": {
    "news-week-ahead": {
    "lastRun": "2026-02-15T05:51:00Z",
    "status": "success",
    "articles": 1
    },
    "news-evening-analysis": {
    "lastRun": "2026-02-14T18:00:00Z",
    "status": "success",
    "articles": 1
    },
    "news-realtime-monitor": {
    "lastRun": "2026-02-15T14:00:00Z",
    "status": "success",
    "articles": 2
    }
    }
    }

    ๐Ÿ“Š Data Focus: LocalStorage-based caching for CIA dashboard exports and Riksdag data.

    ๐Ÿ”„ Process Focus: Shows data lifecycle from initial fetch through refresh cycles.

    โšก Performance Focus: Minimizes API calls while maintaining data freshness.

    stateDiagram-v2
    [*] --> Empty

    Empty --> Fetching: Initial Load

    Fetching --> Cached: Fetch Success
    Fetching --> Error: Fetch Failed

    Cached --> Stale: Freshness Threshold Exceeded
    Cached --> [*]: User Exits

    Stale --> Refreshing: Background Refresh
    Stale --> Cached: Use Stale Data

    Refreshing --> Cached: Refresh Success
    Refreshing --> Error: Refresh Failed

    Error --> Fetching: Retry
    Error --> Cached: Fallback to Stale Cache
    Error --> [*]: Max Retries Exceeded

    note right of Empty
    No cached data
    First visit or cache cleared
    end note

    note right of Cached
    Valid cached data
    Within freshness threshold
    Served instantly from LocalStorage
    end note

    note right of Stale
    Cached data expired
    Still usable as fallback
    Background refresh triggered
    end note

    note right of Error
    Network failure
    API unavailable
    Fallback to stale cache if available
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    EMPTYNo cached data, initial loadFirst visit, cache clearedFetch startsInstant
    FETCHINGRequesting data from GitHub CDNEmpty state, refresh neededData received or error200-1000ms
    CACHEDValid cached data within freshness thresholdFetch success, refresh successThreshold exceededHours to days
    STALECached data expired beyond thresholdFreshness check failedRefresh initiatedSeconds to minutes
    REFRESHINGBackground refresh in progressStale state detectedData updated or error200-1000ms
    ERRORFetch/refresh failedNetwork error, API timeoutRetry or fallbackSeconds
    Data TypeFreshness ThresholdRationaleFallback Behavior
    Production Stats24 hoursUpdated monthly, low volatilityUse stale cache indefinitely
    Seasonal Patterns7 daysUpdated quarterly, stable dataUse stale cache indefinitely
    Politician Data24 hoursUpdated weekly, moderate volatilityUse stale cache up to 7 days
    Party Performance7 daysUpdated monthly, low volatilityUse stale cache indefinitely
    Election Forecasts24 hoursUpdated daily, high volatilityRequire fresh data, retry
    Risk Assessments24 hoursUpdated daily, high volatilityRequire fresh data, retry
    From StateEventTo StateConditionsActions
    EMPTYpage_loadFETCHINGNo cache existsFetch from CDN
    FETCHINGfetch_successCACHEDHTTP 200, valid JSONStore in LocalStorage
    FETCHINGfetch_failedERRORNetwork error, timeoutLog error, retry
    CACHEDfreshness_checkSTALEAge > thresholdServe stale, trigger refresh
    CACHEDuser_exit[END]Page unloadPersist cache
    STALEbackground_refreshREFRESHINGAuto-triggeredFetch updated data
    STALEimmediate_serveCACHEDUser needs data nowServe stale data
    REFRESHINGrefresh_successCACHEDHTTP 200, valid JSONUpdate LocalStorage
    REFRESHINGrefresh_failedERRORNetwork errorLog error, use stale
    ERRORretryFETCHINGRetry count < maxExponential backoff
    ERRORfallbackCACHEDStale cache availableUse stale data
    ERRORmax_retries[END]3 retries exceededShow error message

    LocalStorage Schema:

    {
    "riksdagsmonitor_cache": {
    "production_stats": {
    "data": {...},
    "timestamp": "2026-02-15T15:30:00Z",
    "version": "1.0"
    },
    "seasonal_patterns": {
    "data": {...},
    "timestamp": "2026-02-10T10:00:00Z",
    "version": "1.0"
    },
    "politician_data": {
    "data": {...},
    "timestamp": "2026-02-15T14:00:00Z",
    "version": "1.0"
    }
    }
    }

    Freshness Check Algorithm:

    function isFresh(cachedItem, thresholdHours) {
    const now = new Date();
    const cached = new Date(cachedItem.timestamp);
    const ageHours = (now - cached) / (1000 * 60 * 60);
    return ageHours < thresholdHours;
    }

    ๐Ÿ“Š Data Focus: PR lifecycle from creation through deployment.

    ๐Ÿ”„ Process Focus: Shows review workflow with quality gates and human approval.

    ๐Ÿ”’ Security Focus: All checks must pass before merge.

    stateDiagram-v2
    [*] --> Open

    Open --> Draft: Mark as Draft
    Open --> CIRunning: CI Triggered

    Draft --> Open: Ready for Review

    CIRunning --> CIPassed: All Checks Pass
    CIRunning --> CIFailed: Quality Gate Failed

    CIPassed --> ReviewRequested: Assign Reviewer

    CIFailed --> Open: Fix Issues

    ReviewRequested --> ChangesRequested: Feedback Provided
    ReviewRequested --> Approved: Review Approved

    ChangesRequested --> Open: Push Updates

    Approved --> ReviewDismissed: New Commits Pushed
    Approved --> MergeReady: All Requirements Met

    ReviewDismissed --> ReviewRequested: Re-request Review

    MergeReady --> Merged: Merge Button Clicked

    Merged --> Deployed: GitHub Pages Deployment
    Deployed --> [*]

    Open --> Closed: Close without Merge
    Draft --> Closed: Abandon Draft
    Closed --> [*]

    note right of CIRunning
    HTMLHint validation
    Link checking (linkinator)
    JavaScript linting (ESLint)
    Dependency scanning
    Secret scanning
    end note

    note right of MergeReady
    All checks passed
    Approved by reviewer
    No merge conflicts
    Branch up to date
    end note

    note right of Deployed
    GitHub Pages updated
    CDN cache invalidated
    Production monitoring active
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    OPENPR created, awaiting CIPR openedCI startsSeconds
    DRAFTWork-in-progress, not ready for reviewMarked as draftReady for reviewHours to days
    CI_RUNNINGQuality checks executingPR opened, new commitsChecks complete2-5 minutes
    CI_PASSEDAll checks passedAll workflows greenReview requestedSeconds
    CI_FAILEDQuality gate failedHTMLHint error, broken linksFix pushedVariable
    REVIEW_REQUESTEDAssigned to reviewerChecks passedReview submitted1-24 hours
    CHANGES_REQUESTEDFeedback provided, changes neededReviewer requests changesUpdates pushedVariable
    APPROVEDApproved by reviewerReviewer approvalMerge or new commitsMinutes to hours
    REVIEW_DISMISSEDPrevious approval dismissedNew commits after approvalRe-review requestedSeconds
    MERGE_READYAll requirements metApproved + checks passed + no conflictsMerge initiatedMinutes
    MERGEDChanges merged to mainMerge button clickedDeployment startsSeconds
    CLOSEDPR closed without mergeManual close, abandonmentWorkflow terminatedImmediate
    DEPLOYEDChanges live in productionGitHub Pages deployment completeMonitoring active2-5 minutes
    CheckToolPurposeFailure Action
    HTML ValidationHTMLHintStandards complianceโŒ Block merge, show errors
    Link CheckingLinkinator v6Verify internal/external linksโŒ Block merge, list broken links
    JavaScript LintingESLint 10Code qualityโš ๏ธ Warn (clean: 0 errors, 1 warning)
    Dependency ScanningDependabotVulnerability detectionโŒ Block merge if critical
    Secret ScanningGitHubCredential leak detectionโŒ Block merge, remove secrets
    CodeQLGitHubSecurity vulnerability scanโš ๏ธ Review required if alerts
    From StateEventTo StateConditionsActions
    OPENmark_draftDRAFTUser actionPrevent reviews
    OPENci_triggerCI_RUNNINGCommit detectedRun workflows
    DRAFTready_for_reviewOPENUser marks readyAllow reviews
    CI_RUNNINGchecks_passedCI_PASSEDAll workflows greenEnable merge
    CI_RUNNINGchecks_failedCI_FAILEDAny workflow redBlock merge
    CI_FAILEDpush_fixOPENNew commitsRe-run CI
    CI_PASSEDrequest_reviewREVIEW_REQUESTEDReviewer assignedNotify reviewer
    REVIEW_REQUESTEDapproveAPPROVEDReviewer approvalEnable merge
    REVIEW_REQUESTEDrequest_changesCHANGES_REQUESTEDFeedback providedBlock merge
    CHANGES_REQUESTEDpush_updatesOPENNew commitsRe-run CI
    APPROVEDnew_commitsREVIEW_DISMISSEDCommits after approvalRe-request review
    APPROVEDall_requirementsMERGE_READYChecks + approval + no conflictsShow merge button
    MERGE_READYmergeMERGEDMerge button clickedStart deployment
    MERGEDdeployment_completeDEPLOYEDGitHub Pages updatedMonitor production
    OPENcloseCLOSEDManual closeEnd workflow

    Before transition to MERGE_READY state, ALL must be true:

    • โœ… All CI checks passed (HTML, links, security)
    • โœ… At least 1 approval from reviewer
    • โœ… No merge conflicts with base branch
    • โœ… Branch is up to date with base
    • โœ… No requested changes pending
    • โœ… No critical security vulnerabilities detected
    • โœ… All required status checks passed

    ๐Ÿ“Š Data Focus: Deployment pipeline from commit to production monitoring.

    ๐Ÿ”„ Process Focus: Shows build, test, security scan, and deployment workflow.

    ๐Ÿ”’ Security Focus: Multiple security gates (CodeQL, Dependabot, secret scanning).

    stateDiagram-v2
    [*] --> Commit

    Commit --> Build: Trigger CI/CD

    Build --> Test: Build Success
    Build --> Failed: Build Error

    Test --> Scan: Tests Passed
    Test --> Failed: Test Failures

    Scan --> DeployStaging: Security Checks Passed
    Scan --> Vulnerable: Critical Vulnerability Detected

    Vulnerable --> Failed: Block Deployment

    DeployStaging --> HealthCheck: Staging Deployed
    DeployStaging --> Failed: Deployment Error

    HealthCheck --> DeployProduction: Health Check Passed
    HealthCheck --> Unhealthy: Health Check Failed

    Unhealthy --> Rollback: Critical Issue

    DeployProduction --> Monitor: Production Deployed
    DeployProduction --> Failed: Deployment Error

    Monitor --> ErrorsDetected: Production Errors
    Monitor --> [*]: Stable

    ErrorsDetected --> Rollback: Critical Errors
    ErrorsDetected --> Monitor: Minor Errors (Log & Monitor)

    Rollback --> Commit: Revert & Fix
    Failed --> Commit: Fix & Retry

    note right of Build
    Vite build executing
    Asset optimization
    HTML/CSS/JS bundling
    end note

    note right of Scan
    CodeQL security scan
    Dependabot vulnerability check
    Secret scanning
    License compliance
    end note

    note right of DeployProduction
    GitHub Pages deployment
    AWS CloudFront cache invalidation
    Multi-region S3 sync
    end note

    note right of Monitor
    Uptime monitoring
    Performance metrics (Core Web Vitals)
    Error tracking
    User analytics
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    COMMITCode pushed to repositoryGit push, PR mergeCI/CD triggeredSeconds
    BUILDVite build executingCommit detectedBuild success/failure1-2 minutes
    TESTUnit tests (Vitest) and E2E tests (Cypress)Build successTests pass/fail2-3 minutes
    SCANSecurity scanningTests passedScans complete3-5 minutes
    FAILEDBuild/test/scan failureAny step failedFix committedVariable
    VULNERABLESecurity vulnerability detectedCritical CVE foundFix appliedVariable
    DEPLOY_STAGINGDeploying to preview environmentScans passedDeployment complete2-3 minutes
    HEALTH_CHECKSmoke tests on stagingStaging deployedChecks pass/fail1-2 minutes
    UNHEALTHYHealth check failedStaging brokenRollback initiatedSeconds
    DEPLOY_PRODUCTIONDeploying to GitHub Pages + CloudFrontHealth checks passedDeployment complete3-5 minutes
    MONITORProduction monitoring activeProduction deployedErrors detected or stableContinuous
    ERRORS_DETECTEDProduction errors detectedMonitoring alertsRollback or mitigateVariable
    ROLLBACKReverting to previous versionCritical errorsRevert complete5-10 minutes
    ScannerTechnologyPurposeBlockingTypical Duration
    CodeQLGitHub Advanced SecurityJavaScript/Python vulnerability detectionโš ๏ธ Review required3-4 minutes
    DependabotGitHub DependabotDependency vulnerability scanningโŒ Critical only1-2 minutes
    Secret ScanningGitHubCredential leak detectionโŒ Yes - block immediately30 seconds
    License CheckCustom scriptOSS license complianceโš ๏ธ Review required10 seconds
    From StateEventTo StateConditionsActions
    COMMITci_triggerBUILDNew commit pushedClone repo, install deps
    BUILDbuild_successTESTVite build completeRun test suite
    BUILDbuild_errorFAILEDCompilation errorLog error, notify
    TESTtests_passedSCANAll tests greenRun security scans
    TESTtests_failedFAILEDAny test redLog failures, notify
    SCANscans_passedDEPLOY_STAGINGNo critical vulnerabilitiesDeploy to staging
    SCANvulnerability_foundVULNERABLECritical CVE detectedBlock deployment, alert
    VULNERABLEfix_appliedFAILEDVulnerability mitigatedRestart pipeline
    DEPLOY_STAGINGstaging_deployedHEALTH_CHECKDeployment successRun smoke tests
    DEPLOY_STAGINGstaging_failedFAILEDDeployment errorLog error, notify
    HEALTH_CHECKchecks_passedDEPLOY_PRODUCTIONStaging healthyDeploy to production
    HEALTH_CHECKchecks_failedUNHEALTHYStaging brokenRollback staging
    UNHEALTHYrollback_initiatedROLLBACKCritical issueRevert deployment
    DEPLOY_PRODUCTIONprod_deployedMONITORDeployment successActivate monitoring
    DEPLOY_PRODUCTIONprod_failedFAILEDDeployment errorLog error, notify
    MONITORerrors_detectedERRORS_DETECTEDError threshold exceededEvaluate severity
    MONITORstable[END]No errors 24hContinue monitoring
    ERRORS_DETECTEDcritical_errorsROLLBACKHigh severityRevert immediately
    ERRORS_DETECTEDminor_errorsMONITORLow severityLog and monitor
    ROLLBACKrevert_completeCOMMITPrevious version restoredFix and redeploy
    FAILEDfix_committedCOMMITIssue resolvedRestart pipeline
    TargetTechnologyPurposeDeployment TimeAvailability
    GitHub PagesGitHub CDNPrimary hosting2-3 minutes99.9% SLA
    AWS CloudFront600+ PoPsGlobal CDN3-5 minutes99.99% SLA
    S3 us-east-1Amazon S3Primary storage1-2 minutes99.99% SLA
    S3 eu-west-1Amazon S3Replica storageAsync (<15 min)99.99% SLA

    Staging Health Checks:

    • โœ… HTTP 200 response for index.html
    • โœ… All 14 language versions accessible
    • โœ… CSS/JS assets loading
    • โœ… No console errors
    • โœ… Links resolve correctly

    Production Health Checks:

    • โœ… All staging checks
    • โœ… CloudFront cache serving correctly
    • โœ… S3 replication complete
    • โœ… Core Web Vitals within targets (LCP < 2.5s, FID < 100ms, CLS < 0.1)
    • โœ… Uptime monitoring active

    ๐Ÿ“Š Data Focus: Multi-language content validation lifecycle.

    ๐Ÿ”„ Process Focus: Shows translation workflow from marking through publishing.

    ๐Ÿค– AI Integration: Agentic translation with automated validation.

    stateDiagram-v2
    [*] --> Untranslated

    Untranslated --> Skip: Content Exempt
    Untranslated --> Marked: data-translate Markers Added

    Marked --> Translating: Agentic Translation Started

    Translating --> Translated: All Languages Complete
    Translating --> Failed: Translation Error

    Translated --> Validated: Validation Script Passed
    Translated --> Invalid: Markers Remain

    Failed --> Retrying: Retry Translation
    Retrying --> Translating: Retry Attempt
    Retrying --> Failed: Max Retries Exceeded

    Invalid --> Translating: Fix Translations

    Validated --> Published: Clean Content Deployed

    Published --> Rollback: Production Issue
    Published --> [*]

    Rollback --> Untranslated: Recreate Content
    Skip --> Published: Exempt Content

    note right of Marked
    Swedish API content wrapped
    <span data-translate="true" lang="sv">
    14 language versions needed
    end note

    note right of Translating
    Copilot agent translating
    EN, SV, DA, NO, FI, DE, FR, ES
    NL, AR, HE, JA, KO, ZH
    end note

    note right of Validated
    scripts/validate-news-translations.js
    Exit code 0 (success)
    No markers remaining
    end note

    note right of Published
    Clean translated content live
    No data-translate markers
    All languages accessible
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    UNTRANSLATEDSwedish API content not yet translatedContent generatedMarkers addedSeconds
    SKIPContent exempt from translationStatic content, imagesDirect publishN/A
    MARKEDdata-translate="true" lang="sv" markers addedSwedish content identifiedTranslation startsSeconds
    TRANSLATINGAgentic translation in progressMarkers presentAll languages done3-8 minutes
    TRANSLATEDAll languages completedTranslation doneValidation runsSeconds
    VALIDATEDValidation script passed (exit 0)No markers remainReady to publishSeconds
    INVALIDMarkers remain (validation exit 1)Validation detected markersFix translationsVariable
    FAILEDTranslation errorAI error, context lossRetry or manual fixVariable
    RETRYINGRetry translation attemptFirst attempt failedRetry completes3-8 minutes
    PUBLISHEDClean content deployedValidation passedMonitoring activePermanent
    ROLLBACKRevert to previous versionProduction issueContent recreated5-10 minutes

    Tool: scripts/validate-news-translations.js

    Purpose: Detects remaining data-translate="true" markers in non-Swedish articles

    Exit Codes:

    • 0 - Success: All articles fully translated
    • 1 - Failure: Untranslated markers found

    Usage:

    # Validate all news articles
    npm run validate-news

    # Check specific directory
    node scripts/validate-news-translations.js news/

    Sample Output (Failure):

    ๐Ÿ“‹ NEWS TRANSLATION VALIDATION

    โœ“ Fully translated: 142
    โœ— Needs translation: 3

    Untranslated Articles:
    โœ— 2026-02-15-committee-reports-de.html - 10 markers
    Samples:
    1. "Bรคttre fรถrutsรคttningar att sรคnda ut statlig personal"
    2. "Ett register fรถr alla bostadsrรคtter"

    Action Required:
    1. Open each file listed above
    2. Find all <span data-translate="true" lang="sv">Swedish text</span> elements
    3. Translate the Swedish text to the article's target language
    4. Replace the span with plain translated text
    5. Consult TRANSLATION_GUIDE.md for terminology
    From StateEventTo StateConditionsActions
    UNTRANSLATEDexempt_contentSKIPStatic/image contentPublish directly
    UNTRANSLATEDadd_markersMARKEDSwedish API contentWrap in data-translate spans
    MARKEDstart_translationTRANSLATINGMarkers presentTrigger Copilot agent
    TRANSLATINGtranslation_completeTRANSLATEDAll 14 languages doneRun validation
    TRANSLATINGtranslation_errorFAILEDAI error, hallucinationLog error
    TRANSLATEDvalidation_successVALIDATEDExit code 0Prepare publish
    TRANSLATEDvalidation_failedINVALIDExit code 1, markers foundReturn to translation
    INVALIDfix_translationsTRANSLATINGManual fix or retryRe-translate
    FAILEDretryRETRYINGRetry count < maxRetry attempt
    RETRYINGretry_attemptTRANSLATINGNew translation jobAttempt translation
    RETRYINGmax_retriesFAILED3 retries exceededManual intervention
    VALIDATEDpublishPUBLISHEDAll checks passedDeploy to production
    PUBLISHEDproduction_issueROLLBACKCritical bugRevert changes
    ROLLBACKrecreateUNTRANSLATEDContent needs fixRestart workflow
    SKIPpublishPUBLISHEDExempt contentDeploy directly

    Swedish Content (Needs Translation):

    <p>
    The committee proposes
    <span data-translate="true" lang="sv">bรคttre fรถrutsรคttningar fรถr statlig personal</span>
    in the budget.
    </p>

    Translated Content (Clean):

    <p>
    The committee proposes better conditions for government personnel in the budget.
    </p>
    Language CodeLanguage NameScriptDirectionTranslation Required
    enEnglishLatinLTRโœ… Yes
    svSwedishLatinLTRโŒ No (source)
    daDanishLatinLTRโœ… Yes
    noNorwegianLatinLTRโœ… Yes
    fiFinnishLatinLTRโœ… Yes
    deGermanLatinLTRโœ… Yes
    frFrenchLatinLTRโœ… Yes
    esSpanishLatinLTRโœ… Yes
    nlDutchLatinLTRโœ… Yes
    arArabicArabicRTLโœ… Yes
    heHebrewHebrewRTLโœ… Yes
    jaJapaneseKanji/Hiragana/KatakanaLTRโœ… Yes
    koKoreanHangulLTRโœ… Yes
    zhChineseSimplified ChineseLTRโœ… Yes

    Translation Retry Policy:

    • Max Attempts: 3
    • Backoff Strategy: Exponential (5 min, 10 min, 20 min)
    • Retry Triggers: AI hallucination, context loss, network error
    • Manual Intervention: After 3 failed attempts

    Validation Retry Policy:

    • Max Attempts: Unlimited (automatic retry after fixes)
    • Backoff Strategy: None (immediate re-validation)
    • Retry Triggers: Markers detected, validation script exit 1
    • Manual Intervention: If markers persist after 3 translation attempts

    ๐Ÿ“Š Data Focus: 23 analysis artifacts (Families A-D) produced by every agentic news workflow.

    ๐Ÿ”„ Process Focus: Shows artifact folder lifecycle from creation through consumption by article rendering.

    ๐Ÿค– AI Integration: Artifacts are produced by Copilot agents and validated by scripts/agentic/analysis-gate.ts.

    stateDiagram-v2
    [*] --> Empty

    Empty --> Populating: Agentic workflow starts writing artifacts

    Populating --> Populated: All 23 artifacts written
    Populating --> Incomplete: Timeout or agent error

    Populated --> GateChecking: analysis-gate.ts invoked

    GateChecking --> GatePassed: All checks 1-9b pass
    GateChecking --> GateFailed: One or more checks fail

    GateFailed --> Populating: Agent retries failed artifacts

    GatePassed --> Consumed: render-articles.ts reads artifacts

    Consumed --> Archived: Article published, artifacts retained
    Archived --> [*]

    Incomplete --> [*]: Workflow terminates with error

    note right of Empty
    analysis/daily/YYYY-MM-DD/type/ folder
    23 expected files (Families A-D)
    end note

    note right of GateChecking
    Check 1: Artifact existence (23 files)
    Check 2: No stub placeholders
    Check 3: Minimum word count
    Check 4: Evidence citations
    Check 5: Mermaid diagrams with colour
    Check 6: Pass-2 evidence (revision proof)
    Check 7: Cross-references
    Check 8: Data-source connectivity audit
    Check 9a: Political classification
    Check 9b: Agency evidence (Statskontoret)
    end note

    note right of Consumed
    aggregate-analysis.ts aggregates
    render-articles.ts renders HTML
    Artifacts become read-only
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    EMPTYAnalysis folder created but no artifacts writtenWorkflow triggeredFirst artifact writtenSeconds
    POPULATINGAgent writing artifacts to folderFirst artifact writeAll 23 present or timeout5-15 minutes
    INCOMPLETETimeout or error, fewer than 23 artifactsAgent timeout/errorWorkflow terminatesN/A
    POPULATEDAll 23 artifacts present in folder23 files writtenGate check invokedSeconds
    GATE_CHECKINGanalysis-gate.ts running checks 1-9bPopulated statePass or fail5-30 seconds
    GATE_PASSEDAll gate checks passedAll checks passRender startsSeconds
    GATE_FAILEDOne or more checks failedAny check failsRetry or terminateVariable
    CONSUMEDArtifacts read by render pipelinerender-articles.ts invokedArticle published1-5 minutes
    ARCHIVEDArtifacts retained for audit trailArticle publishedPermanentPermanent

    ๐Ÿ“Š Data Focus: Intelligence assessment lifecycle for political analysis products.

    ๐Ÿ”„ Process Focus: Shows the intelligence cycle from collection through dissemination and feedback.

    ๐Ÿค– AI Integration: Horizon stratification (T+72h โ†’ T+1460d) drives assessment scope and confidence levels.

    stateDiagram-v2
    [*] --> Collection

    Collection --> Processing: Raw data gathered

    Processing --> Analysis: Data cleaned and structured

    Analysis --> Assessment: Analytical products created

    Assessment --> Dissemination: Confidence labels assigned

    Dissemination --> Feedback: Published to audience

    Feedback --> Collection: New requirements identified
    Feedback --> [*]: Cycle complete

    Collection --> Collection: Continuous monitoring

    note right of Collection
    Sources: Riksdag MCP (32 tools)
    SCB statistics, IMF economic data
    Government documents, voting records
    end note

    note right of Analysis
    20 methodologies applied
    39 analysis templates used
    Horizon-specific framing:
    T+72h, T+7d, T+30d, T+90d, T+365d, T+1460d
    end note

    note right of Assessment
    Confidence levels: High/Medium/Low
    WEP language ladder per horizon band
    Scenario analysis (โ‰ฅ3 scenarios)
    end note

    note right of Dissemination
    14 languages, RTL support
    Article rendering pipeline
    RSS, sitemap, indexes generated
    end note
    StateDescriptionEntry ConditionsExit ConditionsTypical Duration
    COLLECTIONGathering raw political data from sourcesWorkflow trigger or scheduleSufficient data gathered2-5 minutes
    PROCESSINGCleaning, structuring, deduplicationRaw data availableStructured data ready1-3 minutes
    ANALYSISApplying methodologies and templatesStructured data readyAnalysis artifacts produced5-15 minutes
    ASSESSMENTAssigning confidence, creating judgmentsAnalysis completeAssessment products ready2-5 minutes
    DISSEMINATIONPublishing to audience in multiple languagesAssessment approvedContent published3-10 minutes
    FEEDBACKReceiving feedback, identifying new requirementsContent publishedNew PIRs identifiedContinuous
    HorizonTimeframeScopeConfidence BandScenario Depth
    T+72h3 daysTacticalHigh2-3 scenarios
    T+7d1 weekTactical/OperationalHigh-Medium3 scenarios
    T+30d1 monthOperationalMedium3-4 scenarios
    T+90dQuarterStrategicMedium-Low4 scenarios
    T+365d1 yearStrategicLow-Medium4+ scenarios + wildcards
    T+1460dElection cycleGrand strategicLow4ร—3 coalition branches + wildcards

    State CategoryStateMean DurationP50P95P99
    Article LifecycleDRAFT2-5 min3 min7 min10 min
    Article LifecycleTRANSLATION3-8 min5 min12 min20 min
    Article LifecycleVALIDATION30-60 sec45 sec90 sec2 min
    Article LifecycleREVIEW1-24 hours6 hours24 hours48 hours
    WorkflowQUEUED10-60 sec30 sec90 sec2 min
    WorkflowGENERATING2-5 min3 min7 min10 min
    WorkflowVALIDATING1-2 min90 sec3 min5 min
    DashboardFETCHING200-1000ms500ms1.5 sec3 sec
    DashboardCACHEDHours to days12 hours48 hours7 days
    PR ReviewCI_RUNNING2-5 min3 min7 min10 min
    PR ReviewREVIEW_REQUESTED1-24 hours4 hours24 hours48 hours
    CI/CDBUILD1-2 min90 sec3 min5 min
    CI/CDTEST2-3 min150 sec4 min6 min
    CI/CDSCAN3-5 min4 min7 min10 min
    TranslationTRANSLATING3-8 min5 min12 min20 min

    Top 10 Most Frequent Transitions (Weekly):

    From StateTo StateFrequencySuccess Rate
    DRAFTTRANSLATION~5098%
    TRANSLATIONVALIDATION~5095%
    VALIDATIONREVIEW~48100%
    REVIEWAPPROVED~4594%
    APPROVEDPUBLISHED~45100%
    QUEUEDRUNNING~50100%
    RUNNINGGENERATING~5098%
    FETCHINGCACHED~100095%
    CACHEDSTALE~200100%
    OPENCI_RUNNING~50100%
    TransitionError RatePrimary CauseMitigation
    GENERATING โ†’ HALLUCINATION_DETECTED2%AI hallucinationRefined prompts, fact-checking
    TRANSLATION โ†’ TRANSLATION_FAILED5%Context lossRetry with context preservation
    VALIDATION โ†’ VALIDATION_FAILED5%Incomplete translationAutomatic retry
    FETCHING โ†’ ERROR5%Network timeoutFallback to stale cache
    BUILD โ†’ FAILED2%Dependency issuesLock file management
    TEST โ†’ FAILED1%RegressionPre-commit testing
    SCAN โ†’ VULNERABLE<1%New CVEAutomatic Dependabot PRs

    States with Long P95 Durations:

    StateP95 DurationBottleneck CauseOptimization
    REVIEW (Article)24 hoursHuman availabilityAutomate more checks, expand reviewer pool
    TRANSLATION12 minAI processing timeParallel translation, caching
    SCAN (Security)7 minCodeQL analysisIncremental analysis
    REVIEW_REQUESTED (PR)24 hoursHuman availabilityExpand reviewer pool, SLA enforcement

    Key Metrics to Track:

    1. Article Generation Success Rate: % of workflows reaching PUBLISHED state
    2. Translation Quality: % of articles passing validation on first attempt
    3. Review Turnaround Time: Time from REVIEW โ†’ APPROVED
    4. Cache Hit Rate: % of dashboard requests served from CACHED state
    5. CI/CD Success Rate: % of commits reaching DEPLOYED state
    6. Production Uptime: Time in MONITOR state without errors
    7. Rollback Frequency: Number of ROLLBACK events per week
    MetricWarning ThresholdCritical ThresholdAction
    Article Generation Failures> 5%> 10%Investigate AI/MCP server
    Translation Failures> 10%> 20%Review translation prompts
    CI/CD Failures> 5%> 15%Check infrastructure
    Cache Errors> 10%> 25%Verify CDN availability
    Production Errors> 0.1%> 1%Immediate rollback
    Review Backlog> 10 PRs> 20 PRsExpand reviewer pool

    Limited Risk AI System Classification:

    • โœ… Human oversight required (PR_REVIEW state)
    • โœ… AI-specific states documented (HALLUCINATION_DETECTED, TRANSLATION_ERROR)
    • โœ… Audit logs maintained (LOGGED state, workflow history)
    • โœ… Error detection and recovery (automatic retries, rollback procedures)
    • โœ… Transparency (state transitions visible in PRs and logs)

    AI Risk Controls:

    RiskState Where Risk OccursMitigationMonitoring
    HallucinationGENERATINGFact-checking, human reviewHALLUCINATION_DETECTED state
    Prompt InjectionGENERATINGInput validation, sandboxingReal-time detection
    Context LossTRANSLATIONContext preservation, retryTRANSLATION_FAILED state
    Bias AmplificationGENERATING, TRANSLATINGDiverse training data, reviewManual review in PR_REVIEW
    Data PoisoningGENERATINGTrusted data sources onlySource validation

    Security-Critical Invariants:

    1. VULNERABLE โ†’ DEPLOY_PRODUCTION: โŒ BLOCKED - Cannot deploy with critical vulnerabilities
    2. VALIDATION_FAILED โ†’ PUBLISHED: โŒ BLOCKED - Cannot publish untranslated content
    3. CI_FAILED โ†’ MERGED: โŒ BLOCKED - Cannot merge with failing checks
    4. HALLUCINATION_DETECTED โ†’ PUBLISHED: โŒ BLOCKED - Cannot publish AI errors without review
    5. ERROR โ†’ DEPLOYED: โŒ BLOCKED - Cannot deploy failed builds

    All state transitions MUST be logged with:

    • โœ… Timestamp (ISO 8601 format)
    • โœ… From State
    • โœ… To State
    • โœ… Triggering Event
    • โœ… Actor (user, system, AI agent)
    • โœ… Conditions Met (or failed)
    • โœ… Actions Taken
    • โœ… Outcome (success/failure)

    Retention Policy: 90 days for operational logs, 7 years for compliance logs


    DocumentRelevant State DiagramsIntegration Point
    ARCHITECTURE.mdDashboard Data States, CI/CD PipelineC4 Container diagram component states
    WORKFLOWS.mdAgentic Workflow States, CI/CD PipelineGitHub Actions workflow execution
    THREAT_MODEL.mdAll state diagramsState transition security risks
    TRANSLATION_GUIDE.mdTranslation Validation StatesMulti-language content workflow
    FLOWCHART.mdArticle Lifecycle StatesProcess and data flow diagrams
    Architecture ComponentState DiagramKey States
    Interactive DashboardsDashboard Data StatesEMPTY, FETCHING, CACHED, STALE
    Static WebsiteCI/CD PipelineBUILD, TEST, DEPLOY_PRODUCTION
    News GenerationArticle Lifecycle, Agentic WorkflowDRAFT, GENERATING, TRANSLATION, PUBLISHED
    GitHub ActionsAgentic Workflow, CI/CD PipelineQUEUED, RUNNING, DEPLOYED
    Quality GatesPR Review States, CI/CD PipelineCI_RUNNING, CI_PASSED, CI_FAILED
    WorkflowState DiagramExecution Path
    news-evening-analysis.md + 9 other per-type news workflowsArticle Lifecycle, Agentic WorkflowQUEUED โ†’ ANALYSING โ†’ AGGREGATING โ†’ RENDERING โ†’ VALIDATING โ†’ PR_CREATED
    news-translate.mdArticle Lifecycle, Agentic WorkflowQUEUED โ†’ READING_RENDERED_HTML โ†’ TRANSLATING โ†’ VALIDATING โ†’ PR_CREATED
    news-realtime-monitor.mdArticle Lifecycle, Agentic WorkflowQUEUED โ†’ ANALYSING โ†’ AGGREGATING โ†’ RENDERING โ†’ VALIDATING โ†’ PR_CREATED
    quality-checks.ymlPR Review States, CI/CD PipelineCI_RUNNING โ†’ CI_PASSED/CI_FAILED
    dependency-review.ymlCI/CD PipelineSCAN โ†’ VULNERABLE/PASSED

    Enhanced AI Monitoring:

    • CONFIDENCE_SCORE_LOW - AI-generated content below confidence threshold
    • HUMAN_OVERRIDE_REQUIRED - Manual intervention needed
    • AI_EXPLANATION_GENERATED - AI provides reasoning for decisions

    Advanced Caching:

    • PREFETCHING - Proactive cache warming
    • CACHE_INVALIDATION - Explicit cache clearing
    • MULTI_REGION_SYNC - Cross-region cache synchronization

    Deployment Optimization:

    • CANARY_DEPLOYMENT - Gradual rollout to subset of users
    • BLUE_GREEN_DEPLOYMENT - Zero-downtime deployments
    • FEATURE_FLAG_EVALUATION - Dynamic feature enablement
    • Real-time state transition dashboard (Grafana)
    • Machine learning-based anomaly detection for state durations
    • Predictive analytics for workflow success rates
    • Automated bottleneck identification and alerts
    • Auto-retry for transient failures (network, API timeouts)
    • Smart cache preloading based on user behavior patterns
    • Automated rollback on production error thresholds
    • Self-healing workflows for common failure scenarios
    DocumentFocusDescription
    ๐Ÿ›๏ธ Architecture๐Ÿ—๏ธ C4 ModelsSystem context, containers, components
    ๐Ÿ“Š Data Model๐Ÿ“Š DataEntity relationships and data dictionary
    ๐Ÿ”„ Flowchart๐Ÿ”„ ProcessesBusiness and data flow diagrams
    ๐Ÿ“ˆ State Diagram๐Ÿ“ˆ StatesSystem state transitions and lifecycles
    ๐Ÿง  Mindmap๐Ÿง  ConceptsSystem conceptual relationships
    ๐Ÿ’ผ SWOT๐Ÿ’ผ StrategyStrategic analysis and positioning
    ๐Ÿ›ก๏ธ Security Architecture๐Ÿ”’ SecurityCurrent security controls and design
    ๐Ÿš€ Future Security๐Ÿ”ฎ SecurityPlanned security improvements
    ๐ŸŽฏ Threat Model๐ŸŽฏ ThreatsSTRIDE/MITRE ATT&CK analysis
    ๐Ÿ”ง Workflows๐Ÿ”ง DevOpsCI/CD automation and pipelines
    ๐Ÿ›ก๏ธ CRA Assessmentโš–๏ธ ComplianceEU Cyber Resilience Act conformity
    ๐Ÿš€ Future Architecture๐Ÿ”ฎ EvolutionArchitectural evolution roadmap
    ๐Ÿ“Š Future Data Model๐Ÿ”ฎ DataEnhanced data architecture plans
    ๐Ÿ”„ Future Flowchart๐Ÿ”ฎ ProcessesImproved process workflows
    ๐Ÿ“ˆ Future State Diagram๐Ÿ”ฎ StatesAdvanced state management
    ๐Ÿง  Future Mindmap๐Ÿ”ฎ ConceptsCapability expansion plans
    ๐Ÿ’ผ Future SWOT๐Ÿ”ฎ StrategyFuture strategic opportunities

    ๐Ÿ“‹ Document Control:
    โœ… Approved by: James Pether Sรถrling, CEO
    ๐Ÿ“ค Distribution: Public
    ๐Ÿท๏ธ Classification: Confidentiality: Public
    ๐Ÿ“… Effective Date: 2026-02-15
    โฐ Next Review: 2026-05-15
    ๐ŸŽฏ Framework Compliance: ISO 27001NIST CSF 2.0CIS Controls


    Status: โœ… Implemented and in production. The IMF cache lives in analysis/imf/ (canonical hub) and analysis/daily/*/economic-data.json (per-article vintage cache). Every cache row is vintage-tagged and SHA-256 pinned. Authority: .github/aw/ECONOMIC_DATA_CONTRACT.md v2.1.

    stateDiagram-v2
    [*] --> Empty: cache key absent
    Empty --> Fetching: news-* worker requests dataflow/indicator/country
    Fetching --> Fresh: payload <=6 months old ยท SHA-256 pinned
    Fetching --> Stale: payload >6 months old
    Fetching --> RateLimited: HTTP 429
    Fetching --> Failed: HTTP 5xx / timeout
    Fresh --> Used: article cites with full confidence
    Stale --> Annotated: staleness_annotated=true required
    Annotated --> Used: article cites with downgraded confidence
    RateLimited --> Backoff: exponential 2^n seconds
    Backoff --> Fetching: retry
    Failed --> CacheFallback: serve last cached vintage
    CacheFallback --> Used: article cites with cache-fallback annotation
    Used --> [*]
    stateDiagram-v2
    [*] --> WEO_2026_04: April WEO published; cached
    WEO_2026_04 --> WEO_2026_10: October WEO published (supersedes pointer set)
    WEO_2026_04 --> Archived: superseded; preserved for audit-trail
    WEO_2026_10 --> WEO_2027_04: April 2027 WEO publishes
    WEO_2026_10 --> Archived
    Archived --> [*]: never deleted (provenance integrity)

    Current production guarantees:

    • Vintage label format YYYY-MM enforced by tests/imf-inventory.test.ts
    • supersedes pointer never overwrites prior vintage row (immutable supersedes-chain)
    • Stale vintages (>6 months) trigger automatic article-level annotation per scripts/article-quality-enhancer.ts
    • Cache-fallback path tested by tests/economic-context-multi-provider.test.ts

    ๐ŸŒ Platforms๐Ÿ“ฆ Open-Source Projects๐Ÿ›ก๏ธ Governance & Standards
    ๐Ÿ—ณ๏ธ Riksdagsmonitor โ€” Swedish Parliament intelligence
    ๐Ÿ‡ช๐Ÿ‡บ EU Parliament Monitor โ€” European coverage
    ๐Ÿ•ต๏ธ Citizen Intelligence Agency โ€” political-data engine
    ๐ŸŒ Hack23 AB โ€” corporate site
    ๐Ÿ“ฐ Hack23 Blog โ€” engineering & policy
    ๐Ÿ’ผ Hack23 on LinkedIn
    ๐Ÿ—ณ๏ธ Hack23/riksdagsmonitor
    ๐Ÿ•ต๏ธ Hack23/cia
    ๐Ÿ‡ช๐Ÿ‡บ Hack23/euparliamentmonitor
    ๐Ÿ”Œ Hack23/european-parliament-mcp
    โœ… Hack23/cia-compliance-manager
    ๐Ÿฅ‹ Hack23/black-trigram
    ๐Ÿ  Hack23/homepage
    ๐Ÿ›ก๏ธ Hack23 ISMS-PUBLIC โ€” public ISMS
    ๐Ÿ”’ Information Security Policy
    ๐Ÿค– AI Policy
    ๐Ÿงช Secure Development Policy
    ๐ŸŽฏ Threat Modeling Policy
    โš ๏ธ Vulnerability Management
    ๐Ÿท๏ธ Classification Framework

    OpenSSF Best PracticesOpenSSF ScorecardISO 27001:2022NIST CSF 2.0CIS Controls v8.1Apache 2.0

    ๐Ÿ—ณ๏ธ Empower citizens ยท ๐Ÿ” Strengthen democratic accountability ยท ๐Ÿ•ต๏ธ Illuminate the political process

    ยฉ 2008โ€“2026 Hack23 AB (Org.nr 559534-7807) ยท Maintainer: James Pether Sรถrling, CISSP CISM