// Which list a route is picked from, walked over every route there is.//// The compiler holds TOTALITY — `Route.listRoot` is a switch with no// `default` — and what it cannot hold is whether an arm is the RIGHT one. The// Mac walk of 2026-09-15 found what a wrong one costs: a link to// `/notes/note/<id>` opened the Todos the launch selects with no page beside// it, so the record was not shown and neither was the list it belongs to// (walk-07, walk-11). So this walks `RouteTests.everyRoute` — one value per// case, the size of the route registry — and states the three facts the fix// rests on: every page names a LIST, never itself and never a page; every list// is its own root; and the two tiers that are never in a path name nothing.import XCTest@testable importCottonKitfinalclassRouteColumnsTests: XCTestCase {/// Every case, one value each. Anti-vacuity for everything below.privatestaticvar everyRoute: [Route] { RouteTests.everyRoute }func testTheTableCoversTheWholeRouteRegistry() { XCTAssertEqual(RouteColumnsTests.everyRoute.count, Route.allPatterns.count) }/// The defect, in the two links the walk followed: a record link opens the/// list column AND the page column, and lands on NEITHER the launch's/// default nor on the record alone.func testARecordLinkOpensTheListItBelongsToAndThenTheRecord() {let note = Route.notesNote(id: "note-1") XCTAssertEqual(note.columnPath, [.notes, note])let person = Route.peoplePerson(id: "person-1") XCTAssertEqual(person.columnPath, [.people, person])// Not the default the Mac's launch selects — the fault the walk saw.for record in [note, person] { XCTAssertFalse( record.columnPath.contains(.todos(new: false)),"\(record.path) fell back to Todos instead of naming its own list" ) } }/// Every record route, not just the two that were photographed: a pair,/// whose first half is a LIST and whose second half is the record itself.func testEveryPageRouteResolvesToAListAndPagePair() {let pages = RouteColumnsTests.everyRoute.filter { $0.tier == .page } XCTAssertFalse(pages.isEmpty)for page in pages {guardlet list = page.listRoot else {return XCTFail("\(page.path) names no list to be picked from") } XCTAssertEqual( list.tier, .list,"\(page.path) is picked from \(list.path), which is not a list" ) XCTAssertNotEqual( list, page,"\(page.path) is picked from itself, so column 2 would draw the record" ) XCTAssertEqual( page.columnPath, [list, page],"\(page.path) did not open as a list-and-page pair" ) } }/// A list is its own column-2 root, and it is ONE route — which is what/// makes a link REPLACE the list the launch selected rather than push over/// it (the back chevron at the root of every list, walk-01 … 06).func testEveryListRouteIsItsOwnRootAndOpensAlone() {let lists = RouteColumnsTests.everyRoute.filter { $0.tier == .list } XCTAssertFalse(lists.isEmpty)for list in lists { XCTAssertEqual(list.listRoot, list, "\(list.path) is not its own root") XCTAssertEqual(list.columnPath, [list], "\(list.path) opened over something") } }/// The launcher IS the sidebar and an action is an instruction, so neither/// names a list and neither puts anything in the path.func testTheLauncherAndTheActionNameNoList() {let outside = RouteColumnsTests.everyRoute.filter { $0.tier == .launcher || $0.tier == .action } XCTAssertEqual(Set(outside), Set([.root, .home, .capture, .take, .keyboardTake]))for route in outside { XCTAssertNil(route.listRoot, "\(route.path) named a list it is never picked from") XCTAssertEqual(route.columnPath, [], "\(route.path) put itself in the path") } }/// A capture is picked from the thoughts list, not from Asked of you: the/// queue holds only what someone asked the owner (2026-09-28), so a/// thought opens beside `/thoughts`, which is its own root.func testACaptureIsPickedFromTheThoughtsList() { XCTAssertEqual(Route.thoughts.listRoot, .thoughts) XCTAssertEqual(Route.thoughts.columnPath, [.thoughts])let thought = Route.thoughtsThought(id: "t-1") XCTAssertEqual(thought.columnPath, [.thoughts, thought]) XCTAssertEqual(thought.listRoot, .thoughts) }/// An event carries its day through into the list: it opens the calendar/// on the day the event is on. A project's brand sheet has no project page/// to carry into (the project's page is the database page), so the list/// beside it is the projects index.func testAPageThatBelongsToOneDayOrOneProjectCarriesItIntoTheList() { XCTAssertEqual(Route.calendarEvent(id: "event-1", date: "2026-09-15", at: nil).listRoot, .calendar(date: "2026-09-15") ) XCTAssertEqual(Route.projectsBrand(slug: "the-walk").listRoot, .projects ) }/// RULE: a record of a table that has a NAMED list (`/placements`,/// `/notes`, `/alarms`) is picked from that named list, never the/// generic `/lists/[table]` — so on the Mac a placement list pushed from/// `/placements`, or arriving as a link, opens its page beside the list a/// person actually opened, and the list beside it reads the table's own/// source. Every named list is a list and its own root; a table with no/// named list keeps the generic one.func testANamedListIsTheParentOfItsTablesRecords() { XCTAssertFalse(Route.namedTableLists.isEmpty)for (table, list) inRoute.namedTableLists { XCTAssertEqual(list.tier, .list, "\(table)'s named list \(list.path) is not a list") XCTAssertEqual(list.listRoot, list, "\(list.path) is not its own root")let record = Route.tableRecord(table: table, id: "record-1") XCTAssertEqual(record.listRoot, list, "a \(table) record is not picked from \(list.path)") XCTAssertEqual(record.columnPath, [list, record]) } XCTAssertEqual(Route.tableRecord(table: "disk_claim", id: "c-1").listRoot, .tableList(table: "disk_claim", filter: nil, title: nil, query: nil),"a table with no named list is picked from its generic list") }}