From a683708b105fcc1a457ace070cfebb492bf3b155 Mon Sep 17 00:00:00 2001 From: Joseph Turian Date: Mon, 23 Feb 2026 01:59:17 -0500 Subject: [PATCH] =?UTF-8?q?docs(regression):=20session=207c=20=E2=80=94=20?= =?UTF-8?q?empty=20comments,=20past=20due=20date,=20ID=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Discovered 4 more seams (BUG-52 through BUG-55): - BUG-52: comments add accepts empty comment text (same pattern as empty label BUG-14 and empty title BUG-12). - BUG-53: update --due with past date gives no warning — unlike --defer which warns, --due silently accepts past dates. - BUG-54: list --id requires exact match (protocol — by design). - BUG-55: comments special chars preserved (protocol — correct). Test results: 2 FAIL (confirm bugs), 2 PASS (protocol). Total: 55 items catalogued, 38 failing discovery tests, 39 passing protocol tests. Co-Authored-By: Claude Opus 4.6 Executed-By: beads/crew/emma Rig: beads Role: crew --- tests/regression/DISCOVERY.md | 57 +++++++++++++ tests/regression/discovery_test.go | 123 +++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) diff --git a/tests/regression/DISCOVERY.md b/tests/regression/DISCOVERY.md index 0062e0f3e..6d70fd8c6 100644 --- a/tests/regression/DISCOVERY.md +++ b/tests/regression/DISCOVERY.md @@ -75,6 +75,10 @@ actionable — some are by-design tradeoffs. The audit column tracks triage. | BUG-49 | **PROTOCOL** | PASS (correct) | — | | BUG-50 | **PROTOCOL** | PASS (correct) | — | | BUG-51 | **PROTOCOL** | PASS (correct) | — | +| BUG-52 | **BUG** | OPEN (not PR'd yet) | — | +| BUG-53 | **BUG** | OPEN (not PR'd yet) | — | +| BUG-54 | **PROTOCOL** | PASS (docs behavior) | — | +| BUG-55 | **PROTOCOL** | PASS (correct) | — | ### Shipped fix PRs (all include protocol tests) @@ -127,6 +131,10 @@ actionable — some are by-design tradeoffs. The audit column tracks triage. 41. **BUG-49**: list --all includes closed (PROTOCOL — correct) 42. **BUG-50**: create --type "" rejected (PROTOCOL — correct) 43. **BUG-51**: show --json always returns array (PROTOCOL — correct) +44. **BUG-52**: comments add accepts empty comment text +45. **BUG-53**: update --due past date no warning (unlike --defer) +46. **BUG-54**: list --id requires exact match, no partial resolution (PROTOCOL) +47. **BUG-55**: comments special chars preserved correctly (PROTOCOL) ### Investigate further @@ -936,6 +944,55 @@ is non-empty and ≤50 chars. Classified as PROTOCOL (correct behavior). --- +### BUG-52: `bd comments add` accepts empty comment text (NEW — session 7c) + +**Severity: LOW** — Data quality issue (same pattern as BUG-14) +**Discovered:** Session 7c discovery, test +**File:** `cmd/bd/comments.go:110-114` (no validation) +**Test:** `TestDiscovery_EmptyCommentAccepted` + +`bd comments add X ""` accepts and stores a comment with empty text. Same +category as BUG-14 (empty label) and BUG-12 (empty title). Empty comments +create noise in the comment list. + +--- + +### BUG-53: `bd update --due` past date accepted without warning (NEW — session 7c) + +**Severity: LOW-MEDIUM** — Inconsistency with --defer warning +**Discovered:** Session 7c discovery, test +**File:** `cmd/bd/update.go:169-180` (no past-date check) vs lines 192-197 (--defer warns) +**Test:** `TestDiscovery_DueDatePastNoWarning` + +`bd update X --due 2020-01-01` sets due_at to a past date without any warning. +The issue immediately appears in `bd list --overdue`. Unlike `--defer` which +warns about past dates, `--due` has no validation. Users who accidentally set +a past due date won't know until they check `--overdue`. + +--- + +### BUG-54: `bd list --id` requires exact match (NEW — session 7c) + +**Severity: N/A** — Documenting correct behavior +**Discovered:** Session 7c discovery, test +**Test:** `TestDiscovery_ListIDFilterExactMatchOnly` + +`bd list --id ` uses exact string matching, not partial ID resolution +like `bd show`. This is by design — `list` is a filter command, not a +resolution command. Classified as PROTOCOL. + +--- + +### BUG-55: Comments preserve special characters (NEW — session 7c) + +**Severity: N/A** — Protocol test +**Test:** `TestProtocol_CommentSpecialChars` + +Comments with quotes, brackets, and special characters are stored and +retrieved correctly via JSON output. + +--- + ### Code review findings (session 7, not CLI-testable) **`bd sync` is a deprecated no-op:** `cmd/bd/sync.go:9-37` — all flags diff --git a/tests/regression/discovery_test.go b/tests/regression/discovery_test.go index 726e6d7c1..baedc807a 100644 --- a/tests/regression/discovery_test.go +++ b/tests/regression/discovery_test.go @@ -2274,6 +2274,129 @@ func TestDiscovery_ShowJSONAlwaysArray(t *testing.T) { } } +// ============================================================================= +// SESSION 7c DISCOVERY: Comments, due dates, ID filtering +// ============================================================================= + +// TestDiscovery_EmptyCommentAccepted verifies that bd comments add rejects +// empty comment text. +// +// FINDING: comments.go:110-114 accepts comment text without validation. +// bd comments add X "" stores a comment with empty text. +// +// Classification: BUG — same pattern as BUG-14 (empty label) and BUG-12 +// (empty title). Empty comments should be rejected. +func TestDiscovery_EmptyCommentAccepted(t *testing.T) { + w := newCandidateWorkspace(t) + + a := w.create("--title", "Comment test", "--type", "task", "--priority", "2") + + // Adding an empty comment should fail + _, err := w.tryRun("comments", "add", a, "") + if err == nil { + data := parseJSON(t, w.run("show", a, "--json")) + comments, _ := data[0]["comments"].([]any) + if len(comments) > 0 { + t.Errorf("DISCOVERY: bd comments add accepted empty comment text — stored %d empty comment(s)", len(comments)) + } + } + // If err != nil, the tool correctly rejected empty comment — good +} + +// TestDiscovery_DueDatePastNoWarning verifies that setting a past due date +// gives some feedback to the user. +// +// FINDING: update.go:169-180 parses --due without checking if the date is +// in the past. Unlike --defer (which warns at lines 192-197), --due has NO +// past-date validation. The issue immediately appears in --overdue list. +// +// Classification: BUG — should at least warn (--defer does). +func TestDiscovery_DueDatePastNoWarning(t *testing.T) { + w := newCandidateWorkspace(t) + + a := w.create("--title", "Past due test", "--type", "task", "--priority", "2") + + // Set due date to far past — should at least warn + out := w.run("update", a, "--due", "2020-01-01") + + // Check if it's in overdue list + overdueOut, err := w.tryRun("list", "--overdue", "--json", "-n", "0") + if err != nil { + t.Skipf("--overdue not available: %v", err) + } + overdueIDs := parseIDs(t, overdueOut) + + if containsID(overdueIDs, a) { + // Past due date accepted and immediately overdue — was there a warning? + if !strings.Contains(strings.ToLower(out), "past") && + !strings.Contains(strings.ToLower(out), "warn") && + !strings.Contains(strings.ToLower(out), "already") { + t.Errorf("DISCOVERY: --due 2020-01-01 accepted without warning (unlike --defer which warns) — issue immediately appears in --overdue") + } + } +} + +// TestDiscovery_ListIDFilterExactMatchOnly verifies that bd list --id +// requires exact IDs, not partial matches. +// +// FINDING: list.go:445-450 splits --id by comma and uses them as exact +// matches (not resolved through ResolvePartialID). If you pass a partial +// ID, it silently returns empty. +// +// Classification: INVESTIGATE — may be by design (list is a filter command, +// not a resolution command), but the silent empty result is surprising. +func TestDiscovery_ListIDFilterExactMatchOnly(t *testing.T) { + w := newCandidateWorkspace(t) + + a := w.create("--title", "ID filter test", "--type", "task", "--priority", "2") + + // Full ID should work + fullOut, err := w.tryRun("list", "--id", a, "--json", "-n", "0") + if err != nil { + t.Skipf("--id flag not available: %v", err) + } + fullIDs := parseIDs(t, fullOut) + if !containsID(fullIDs, a) { + t.Fatalf("control: --id with full ID should return the issue") + } + + // Partial ID (first 8 chars) — does it resolve? + if len(a) > 8 { + partial := a[:8] + partialOut, err := w.tryRun("list", "--id", partial, "--json", "-n", "0") + if err == nil { + partialIDs := parseIDs(t, partialOut) + if len(partialIDs) == 0 { + t.Logf("CONFIRMED: bd list --id with partial ID '%s' returns empty — exact match only (bd show resolves partial IDs, bd list does not)", partial) + } + } + } +} + +// TestProtocol_CommentSpecialChars verifies that comments with special +// characters are stored and retrieved correctly. +func TestProtocol_CommentSpecialChars(t *testing.T) { + w := newCandidateWorkspace(t) + + a := w.create("--title", "Special comment", "--type", "task", "--priority", "2") + + // Add comment with quotes and special chars + specialText := `This has "quotes" and 'single' and ` + w.run("comments", "add", a, specialText) + + data := parseJSON(t, w.run("show", a, "--json")) + comments, _ := data[0]["comments"].([]any) + if len(comments) != 1 { + t.Fatalf("expected 1 comment, got %d", len(comments)) + } + + comment, _ := comments[0].(map[string]any) + text, _ := comment["text"].(string) + if text != specialText { + t.Errorf("comment text not preserved: got %q, want %q", text, specialText) + } +} + // TestProtocol_CommentAddAndPreserve verifies comments persist through operations. func TestProtocol_CommentAddAndPreserve(t *testing.T) { w := newCandidateWorkspace(t)