Phase 7b: combined brief keeps FR-9 order for every caller (AUD-115)

CombinedText now applies OrderChildren itself, so the CLI preview, the
dashboard and the Hub render Finn's block then Harry's exactly like the
email. Previously `notify preview --combined` showed the DB order (Harry
first). Adds TestCombinedTextKeepsBriefOrder with a reversed input.
This commit is contained in:
2026-10-16 12:39:35 +11:00
parent 11155df1fe
commit 80b54524ea
2 changed files with 35 additions and 0 deletions

View File

@@ -151,6 +151,10 @@ func (s *Service) decoder(ctx context.Context) (func(string) string, error) {
// CombinedText returns the single brief for Jo and Sam — both boys in one
// message — and the children whose scan did not complete.
func (s *Service) CombinedText(ctx context.Context, children []store.Child) (string, []string, error) {
// Finn's block first, then Harry's (FR-9). Enforce the order here, not only in
// the send plan, so every caller — the email, the CLI preview, the dashboard
// and the Hub — renders the combined brief in the same order as the email.
children = OrderChildren(children)
parts := make([]dashboard.CombinedBrief, 0, len(children))
var failed []string
var notices []string