Open lesson

Mission: the stream after the outage

Command palette

This mission workspace keeps code and notes in this browser tab. Export them before closing it. Running code is practice, not an automatic grade for the mission.

Brief

Check after a stop that useful messages remain available and OPEN-17 and OPEN-18 are each applied exactly once in the simulation.

Screens return after an outage. Voss says the second opening vanished; another report claims four openings. Imani accepts neither until messages and effects are counted separately. Mara hands you the fictional topic and checkpoints. Prepare a verifiable answer before the story meeting, without touching a real broker or door. There is no exercise timer.

Your mission

  1. Give the retained message count and the positions read after the stop.
  2. List commands actually applied after restart.
  3. Calculate missing commands and repeated effects in the simulation.
  4. Explain retention's limit and why SUPPLIER-SVC still does not identify a person.

How to check your work

  • 4 raw messages; 3 positions reread.
  • OPEN-17 and OPEN-18 once each.
  • No missing command and no repeated effect.
  • Replay only while records are retained; technical identity is insufficient for attribution.

Course example

records = [
    (0, 40, "E1", "OPEN-17"),
    (0, 41, "E1", "OPEN-17"),
    (0, 42, "E2", "OPEN-18"),
    (1, 12, "E3", "OPEN-17"),
]
checkpoint = {0: 41, 1: 12}  # After applying position 0/40.
action_log = ["OPEN-17"]    # Durable practice copy of the effect.
applied = set(action_log)
remaining = [
    row for row in records if row[1] >= checkpoint[row[0]]
]
for partition, offset, event_id, command_id in remaining:
    if command_id not in applied:
        action_log.append(command_id)
        applied.add(command_id)
expected = {"OPEN-17", "OPEN-18"}
print("raw_messages", len(records))
print("read_after_restart", len(remaining))
print("applied_commands", sorted(applied))
print("missing_commands", sorted(expected - applied))
print("duplicate_effects", len(action_log) - len(set(action_log)))

Code

Use Tab to leave the editor. Ctrl+Enter runs the source. The lines beginning with # are task reminders. Python ignores them. Write your code beneath them.

Python console

Loading laboratory…

Explore Python or SQL here; this is not an operating-system shell.

This is a disposable browser experiment. The code run here is not recorded as a completed mission.

Each command starts a fresh disposable worker: it runs a captured copy of your current source, then your command with the lesson fixtures. Changes are discarded afterward. Commands never save source or award XP. Ctrl+Enter executes the command.

Virtual workspace files

Source and declarative assets are readable here without JavaScript. Python input files are created at runtime; SQL setup initializes the disposable database.

source.py

Current editor source. Inspection shows your current edits.

# Give the retained message count and the positions read after the stop.
# List commands actually applied after restart.
# Calculate missing commands and repeated effects in the simulation.
# Explain retention's limit and why SUPPLIER-SVC still does not identify a person.

exemple.py

Declarative lesson asset; this is not a file created in the Python filesystem.

records = [
    (0, 40, "E1", "OPEN-17"),
    (0, 41, "E1", "OPEN-17"),
    (0, 42, "E2", "OPEN-18"),
    (1, 12, "E3", "OPEN-17"),
]
checkpoint = {0: 41, 1: 12}  # After applying position 0/40.
action_log = ["OPEN-17"]    # Durable practice copy of the effect.
applied = set(action_log)
remaining = [
    row for row in records if row[1] >= checkpoint[row[0]]
]
for partition, offset, event_id, command_id in remaining:
    if command_id not in applied:
        action_log.append(command_id)
        applied.add(command_id)
expected = {"OPEN-17", "OPEN-18"}
print("raw_messages", len(records))
print("read_after_restart", len(remaining))
print("applied_commands", sorted(applied))
print("missing_commands", sorted(expected - applied))
print("duplicate_effects", len(action_log) - len(set(action_log)))