Skip to content

SMOODEV-2720: th jira sync safe-by-default — reconcile only; --pull/--push opt-in; --dry-run#250

Merged
brentrager merged 3 commits into
mainfrom
SMOODEV-2720-jira-sync-safe
Jul 25, 2026
Merged

SMOODEV-2720: th jira sync safe-by-default — reconcile only; --pull/--push opt-in; --dry-run#250
brentrager merged 3 commits into
mainfrom
SMOODEV-2720-jira-sync-safe

Conversation

@brentrager

@brentrager brentrager commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

th jira sync was dangerous to run and broken at scale:

  • It unconditionally created a local pearl for every untracked open Jira ticket (~1,000 on SMOODEV) and a Jira ticket for every open pearl without a SMOODEV- title prefix (hundreds) — running it once would have exploded both trackers.
  • It reconciled against PearlQuery::new(), whose default is 100 rows with no status filter — a random slice that includes closed pearls, so the pull phase's already-tracked check missed nearly everything.
  • Key matching was title.starts_with("SMOODEV-") / title.contains(key), which treats placeholders like SMOODEV-XXX as keys and misses keys mid-title.

Solution

  • Default run is reconcile-only: close active pearls whose every referenced issue key is Done in Jira; transition Jira tickets to Done once every referencing pearl is closed.
  • --pull / --push gate the old creation behaviors (Jira→pearls, pearls→Jira). The summary always reports how many candidates each flag would act on.
  • --dry-run prints the full plan and changes nothing.
  • Pearls load with with_limit(0); a pure planner (smooth_diver::jira::plan_sync + extract_keys) computes the plan from all pearls + all Jira issues, with proper key extraction (digits required, word boundary, multiple keys per title, dedup).
  • JiraClient::list_project_issues() paginates the full project with statuses.

Verification

  • 5 new unit tests on the planner + key extraction + ADF flattening (cargo test -p smooai-smooth-diver jira: 8 passed).
  • clippy clean on all new code (pre-existing warnings untouched); fmt clean.
  • Dogfooded live on smooai pearls (3,031) + SMOODEV (2,619 issues): --dry-run previewed correctly, real run closed 6 pearls whose Jira went Done, 0 spurious creations; 154 would-pull / 242 would-push correctly held back behind flags.

Jira: SMOODEV-2720 · Pearl: th-7db3c2

🤖 Generated with Claude Code

https://claude.ai/code/session_0166oMz2kqo7J8e7TFxdYytY

…-push opt-in; --dry-run

The old sync unconditionally created a pearl for every untracked open Jira
ticket AND a Jira ticket for every open pearl without a SMOODEV- prefix, and
it reconciled against PearlQuery::new()'s default (100 rows, no status
filter) — a random slice including closed pearls. Running it on a real
project would have exploded both trackers.

Now the default run only reconciles: closes active pearls whose every
referenced issue key is Done in Jira, and transitions Jira tickets to Done
once every referencing pearl is closed. Mass-creation is opt-in via --pull /
--push, --dry-run previews the plan, pearls load with with_limit(0), and key
extraction requires digits + a word boundary so SMOODEV-XXX placeholders
never match. Planner is a pure function in smooth-diver::jira with unit
tests. Dogfooded against the live smooai pearls + SMOODEV project.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0166oMz2kqo7J8e7TFxdYytY
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 034b18c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager
brentrager enabled auto-merge (squash) July 23, 2026 23:15
@brentrager
brentrager merged commit b6e2a89 into main Jul 25, 2026
3 checks passed
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.

1 participant