Skip to content

Commit 5f4e6a6

Browse files
authored
simplify Day 1 fast-forward setup (#192)
Assisted-by: Codex
1 parent 6e9982b commit 5f4e6a6

5 files changed

Lines changed: 59 additions & 36 deletions

File tree

mini-lsm-book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
- [The Rest of Your Life (TBD)](./week4-overview.md)
3838

3939
- [Agent Fast Forward in 3 Days](./agent-fast-forward-overview.md)
40-
- [Day 1: Week 1 — Mini-LSM](./week1-fast-forward.md)
40+
- [Day 1 - Mini-LSM](./week1-fast-forward.md)
4141

4242
---
4343

mini-lsm-book/src/agent-fast-forward-overview.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
# Agent Fast Forward in 3 Days (WIP)
66

7-
This is an alternative course track for students who intend to use a coding agent. Instead of spending seven chapters on each original course week, you will use one focused day to specify, generate, review, and challenge that week's system.
7+
This is an alternative course track for students who intend to use a coding agent. Instead of following seven chapters for each course phase, you will use one focused day to specify, generate, review, and challenge a complete system.
88

99
The agent may write most of the code. Your job is to define what correct means, constrain the work, inspect the result, and leave with a mental model you can use without the agent.
1010

1111
| Fast-forward day | Original course material | Outcome |
1212
| --- | --- | --- |
13-
| [Day 1](./week1-fast-forward.md) | Week 1: Mini-LSM | A working storage engine with memtables, SSTs, reads, writes, and flushes. |
14-
| Day 2 | Week 2: Compaction and persistence | Coming later. |
15-
| Day 3 | Week 3: MVCC | Coming later. |
13+
| [Day 1](./week1-fast-forward.md) | Mini-LSM | A working storage engine with memtables, SSTs, reads, writes, and flushes. |
14+
| Day 2 | Compaction and persistence | Coming later. |
15+
| Day 3 | MVCC | Coming later. |
1616

1717
The original chapters remain a reference library. This track changes the pacing and the student's role; it does not remove the need to understand ordering, representation, concurrency, and failure modes.
1818

@@ -34,20 +34,7 @@ The repository pins its Rust toolchain in `rust-toolchain.toml`, so Cargo will s
3434

3535
If you already have the repository and tools, update your checkout as appropriate and begin from the repository root.
3636

37-
### 2. Copy the Complete Week 1 Test Suite
38-
39-
The normal course reveals tests one chapter at a time. Day 1 of the fast-forward track starts with the complete Week 1 acceptance suite:
40-
41-
```shell
42-
for day in 1 2 3 4 5 6 7; do
43-
cargo x copy-test --week 1 --day "$day"
44-
done
45-
cargo x scheck
46-
```
47-
48-
The initial check should fail because the starter contains unfinished code. Record the first failure; it gives you a reproducible baseline. Do not ask the agent to make this failure disappear by changing the tests.
49-
50-
### 3. Start the Agent from `mini-lsm-starter`
37+
### 2. Start the Agent from `mini-lsm-starter`
5138

5239
Change into the starter directory before launching your coding agent:
5340

@@ -66,7 +53,7 @@ Starting in this directory is not a security sandbox: an agent can still travers
6653

6754
Do not open the whole repository as the agent's workspace if your tool lets you choose a directory. Open `mini-lsm-starter`. The agent may consult the copied tests, starter interfaces, Rust documentation, and course chapters under `../mini-lsm-book/src/`.
6855

69-
### 4. Verify the Instructions Before Coding
56+
### 3. Verify the Instructions Before Coding
7057

7158
Do not assume the tool discovered `AGENTS.md`. Make the first prompt a handshake that performs no implementation:
7259

@@ -106,6 +93,6 @@ Do not let “all tests pass” end the review. Conversely, do not ask the agent
10693

10794
Repeat Prompts 2 and 3 for each checkpoint. The checkpoint stops are where you catch a locally reasonable decision before it spreads across the system.
10895

109-
When the workspace is prepared and the instruction handshake succeeds, continue to [Day 1: Week 1 — Mini-LSM](./week1-fast-forward.md).
96+
When the workspace is prepared and the instruction handshake succeeds, continue to [Day 1 - Mini-LSM](./week1-fast-forward.md).
11097

11198
{{#include copyright.md}}

mini-lsm-book/src/week1-fast-forward.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
mini-lsm-book © 2022-2026 by Alex Chi Z is licensed under CC BY-NC-SA 4.0
33
-->
44

5-
# Day 1: Week 1 — Mini-LSM
5+
# Day 1 - Mini-LSM
66

7-
This is the first day of [Agent Fast Forward in 3 Days](./agent-fast-forward-overview.md). You will use a coding agent to build and defend one working storage engine from the original Week 1 material:
7+
This is the first day of [Agent Fast Forward in 3 Days](./agent-fast-forward-overview.md). You will use a coding agent to build and defend one working storage engine from the original Mini-LSM material:
88

99
```text
1010
put/delete -> mutable memtable -> immutable memtables -> L0 SSTs
1111
\____________ read + merge ____________/
1212
```
1313

14-
Use the existing Week 1 chapters as a reference library when you need a deeper explanation. You do not need to follow them one chapter at a time.
14+
Use the existing Mini-LSM chapters as a reference library when you need a deeper explanation. You do not need to follow them one chapter at a time.
1515

1616
## The Completion Contract
1717

@@ -20,16 +20,27 @@ At the end of this path:
2020
- `put`, `delete`, `get`, and bounded `scan` work across memory and disk;
2121
- a frozen memtable can be flushed into an L0 SST;
2222
- Bloom filters and prefix encoding improve the implementation without changing its results;
23-
- the complete Week 1 test suite passes; and
23+
- the complete supplied test suite passes; and
2424
- you can trace a key through the engine, explain why the newest value wins, and design a test for a plausible bug.
2525

2626
The tests are evidence, not the specification. Generated code remains untrusted until you can connect it to an invariant and try to falsify it.
2727

28+
## Copy the Complete Test Suite
29+
30+
Complete the repository and agent preparation in the [track overview](./agent-fast-forward-overview.md#prepare-the-repository-and-the-agent). Leave the agent at the instruction-handshake stop, then run these commands from the repository root. The original course reveals tests one chapter at a time; Day 1 starts with the complete acceptance suite:
31+
32+
```shell
33+
cargo x copy-test --week 1
34+
cargo x scheck
35+
```
36+
37+
The initial check should fail because the starter contains unfinished code. Record the first failure; it gives you a reproducible baseline. Do not ask the agent to make this failure disappear by changing the tests.
38+
2839
## Start Day 1
2940

30-
Complete the repository and agent preparation in the [track overview](./agent-fast-forward-overview.md#prepare-the-repository-and-the-agent). With the agent running from `mini-lsm-starter` and the instruction handshake complete, send this kickoff prompt:
41+
With the agent running from `mini-lsm-starter`, the instruction handshake complete, and the test suite copied, send this kickoff prompt:
3142

32-
> We are completing Week 1 of Mini-LSM in this starter directory. Use the starter interfaces, copied Week 1 tests, and Week 1 book chapters, but never access `../mini-lsm`. Do not edit yet.
43+
> We are completing Mini-LSM in this starter directory. Use the starter interfaces, copied acceptance tests, and Mini-LSM book chapters, but never access `../mini-lsm`. Do not edit yet.
3344
>
3445
> Return:
3546
>
@@ -140,7 +151,7 @@ Finally, introduce one small, deliberate fault—for example, reverse equal-key
140151

141152
## Day 1 Completion Checkpoint
142153

143-
You are ready for Week 2 when you can do these without delegating the answer back to the agent:
154+
You are ready for Day 2 when you can do these without delegating the answer back to the agent:
144155

145156
- draw the write, read, and flush paths from memory;
146157
- explain the ordering rule that selects one value from duplicate keys;
@@ -150,6 +161,6 @@ You are ready for Week 2 when you can do these without delegating the answer bac
150161
- describe an unsafe flush interleaving and how the implementation prevents it; and
151162
- turn a suspected invariant violation into a minimal test.
152163

153-
If you cannot yet do one of these, use the corresponding Week 1 chapter and ask the agent to quiz you with concrete states or byte layouts. The measure of success is not whether you typed the implementation. It is whether you can specify, inspect, test, and change the system with confidence.
164+
If you cannot yet do one of these, use the corresponding Mini-LSM chapter and ask the agent to quiz you with concrete states or byte layouts. The measure of success is not whether you typed the implementation. It is whether you can specify, inspect, test, and change the system with confidence.
154165

155166
{{#include copyright.md}}

mini-lsm-starter/AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The student owns the specification and the proof of correctness. Treat your code
1717
- Keep changes inside `mini-lsm-starter` unless the student explicitly asks for a change elsewhere.
1818
- Do not commit, push, rewrite Git history, or discard existing work unless the student explicitly asks.
1919

20-
You may consult the Week 1 chapters in `../mini-lsm-book/src/`, Rust and dependency documentation, and the starter code's existing interfaces. External documentation is for understanding APIs and concepts, not for locating another Mini-LSM solution.
20+
You may consult the Mini-LSM chapters in `../mini-lsm-book/src/`, Rust and dependency documentation, and the starter code's existing interfaces. External documentation is for understanding APIs and concepts, not for locating another Mini-LSM solution.
2121

2222
## Working Agreement
2323

@@ -46,7 +46,7 @@ A request that names one checkpoint authorizes work only on that checkpoint. Bef
4646

4747
## Validation
4848

49-
Run focused tests while working. Before declaring Week 1 complete, run from the repository root:
49+
Run focused tests while working. Before declaring Day 1 complete, run from the repository root:
5050

5151
```shell
5252
cargo x scheck

xtask/src/main.rs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ use duct::cmd;
2323
struct CopyTestAction {
2424
#[arg(long)]
2525
week: usize,
26+
/// Copy one day; omit to copy all seven days.
2627
#[arg(long)]
27-
day: usize,
28+
day: Option<usize>,
2829
}
2930

3031
#[derive(clap::Subcommand, Debug)]
@@ -74,6 +75,13 @@ fn switch_to_starter_root() -> Result<()> {
7475
Ok(())
7576
}
7677

78+
fn days_to_copy(day: Option<usize>) -> Vec<usize> {
79+
match day {
80+
Some(day) => vec![day],
81+
None => (1..=7).collect(),
82+
}
83+
}
84+
7785
fn fmt() -> Result<()> {
7886
println!("{}", style("cargo fmt").bold());
7987
cmd!("cargo", "fmt").run()?;
@@ -154,10 +162,12 @@ fn copy_test_case(test: CopyTestAction) -> Result<()> {
154162
if !Path::new(target_dir).exists() {
155163
std::fs::create_dir(target_dir)?;
156164
}
157-
let test_filename = format!("week{}_day{}.rs", test.week, test.day);
158-
let src = format!("{}/{}", src_dir, test_filename);
159-
let target = format!("{}/{}", target_dir, test_filename);
160-
cmd!("cp", src, target).run()?;
165+
for day in days_to_copy(test.day) {
166+
let test_filename = format!("week{}_day{}.rs", test.week, day);
167+
let src = format!("{}/{}", src_dir, test_filename);
168+
let target = format!("{}/{}", target_dir, test_filename);
169+
cmd!("cp", src, target).run()?;
170+
}
161171
let test_filename = "harness.rs";
162172
let src = format!("{}/{}", src_dir, test_filename);
163173
let target = format!("{}/{}", target_dir, test_filename);
@@ -243,3 +253,18 @@ fn main() -> Result<()> {
243253

244254
Ok(())
245255
}
256+
257+
#[cfg(test)]
258+
mod tests {
259+
use super::days_to_copy;
260+
261+
#[test]
262+
fn copy_all_days_when_day_is_omitted() {
263+
assert_eq!(days_to_copy(None), (1..=7).collect::<Vec<_>>());
264+
}
265+
266+
#[test]
267+
fn copy_only_the_selected_day() {
268+
assert_eq!(days_to_copy(Some(3)), vec![3]);
269+
}
270+
}

0 commit comments

Comments
 (0)