Open lesson

Mission: the midnight cleanup

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

Optimize a versioned table without making old states still needed for the investigation inaccessible.

A maintenance job is due in the fictional story. Voss says it is harmless because current data is already in F3. Mara shows you that S100, the version where you did not authorize departure, still points to F1. Send operations a clear decision. The scene has a narrative deadline; the exercise has no timer.

Your mission

  1. Map the files used by S100, S101, and S102.
  2. Separate completed compaction from proposed expiration.
  3. Decide whether S100 may expire and explain the effect on time travel.
  4. Plan checks and records before a later cleanup.

How to check your work

  • S100→F1, S101→F1+F2, S102→F3.
  • Compaction and expiration treated separately.
  • S100 protected; expiration blocked while needed.
  • Dry run, old-version read, archive, digests, approval, and log planned.

Course example

snapshots={
 "S100":{"F1"},
 "S101":{"F1","F2"},
 "S102":{"F3"},
}
protected={"S100","S101"}
candidate_expire={"S100"}
blocked=sorted(candidate_expire & protected)
print("compacted_current_files",sorted(snapshots["S102"]))
print("older_snapshot_files",sorted(snapshots["S100"]))
print("expire_blocked",blocked)
remaining=set(snapshots)-candidate_expire if not blocked else set(snapshots)
referenced=set().union(*(snapshots[s] for s in remaining))
print("retained_snapshots",sorted(remaining))
print("referenced_files",sorted(referenced))
print("can_read_S100","S100" in remaining)

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.

# Map the files used by S100, S101, and S102.
# Separate completed compaction from proposed expiration.
# Decide whether S100 may expire and explain the effect on time travel.
# Plan checks and records before a later cleanup.

exemple.py

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

snapshots={
 "S100":{"F1"},
 "S101":{"F1","F2"},
 "S102":{"F3"},
}
protected={"S100","S101"}
candidate_expire={"S100"}
blocked=sorted(candidate_expire & protected)
print("compacted_current_files",sorted(snapshots["S102"]))
print("older_snapshot_files",sorted(snapshots["S100"]))
print("expire_blocked",blocked)
remaining=set(snapshots)-candidate_expire if not blocked else set(snapshots)
referenced=set().union(*(snapshots[s] for s in remaining))
print("retained_snapshots",sorted(remaining))
print("referenced_files",sorted(referenced))
print("can_read_S100","S100" in remaining)