Skip to content

Commit 922a4d5

Browse files
author
Codex
committed
Polish edit category label and preserve free-text statuses
1 parent e7906ed commit 922a4d5

3 files changed

Lines changed: 74 additions & 9 deletions

File tree

internal/integrations/slack/slack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ func openEditModal(api *slack.Client, db *sql.DB, cfg Config, triggerID, channel
13421342
}
13431343
noChangeOpt := slack.NewOptionBlockObject(
13441344
noCategoryChangeValue,
1345-
slack.NewTextBlockObject(slack.PlainTextType, "(no change)", false, false),
1345+
slack.NewTextBlockObject(slack.PlainTextType, "Auto", false, false),
13461346
nil,
13471347
)
13481348
catOptions := []*slack.OptionBlockObject{noChangeOpt}

internal/report/report_builder.go

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ func mergeIncomingItems(
403403
}
404404

405405
func chooseNormalizedStatus(incomingStatus, llmStatus string, useLLM bool) string {
406+
if isFreeTextStatus(incomingStatus) {
407+
return strings.TrimSpace(incomingStatus)
408+
}
406409
if useLLM {
407410
switch normalizeStatus(llmStatus) {
408411
case "done", "in testing", "in progress":
@@ -627,10 +630,7 @@ func categoryAuthors(cat TemplateCategory) []string {
627630
}
628631

629632
func formatTeamItem(item TemplateItem) string {
630-
status := normalizeStatus(item.Status)
631-
if status == "" {
632-
status = "done"
633-
}
633+
status := statusForDisplay(item.Status)
634634
author := synthesizeName(item.Author)
635635
tickets := canonicalTicketIDs(item.TicketIDs)
636636
description := stripLeadingTicketPrefixIfSame(item.Description, tickets)
@@ -646,10 +646,7 @@ func formatTeamItem(item TemplateItem) string {
646646
}
647647

648648
func formatBossItem(item TemplateItem) string {
649-
status := normalizeStatus(item.Status)
650-
if status == "" {
651-
status = "done"
652-
}
649+
status := statusForDisplay(item.Status)
653650
tickets := canonicalTicketIDs(item.TicketIDs)
654651
description := stripLeadingTicketPrefixIfSame(item.Description, tickets)
655652
description = synthesizeDescription(description)
@@ -734,6 +731,26 @@ func normalizeStatus(status string) string {
734731
}
735732
}
736733

734+
func statusForDisplay(status string) string {
735+
trimmed := strings.TrimSpace(status)
736+
if trimmed == "" {
737+
return "done"
738+
}
739+
if isFreeTextStatus(trimmed) {
740+
return trimmed
741+
}
742+
return normalizeStatus(trimmed)
743+
}
744+
745+
func isFreeTextStatus(status string) bool {
746+
switch strings.ToLower(strings.TrimSpace(status)) {
747+
case "done", "in testing", "in test", "in progress":
748+
return false
749+
default:
750+
return strings.TrimSpace(status) != ""
751+
}
752+
}
753+
737754
func statusBucket(status string) int {
738755
switch normalizeStatus(status) {
739756
case "done":

internal/report/report_builder_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,54 @@ func TestBuildReportsFromLast_LLMConfidenceAndDuplicate(t *testing.T) {
231231
}
232232
}
233233

234+
func TestBuildReportsFromLast_PreservesFreeTextStatus(t *testing.T) {
235+
dir := t.TempDir()
236+
prev := `### TEAMX 20260202
237+
238+
#### Top Focus
239+
240+
- **Feature A**
241+
- **Pat One** - Existing ongoing item (in progress)
242+
`
243+
if err := os.WriteFile(filepath.Join(dir, "TEAMX_20260202.md"), []byte(prev), 0644); err != nil {
244+
t.Fatalf("write previous report: %v", err)
245+
}
246+
247+
cfg := Config{
248+
ReportOutputDir: dir,
249+
TeamName: "TEAMX",
250+
}
251+
252+
orig := classifySectionsFn
253+
classifySectionsFn = func(_ Config, items []WorkItem, _ []sectionOption, _ []existingItemContext, _ []ClassificationCorrection, _ []historicalItem) (map[int64]LLMSectionDecision, LLMUsage, error) {
254+
out := make(map[int64]LLMSectionDecision, len(items))
255+
for _, item := range items {
256+
out[item.ID] = LLMSectionDecision{
257+
SectionID: "S0_0",
258+
NormalizedStatus: "in progress",
259+
Confidence: 0.95,
260+
}
261+
}
262+
return out, LLMUsage{}, nil
263+
}
264+
defer func() { classifySectionsFn = orig }()
265+
266+
freeTextStatus := "resolved in session; root cause analysis in progress"
267+
items := []WorkItem{
268+
{ID: 41, Author: "Pat Two", Description: "Investigate customer database startup issue", Status: freeTextStatus},
269+
}
270+
271+
result, err := BuildReportsFromLast(cfg, items, mustDate(t, "20260209"), nil, nil)
272+
if err != nil {
273+
t.Fatalf("BuildReportsFromLast failed: %v", err)
274+
}
275+
276+
team := renderTeamMarkdown(result.Template)
277+
if !strings.Contains(team, "Investigate customer database startup issue ("+freeTextStatus+")") {
278+
t.Fatalf("free-text status should be preserved in team report:\n%s", team)
279+
}
280+
}
281+
234282
func TestBuildReportsFromLast_PreservesPrefixBlocks(t *testing.T) {
235283
dir := t.TempDir()
236284
prev := `### Product Alpha - 20260130

0 commit comments

Comments
 (0)