The JSONL branch of bootstrap-maturity.sh had two bugs:
1. Detection wrong: `jq -e '.maturity' <file>` only inspects the first
object in a JSONL stream, so files where a later line is missing the
field silently skipped.
2. Output wrong: default `jq` pretty-prints its output, producing
multi-line objects that break JSONL consumers. The unconditional
`. + {"maturity": "provisional"}` also overwrote existing maturity
values (e.g. "stable" → "provisional").
Fix:
- Count missing lines with `jq -c 'select(has("maturity") | not)'`
(per-line stream semantics).
- Transform with `jq -c 'if has("maturity") then . else . +
{"maturity": "provisional"} end'` so existing values are preserved
and output stays valid compact JSONL.
- Add bats coverage for preservation, compact output, and idempotency.
Wave 1 of flywheel signal repair epic (na-pkg):
- na-pkg.1: Fix confidence decay to process .md learnings (was skipping all non-.jsonl)
Add applyConfidenceDecayMarkdown() that reads/writes YAML frontmatter
- na-pkg.2: Reorder close-loop so citation feedback runs before maturity transitions
Ensures cited learnings get reward_count bump before promotion evaluation
- na-pkg.3: Fix GlobLearningFiles to return errors instead of silently swallowing them
- na-pkg.5: Add bootstrap-maturity.sh migration script for existing learnings
All 19 packages pass. 9 new test functions covering decay, ordering, and glob.