feat(stats): first-draft stats capture (S5.1) (#31)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Measure the writer, not the text. Running Pass 1 or Pass 2 on an unaided draft (origin: writer, First Draft Pass State, post type - lenient defaults, so bare legacy posts qualify) computes four style metrics natively in Swift at the invocation - before the engine sees anything - and stamps stats_captured plus four stats_* values into the piece's frontmatter in place, so the S5.2 trend view is a plain scan of Post.frontmatter. Capture re-fires while still First Draft (latest draft wins); a cancelled pass keeps its capture; ai-origin and advanced pieces never qualify. The capture exposed an erasure class: the existingStamp-to-stamped block rewrite rebuilt frontmatter from three parsed fields, silently dropping everything else. advancePassState and overwrite now update their owned keys in place (stampingFrontmatter, widened internal per its own third-caller trigger; bare posts still normalize through stamped), so captured stats and foreign YAML survive pass completion AND mid-pass editor saves. Both fixes are flip-verified by pins. DraftStats carries the four metrics (burstiness, type-token ratio, sentence-length variation, trigram repetition) as a pure Foundation model - full precision out, %.3f at store time. 16 new pins across DraftStatsTests, PostStoreTests, and PassRunTests; full unit bundle 396/396 (sequential gate; parallel runs flake under external CPU load per the #30 learning). Finish-audit fanout (ponytail/security/ review) ran on the diff: its MEDIUM (overwrite erasure) and the converged deletions landed here. Closes #31
This commit is contained in:
1 parent
ae234350ef
commit
42bcfce9ba
13 files changed
+611
-20
No files matched your search
@@ -839,6 +839,11 @@ extension PostsModel {
|
||||
lastError = error.localizedDescription
|
||||
return
|
||||
}
|
||||
// #31 (S5.1): unaided-first-draft stats — fires at the invocation,
|
||||
// before the engine sees anything; eligibility (writer origin, First
|
||||
// Draft, post type) is read from disk. A failed capture must never
|
||||
// fail the pass (decay-clock posture), so the Bool is ignored.
|
||||
PostStore.captureFirstDraftStats(id: id, body: session.text, home: home)
|
||||
// #28 (S2.3): every pass auto-creates its own session — rostered
|
||||
// 'Pass N · <title>' and activated, so the pass streams into ITS
|
||||
// transcript. The existing ready-guard above stays the refusal pin.
|
||||
|
||||
Reference in new issue
Block a user