arXiv:2610.39872cs.SEOct 2026

Manuscript Offprint

arXiv:2610.39872

STORY2DIFF: A Dataset Linking Real-World User Stories to Code Changes

Benedetta Donato, Daniele Franchini, Alessandro Greco, Oliviero Riganelli, Daniela Micucci, Leonardo Mariani

Benedetta Donato, Daniele Franchini, Alessandro Greco, Oliviero Riganelli, Daniela Micucci, Leonardo Mariani

University of Milano-Bicocca, Milan, Italy

{benedetta.donato,oliviero.riganelli,daniela.micucci,leonardo.mariani}@unimib.it, {d.franchini2,a.greco71}@campus.unimib.it

Abstract—Research on requirements-to-code tasks needs examples in which a genuine requirement is paired with the change that implemented it. Existing user-story collections, however, largely contain isolated or synthetic text. To address this limitation, we present STORY2DIFF, a dataset of 7,785 English user stories linked to merged pull requests from January 2017 to July 2026. The dataset is mined from a set of 982 public Java and Python repositories. Each record in the dataset combines the original issue, extracted Connextra elements, the associated pull request and commit metadata, a file-level diff capturing the code changes introduced by the associated pull request, and the affected files before and after the change. The tool we built to mine STORY2DIFF can be used to repeat the automatic extraction of the records, using different parameters (e.g., a different timeframe). The dataset can support a variety of tasks, including requirement discovery, traceability, change-impact estimation, and requirements-aware code generation. Dataset: https://github.com/riganelli/user-story-mining-pipeline/releases/tag/V4.0.1. Video: https://youtu.be/qOhXUeyeiTQ.

Index Terms—User Stories, Requirements Traceability, Mining Software Repositories

I. INTRODUCTION

User stories are commonly used to specify requirements from a stakeholder's perspective, often through the Connextra template: As a [role], I want [feature], so that [benefit] [1]. They are widely used in agile development processes, such as Scrum and XP.

A wide spectrum of techniques needs both large sets of requirements and their implementation to be properly assessed. This includes automated traceability recovery, which identifies links between requirements and implementation artifacts [2]; requirements-driven change-impact analysis, which identifies the code affected by a requirement change [3]; and code generation and modification from natural-language requirements [4]. Paired requirements and implementations provide reference artifacts against which recovered links, predicted changes, and generated code can be assessed.

Existing user-story datasets generally contain collections of stories without associated implementations [5], [6], [7]. Such datasets are sufficient to study, for instance, the linguistic quality of the requirements [5], but they are insufficient for investigating questions that cross the boundary between requirements and implementation.

To address this gap, we built STORY2DIFF, a dataset of user stories linked to the code changes introduced by the pull requests that close their corresponding GitHub issues, together with tool support to repeat and adapt the extraction process to future needs. In particular, we extract issues that contain user stories matching the Connextra template that are bound to merged pull requests (PRs).

In a nutshell, STORY2DIFF delivers 7,785 real-world user-story-implementation records spanning 982 Java and Python repositories and nearly ten years of development; and a documented and reproducible multi-stage mining process that combines LLM validation, issue analysis, and text verification.