feat(cold-turkey): pure goal engine (#161)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Wayfinder map #158, Build S1: the pure logic slice the writing lock consumes — no chrome, no clock of its own. WritingGoal (words | minutes, one goal per block, fixed at arm) + WritingGoalRun: update(text:) takes whole-document text and netNewWords falls out of the delta (deleting costs — net, not gross; a big paste counts). now is injected into every call, so the countdown cannot pause by construction; the minutes deadline is arm+minutes (inclusive), isMet is live truth, unlatched (delete below target un-mets — complete on the first true tick), and progress(now:) is the clamped 0…1 the readout hairline rides. Word counting goes through the new internal DraftStats.words(in:) — net-words and first-draft stats share one tokenizer and can never drift. Finish-audit fanout: the Int() conversion trap in secondsRemaining fixed at the seam (isFinite + Double(Int.max).nextDown cap — the naive cap is itself off-by-one at 2^63; flip-verified pin), two unpinnable > 0 guards in progress deleted, baselineWords narrowed to let. Equatable and the ?? armedAt fallback kept deliberately (S2 consumes the former; removing the latter costs formula duplication). S2 throttle note landed on #162. Suite 602/602 (xcresult count), swiftformat + swiftlint clean in app and test targets. Two traps filed to the swift wiki (bare @Suite stripped by swiftformat; the Double(Int.max) cap).
This commit is contained in:
1 parent
d6c4712aaa
commit
e3195d68fd
10 files changed
+389
-5
No files matched your search
@@ -77,6 +77,14 @@ nonisolated struct DraftStats: Equatable {
|
||||
)
|
||||
}
|
||||
|
||||
/// Word count over the same token semantics every text metric
|
||||
/// rides (#161: Cold Turkey net-words counts with this — one
|
||||
/// tokenizer, no drift). "writer's" is two words here, headings
|
||||
/// are body text, frontmatter is not (the editor never shows it).
|
||||
static func words(in text: String) -> Int {
|
||||
tokens(in: text).count
|
||||
}
|
||||
|
||||
/// Lowercased runs of Characters where isLetter || isNumber — the
|
||||
/// one tokenizer both the TTR and the sentence lengths ride.
|
||||
/// ponytail ceiling: no apostrophe joining — "writer's" is two tokens
|
||||
|
||||
Reference in new issue
Block a user