Skip to content

task-monitor on jira: title repeats the key (ML-450 ML-450: …) and a PR without ## Summary shows its JIRA: <url> line as the description: drop a leading label from PR titles, find prose after Closes KEY, skip link-only paragraphs (#299) - #316

Merged
martin-conur merged 2 commits into
mainfrom
task/jira-title-dedupe
Oct 23, 2026

Conversation

@martin-conur

Copy link
Copy Markdown
Owner

Summary

On jira repos the task-monitor showed the issue key twice (ML-450 ML-450: …), and when a PR had no ## Summary it used the JIRA: <url> line as the description. Now a leading key is dropped from PR titles, and the summary fallback finds the prose after Closes ML-450 and skips paragraphs that are only links or Closes lines.

Closes #299

Changes

  • lib/monitor-assemble.jq: new strip_label, applied to in-flight PR titles and done items. It drops KEY:, [KEY], key - and KEY —, ignoring case. Only a whole label counts (ML-4500 is left alone), and a title that is only the label is kept. pr.title stays raw. gh labels are #N, so gh titles are unchanged, and describer/queue titles are not touched.
  • lib/monitor-text.sh: the Closes fallback also matches a tracker key (generic [a-z][a-z0-9_]*-[0-9]+, lowercased) and a /browse/KEY URL. Both fallbacks use the new tm_first_prose, which skips paragraphs that are only a URL, a markdown link, Label: <url>, or a single Closes …. With nothing left, the description is null.
  • The shared snapshot fixture's PR body was only Closes #5, which now gives a null summary, so the scenario and snapshot-reviewer.json gained a prose line (only types are compared, and pr.summary stays a string).
  • Docs: docs/task-monitor-schema.md, README monitor paragraph, CHANGELOG.

Tests

New cases in tests/task_monitor_snapshot.bats: four title forms dedupe against PROJ-7 and PROJ-70 is kept; in-flight jira dedupe with pr.title raw; gh Fix #4: … untouched; JIRA: <url> then prose gives the prose; a link-only body gives null; tm_pr_summary on Closes KEY, Fixes <browse URL>, a link-only body, and ## Summary still winning.

Mutation-checked, and each one turned at least one new test red: no dedupe, a case-sensitive match, no separator boundary, the old #N-only Closes regex, no link filter. Full suite: 1640/1640, plus check-drift.sh and shellcheck -x. The awk was also checked under mawk 1.3.4 (Ubuntu 24.04).

🤖 Generated with Claude Code

…PR without ## Summary shows its JIRA: <url> line as the description: drop a leading label from PR titles, find prose after Closes KEY, skip link-only paragraphs (#299)

- `lib/monitor-assemble.jq`: `strip_label` drops a leading `KEY:`, `[KEY]`,
  `key -` or `KEY —` from in-flight and done PR titles, matched ignoring case
  and only as a whole label; `pr.title` keeps the raw title.
- `lib/monitor-text.sh`: the after-Closes fallback recognises a tracker key
  and a Jira browse URL; both fallbacks skip paragraphs that are only a link,
  `Label: <url>` or a `Closes …` line (`tm_first_prose`), so a link-only body
  yields no description. `## Summary` is read as before.
- Tests, schema doc, README and CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-conur

Copy link
Copy Markdown
Owner Author

Spec compliance

All four fix items and the acceptance list are delivered:

  • Title dedupe is done once, in lib/monitor-assemble.jq (strip_label), for in-flight and done rows. It covers KEY:, [KEY], key - and KEY —, ignores case, requires a whole label (ML-4500 is kept), and leaves a label-only title alone. pr.title stays raw.
  • The Closes fallback now matches Closes ML-450, Fixes PROJ-1 and a /browse/KEY URL.
  • Both fallbacks skip link-only, Label: <url> and Closes …-only paragraphs, and give null when nothing is left. ## Summary still wins.
  • Tests, mutation-check notes, CHANGELOG, README and schema docs are all in. CI ran on the head SHA (1 run). I ran ./run_tests.sh task_monitor_snapshot locally: 70 tests, 0 failures. tools/check-drift.sh and shellcheck -x lib/monitor-text.sh are clean. The PR body opens with ## Summary.

Code-review findings

No blockers. One nit worth fixing in this PR:

  • Over-eager junk() in lib/monitor-text.sh. The Closes … test is ^(close…|fix…|resolve…):?[ \t]+[^ \t]+$, so any one-word-object sentence is dropped as junk. I confirmed Fixes bug as a whole paragraph now yields an empty description, where before it was the description. Tightening it to require a key, #N or URL-shaped token (the same patterns the found matcher uses) avoids discarding genuine short prose. Please add a test line for it.

Checked and fine: Closes the gap in retry handling and Fixes: the crash on start are still kept; ascii_downcase preserves length, so the slice indexes in strip_label are correct; null titles pass through; the fixture change (Closes #5 → prose) follows from the new rule.

Verdict

clean-with-nits: tighten junk()'s Closes pattern (and add a test); nothing else blocks.

@martin-conur

Copy link
Copy Markdown
Owner Author

PM: one round before merge

CI is green. Two small items, both in this PR:

  1. Reviewer's nit: junk() is over-eager. ^(close…|fix…|resolve…):?[ \t]+[^ \t]+$ drops any one-word object, so a whole-paragraph Fixes bug becomes no description. Require the object to be a #N, a jira key or a URL (the same shapes the found matcher uses), and add a test that Fixes bug is kept while Closes ML-450 / Closes #5 / Closes https://…/browse/ML-450 are still skipped.
  2. PM mutation gap: a title that is only the key. I changed if $r == "" then . else $r end to plain $r in strip_label (so ML-450 / ML-450: / [ML-450] become an empty title) and every test stayed green. Add those three cases to the done-jira title test, asserting each title is kept as it was.

Mutation-check both (revert each fix and watch the new assertion go red), then re-review-requested.

…PR without ## Summary shows its JIRA: <url> line as the description: keep a short Closes sentence, test key-only titles (#299)

- `lib/monitor-text.sh`: `junk()` drops a `Closes`/`Fixes`/`Resolves`
  paragraph only when its object is a `#N`, a tracker key or a URL, so
  `Fixes bug` stays a description.
- Tests: `Fixes bug` kept, `Closes ML-450` / `Closes #5` / a browse URL
  skipped; titles that are only the key (`PROJ-7`, `PROJ-7:`, `[PROJ-7]`)
  are kept as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-conur
martin-conur merged commit 289ca54 into main Oct 23, 2026
8 checks passed
@martin-conur
martin-conur deleted the task/jira-title-dedupe branch October 23, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task-monitor on jira: title repeats the key (ML-450 ML-450: …) and a PR without ## Summary shows its JIRA: <url> line as the description

1 participant