psitta

Documentation Index

docs/architecture/sessions.md

Purpose

Describe the role of sessions in the learning engine and their lifecycle.

This document specifies:

Internal exercise details are described in exercises.md.


Role of a Session

A Session is a runtime orchestrator.

It is responsible for:

It is not responsible for:


Conceptual Diagram

%%{init: {"class": {"hideEmptyMembersBox": true}} }%%
classDiagram

namespace Answer {
  class ExerciseAnswer
  class SubmittedExerciseAnswer
  class PreviewExerciseAnswer
}
    class SessionType
    class Session
    class Exercise
    class SessionResult
    class SRSConfig

    class ExerciseScheduler

    

    Session --> ExerciseScheduler : Orchestrate
    Session <-- SessionType : Initialisation

    ExerciseScheduler "1" --> "0..*" Exercise : Schedule
    Session "1" --> "1" SRSConfig : config
    Session "1" --> "1" SessionResult : result

    ExerciseAnswer <|-- SubmittedExerciseAnswer
    ExerciseAnswer <|-- PreviewExerciseAnswer

    Session ..> ExerciseAnswer : submit / preview

Session Lifecycle

A session follows a strict lifecycle:

  1. Creation

    • A session is created with:

      • a list of Exercise objects,
      • a SessionType,
      • a SRSConfig.
    • No exercise is yet active.

  2. Start

    • The session is explicitly started (begin).
    • The first exercise becomes current.
  3. Execution

    • The session:

      • ask the ExerciseShceduler for the next exercise,
      • is called with user responses (ExerciseAnswer) by the application layer,
      • delegates processing to exercises,
  4. End


Exercise Sequencing

The ExerciseScheduler:

The Scheduler:


Interaction with Exercises

When a user response is submitted:

  1. The session receives an ExerciseAnswer.
  2. It delegates the response to the current exercise.
  3. The exercise:

    • updates its state,
    • updates the progression mechanisms.
  4. The session maintains exercise ordering, updates SessionResult, then selects the next exercise.

The session does not know:


Preview vs Submitted Submission

The session distinguishes two types of user interactions:

This distinction guarantees that:


SessionType

A SessionType represents the pedagogical intent of the session.

It is used:

It is not a long-lived state of the session and does not influence its internal behaviour after initialisation.


SessionResult

A SessionResult is a summary object. It is created during initialisation and updated after each response.

It aggregates:

It contains:


Core Invariants


What the Session Intentionally Ignores

The session ignores: