Commit 39d030e
authored
fix(decisions): rank a person above a document, and retire two sources that never landed (#1290)
* fix(decisions): a mined document was overwriting the user's own words
SOURCE_RANK put adr (8) above session (7), and the headline-promotion branch
in crud.decisions compares with >=, so 7 >= 8 was false and a transcript could
never take the headline from an ADR. The audit attributes 9 of the 14
genuinely valuable records in the store to this.
Swap the two. Only those two values trade places, so the ladder's value set is
unchanged, MAX_SOURCE_RANK stays 9, and no other source's confidence moves;
had session been lifted to a new top rank instead, compute_confidence's divisor
would have shifted and every stored confidence in every existing store would
have been on a different scale from every new one. adr and pr now tie at 7:
both are write-ups rather than the decision being made.
decision_evidence.source_rank is stamped at insert time and read straight from
the column by two ORDER BY clauses, so it cannot be derived on read: the ladder
is copied into every row. Without a backfill a store holds rows on both ladders
and bulk_upsert_decisions derives headline confidence from max(source_rank)
across the mixture, which looks like a working store and is not one.
reconcile_source_ranks re-stamps them and re-derives confidence for only the
decisions that moved, reusing the upsert path's own expression.
It runs on the persist path rather than only in Alembic because local stores
are created by init_db and never see a migration, next to the existing one-shot
drain from #751. Idempotent, and a no-op scan once reconciled. Migration 0045
does the same for hosted Postgres.
* feat(decisions): retire two sources that never produced a usable record
readme_mining and changelog mined prose that describes a repo rather than
evidence of a choice made in it. Between them they produced 153 records in this
project's own store and zero that ever became active, while accounting for most
of a 214-deep review queue that nobody drains because almost nothing in it is
worth confirming.
Both miners are deleted outright (217 lines), along with their helpers, the
constants only they used, and CHANGELOG_MINING_PROMPT. README_MINING_PROMPT
stays: discover_adrs borrows it for the fallback it runs on an ADR file with no
recognizable structure, which is the prompt, not the source.
Their names stay in SOURCE_RANK so rows written before this still rank instead
of dropping to the unknown-source floor, and RETIRED_SOURCES is now the one list
of what is gone. The persist path already drained code_comment (#751) from a
hardcoded string; it loops over the tuple instead, so a fourth removal is wired
by adding one name. The extractor docs, the rank annotations and three tests all
read the same tuple.
Two things found while removing the hardcoding:
decision list --source had drifted into offering readme_mining while omitting
session, so you could not list the records the source ladder cares most about.
The choices are derived from the ladder now, minus retired names and minus the
placeholder rungs no store carries.
reconcile_source_ranks returned with re-derived confidence still pending in the
session, so whether the repair survived depended on what the caller did next. It
flushes.
Also drops migration 0045 rather than fixing it. Hosted runs the same persist
pipeline as a local store, so it was redundant, and worse: it corrected the
ranks without re-deriving confidence, which made the runtime repair's own no-op
check pass on the next run and would have left hosted confidences on the old
ladder permanently. One repair path cannot disagree with itself.
The confidence expression was briefly copy-pasted between the upsert path and
the reconcile path. Both call _rederive_headline now, with a test that pins them
to the same number.1 parent 886bc3c commit 39d030e
17 files changed
Lines changed: 497 additions & 340 deletions
File tree
- docs
- layers
- reference
- packages
- cli/src/repowise/cli/commands
- core/src/repowise/core
- analysis/decisions
- persistence
- crud
- pipeline
- phases
- tests/unit
- analysis
- persistence
- sessions
- website
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | | - | |
78 | 75 | | |
79 | | - | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
112 | 108 | | |
113 | 109 | | |
114 | 110 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
322 | 321 | | |
323 | 322 | | |
324 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
160 | | - | |
| 167 | + | |
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
| |||
0 commit comments