fix(examples): fail closed on factory PR metadata
Problem
The production recommended Software Garden flow opened AgentWorkforce/cloud#3919 with the placeholder title Software factory change and no closing issue reference. The exact source ticket is AgentWorkforce/cloud#3913: its title and defect match the change, it carried the garden-ready trigger label, and it preceded the factory branch and commit.
The generator fix in AgentWorkforce/agentrelay.com#109 does not protect the canonical Flows artifact used by the live recommended catalog.
Change
- derive the PR title deterministically from the ticket, normalize whitespace, and cap it at 240 Unicode code points
- require a normalized GitHub
#<number>identifier and exactly oneFixes #<number>line - reject placeholder or invalid metadata before the first
git pushorgh pr create - use the same contract in passed, blocked, post-review, and merge-gate branches
- exercise the actual canonical example, including the #3913 production identity
The existing Cloud PR #3919 has separately been repaired to the exact #3913 title and one Fixes #3913 line. This PR prevents recurrence in the source artifact; it does not release or roll out a new catalog pin.
Verification
$ cd packages/sdk && npx vitest run tests/canonical-software-factory.test.ts
RUN v2.1.9 /Users/khaliqgant/Projects/AgentWorkforce/flows-factory-metadata/packages/sdk
✓ tests/canonical-software-factory.test.ts (3 tests) 1115ms
✓ canonical software-factory metadata contract > opens the actual catalog flow with the ticket title and exactly one GitHub closing line 501ms
✓ canonical software-factory metadata contract > normalizes whitespace and caps the title at 240 Unicode code points 373ms
Test Files 1 passed (1)
Tests 3 passed (3)
Duration 2.37s
$ git diff --check
[no output; exit 0]
[!NOTE]
Low Risk
Changes are confined to the example flow and new tests; behavior is stricter metadata validation with no auth or production rollout in this PR.
Overview
The canonical software-factory example now derives every pull request title from the ticket (whitespace normalized, 240 Unicode code points max) instead of ad hoc or placeholder titles, and draft PRs no longer use a [blocked] title prefix—blocked state stays in the body sections.
For GitHub-sourced tickets it requires identifier in #<number> form, appends a single Fixes #<number> line when missing, and runs redundant shell validation on the final title/body before git push or gh pr create. Invalid or placeholder metadata ends the run as needs_human without opening a PR; the same openPullRequest path is used for success, adversarial block, post-review block, and merge-gate block.
The README documents this contract, the flow version bumps to 2.0.22, and canonical-software-factory.test.ts exercises the real catalog flow (title, closing line, ordering, and fail-closed cases).
Reviewed by Cursor Bugbot for commit a8746518645de149307451f2a154cb418744e1cc. Bugbot is set up for automated code reviews on this repo. Configure here.