// // PersonaLoadOrderTests.swift // MuseionTests // // #1 (PRD cross-cutting rule — prompt-end constraints): the persona pair // pins the load-order doctrine — the writer's material lands in context // BEFORE the rule skills, so the constraint tables (deslop) sit at/near // the end of the working context, closest to the writing they govern. // The section is shared verbatim between the personas (ref/writing // skills/AGENTS.md: shared sections edit together or not at all). // import Foundation @testable import Museion import Testing @Suite("PersonaLoadOrderTests") struct PersonaLoadOrderTests { /// The doctrine section heading both personas carry, verbatim. private static let sectionHeading = "## Draft first, rules last" private static func personaBody(_ name: String) throws -> String { let dir = ((ProfileProvisioner.defaultPayloadRoot() as NSString) .appendingPathComponent(name) as NSString) return try String(contentsOfFile: dir.appendingPathComponent("SKILL.md"), encoding: .utf8) } /// The section text between its heading and the next `## ` heading, /// trimmed — "" when absent. private static func section(after heading: String, in body: String) -> String { guard let range = body.range(of: heading) else { return "" } let tail = body[range.upperBound...] let end = tail.range(of: "\n## ")?.lowerBound ?? tail.endIndex return String(tail[..