hyd2apse commited on
Commit
b5cc3b6
·
1 Parent(s): 9c86e1f

Validate and normalize benchmark data

Browse files
Files changed (28) hide show
  1. BurntSushi_ripgrep_14.1.1_15.0.0/test_results/simple_test/simple_test_classification.json +0 -7
  2. README.md +35 -16
  3. apache_dubbo_dubbo-3.3.3_dubbo-3.3.6/test_results/M017/M017_filter_list.json +0 -2
  4. element-hq_element-web_v1.11.95_v1.11.97/test_results/milestone_seed_56c7fc1_1/milestone_seed_56c7fc1_1_filter_list.json +0 -6
  5. navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-01/milestone_003_sub-01_classification.json +0 -20
  6. navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-01/milestone_003_sub-01_filter_list.json +1 -1
  7. navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-03/milestone_003_sub-03_classification.json +0 -40
  8. navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-03/milestone_003_sub-03_filter_list.json +0 -4
  9. scikit-learn_scikit-learn_1.5.2_1.6.0/test_results/M12.5/M12.5_filter_list.json +0 -6
  10. scripts/validate_data.py +897 -0
  11. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M007.1/M007.1_filter_list.json +2 -2
  12. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M007.2/M007.2_filter_list.json +2 -2
  13. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M008/M008_filter_list.json +2 -2
  14. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M009/M009_filter_list.json +2 -2
  15. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M010/M010_filter_list.json +2 -2
  16. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M013/M013_filter_list.json +2 -2
  17. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M014/M014_filter_list.json +2 -2
  18. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M017/M017_filter_list.json +2 -2
  19. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M018/M018_filter_list.json +2 -2
  20. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M019/M019_filter_list.json +2 -2
  21. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M020/M020_filter_list.json +2 -2
  22. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M021/M021_filter_list.json +2 -2
  23. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M022/M022_filter_list.json +2 -2
  24. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M023/M023_filter_list.json +2 -2
  25. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M025/M025_filter_list.json +2 -2
  26. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M026/M026_filter_list.json +2 -2
  27. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M027/M027_filter_list.json +2 -2
  28. zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M028/M028_filter_list.json +2 -2
BurntSushi_ripgrep_14.1.1_15.0.0/test_results/simple_test/simple_test_classification.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "stable_classification": {
3
- "fail_to_pass": [],
4
- "pass_to_pass": [],
5
- "none_to_pass": []
6
- }
7
- }
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -28,24 +28,29 @@ This dataset contains the metadata, task specifications (SRS documents), depende
28
 
29
  ## Dataset Statistics
30
 
31
- SWE-Milestone covers **7 real-world open-source repositories** spanning 5 programming languages, with **98 graded milestones**, **124 dependency edges**, and **48,480 total ΔLoC** in gold patches.
32
-
33
- | Repository | Language | Version Range | #Milestones | #Deps | ΔLoC | LoC CV |
34
- |-----------|----------|---------------|:-----------:|:-----:|-----:|:------:|
35
- | [go-zero](https://github.com/zeromicro/go-zero) | Go | v1.6.0 v1.9.3 (750d) | 23 | 25 | 6,403 | 1.29 |
36
- | [element-web](https://github.com/element-hq/element-web) | TypeScript | v1.11.95 → v1.11.97 (28d) | 18 | 12 | 7,657 | 0.87 |
37
- | [nushell](https://github.com/nushell/nushell) | Rust | 0.106.0 → 0.108.0 (84d) | 13 | 28 | 15,520 | 1.10 |
38
- | [dubbo](https://github.com/apache/dubbo) | Java | 3.3.33.3.6 (284d) | 12 | 9 | 4,154 | 0.76 |
39
- | [scikit-learn](https://github.com/scikit-learn/scikit-learn) | Python | 1.5.21.6.0 (89d) | 12 | 29 | 7,372 | 0.84 |
40
- | [ripgrep](https://github.com/BurntSushi/ripgrep) | Rust | 14.1.115.0.0 (402d) | 11 | 12 | 1,474 | 0.83 |
41
- | [navidrome](https://github.com/navidrome/navidrome) | Go | v0.57.0v0.58.0 (27d) | 9 | 9 | 5,900 | 1.02 |
42
- | **Average** | | | **14** | **17.7** | **6,926** | **0.96** |
 
 
43
 
44
  **Column definitions:**
45
- - **#Milestones** --- Number of graded milestones (non-graded milestones excluded from scoring but still part of the DAG).
46
- - **#Deps** --- Number of dependency edges in the milestone DAG.
47
- - **ΔLoC** --- Total lines of code changed across all gold patches in the version range.
48
- - **LoC CV** --- Coefficient of variation of per-milestone LoC, measuring how unevenly work is distributed across milestones (higher = more variable).
 
 
 
49
 
50
  ## Dataset Structure
51
 
@@ -97,6 +102,20 @@ Each milestone in the DAG requires the following components:
97
  - The **Graded Milestones** count includes only milestones that contribute to the final score. Some repositories include additional **non-graded milestones** (listed in `non-graded_milestone_ids.txt`) that the agent must still implement as part of the dependency DAG but are excluded from scoring, typically because they are trivial tasks (e.g., version bumps, dependency updates) or lack sufficient test coverage for reliable grading. Only 3 milestones across all repositories are non-graded.
98
  - Each milestone is extracted from the actual commit history of the repository, representing real software evolution between the listed version ranges.
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  ## Usage
101
 
102
  ```bash
 
28
 
29
  ## Dataset Statistics
30
 
31
+ <!-- BEGIN GENERATED DATASET STATISTICS -->
32
+
33
+ SWE-Milestone covers **7 real-world open-source repositories** spanning 5 programming languages, with **98 graded milestones**, **110 active dependency edges** (84 base + 26 additional), and **48,470 total ΔSrcLoC** in graded gold patches.
34
+
35
+ | Repository | Language | Version Range | #Milestones | #Deps | ΔSrcLoC | Src LoC CV |
36
+ |-----------|----------|---------------|:-----------:|:-----:|---------:|:----------:|
37
+ | [go-zero](https://github.com/zeromicro/go-zero) | Go | v1.6.0 → v1.9.3 (750d) | 23 | 24 | 6,403 | 0.63 |
38
+ | [element-web](https://github.com/element-hq/element-web) | TypeScript | v1.11.95v1.11.97 (28d) | 18 | 12 | 7,647 | 0.82 |
39
+ | [nushell](https://github.com/nushell/nushell) | Rust | 0.106.00.108.0 (84d) | 13 | 29 | 15,520 | 1.01 |
40
+ | [dubbo](https://github.com/apache/dubbo) | Java | 3.3.33.3.6 (284d) | 12 | 6 | 4,154 | 0.43 |
41
+ | [scikit-learn](https://github.com/scikit-learn/scikit-learn) | Python | 1.5.21.6.0 (89d) | 12 | 14 | 7,372 | 1.07 |
42
+ | [ripgrep](https://github.com/BurntSushi/ripgrep) | Rust | 14.1.1 15.0.0 (402d) | 11 | 16 | 1,474 | 0.54 |
43
+ | [navidrome](https://github.com/navidrome/navidrome) | Go | v0.57.0 → v0.58.0 (27d) | 9 | 9 | 5,900 | 0.83 |
44
+ | **Average** | | | **14** | **15.7** | **6,924** | **0.76** |
45
 
46
  **Column definitions:**
47
+ - **#Milestones** - Number of graded milestones: active milestones excluding IDs in `non-graded_milestone_ids.txt`.
48
+ - **#Deps** - Number of unique edges in the active DAG. It combines `dependencies.csv` and `additional_dependencies.csv`, then keeps edges whose two endpoints are active. Non-graded milestones remain part of this DAG because the agent still implements them.
49
+ - **ΔSrcLoC** - Sum of `src_loc` over graded milestones only. `src_loc` equals `src_additions + src_deletions` and excludes test-only changes according to each repository's metadata.
50
+ - **Src LoC CV** - Population coefficient of variation (`pstdev / mean`) of graded milestone `src_loc` values.
51
+ - **Active milestones** - IDs from `selected_milestone_ids.txt` when that file exists; otherwise every ID in `milestones.csv`.
52
+
53
+ <!-- END GENERATED DATASET STATISTICS -->
54
 
55
  ## Dataset Structure
56
 
 
102
  - The **Graded Milestones** count includes only milestones that contribute to the final score. Some repositories include additional **non-graded milestones** (listed in `non-graded_milestone_ids.txt`) that the agent must still implement as part of the dependency DAG but are excluded from scoring, typically because they are trivial tasks (e.g., version bumps, dependency updates) or lack sufficient test coverage for reliable grading. Only 3 milestones across all repositories are non-graded.
103
  - Each milestone is extracted from the actual commit history of the repository, representing real software evolution between the listed version ranges.
104
 
105
+ ## Validation
106
+
107
+ Run the dataset contract validator from the repository root:
108
+
109
+ ```bash
110
+ python scripts/validate_data.py
111
+ ```
112
+
113
+ The validator checks the active and graded milestone sets, the effective DAG, SRS and test-classification coverage, classification/filter schemas, and the generated README statistics. It exits non-zero when contract errors are found. After an intentional data change, regenerate the statistics block with:
114
+
115
+ ```bash
116
+ python scripts/validate_data.py --write-readme
117
+ ```
118
+
119
  ## Usage
120
 
121
  ```bash
apache_dubbo_dubbo-3.3.3_dubbo-3.3.6/test_results/M017/M017_filter_list.json CHANGED
@@ -2,8 +2,6 @@
2
  "invalid_fail_to_pass": [],
3
  "invalid_none_to_pass": [
4
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument test [path: /buy, body: <org.apache.dubbo.rpc.protocol.tri.rest.service.Book@111cba40 name=Dubbo price=0 publishDate=null>, output: Dubbo, #0]",
5
- "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument test [path: /buy2, body: [book:org.apache.dubbo.rpc.protocol.tri.rest.service.Book@4fb57fb3, count:2], output: Dubbo, #3]",
6
- "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument test [path: /buy2, body: [org.apache.dubbo.rpc.protocol.tri.rest.service.Book@336f49a1, 2], output: Dubbo, #2]",
7
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument post test [path: /beanArgTest, body: [book:org.apache.dubbo.rpc.protocol.tri.rest.service.Book@7ec3a8bd], output: 6, #2]",
8
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument post test [path: /beanArgTest, body: [book:org.apache.dubbo.rpc.protocol.tri.rest.service.Book@42cf6349, quote:5], output: 5, #3]"
9
  ],
 
2
  "invalid_fail_to_pass": [],
3
  "invalid_none_to_pass": [
4
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument test [path: /buy, body: <org.apache.dubbo.rpc.protocol.tri.rest.service.Book@111cba40 name=Dubbo price=0 publishDate=null>, output: Dubbo, #0]",
 
 
5
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument post test [path: /beanArgTest, body: [book:org.apache.dubbo.rpc.protocol.tri.rest.service.Book@7ec3a8bd], output: 6, #2]",
6
  "dubbo-rpc/dubbo-rpc-triple::org.apache.dubbo.rpc.protocol.tri.rest.support.basic.RestProtocolTest::bean argument post test [path: /beanArgTest, body: [book:org.apache.dubbo.rpc.protocol.tri.rest.service.Book@42cf6349, quote:5], output: 5, #3]"
7
  ],
element-hq_element-web_v1.11.95_v1.11.97/test_results/milestone_seed_56c7fc1_1/milestone_seed_56c7fc1_1_filter_list.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "invalid_fail_to_pass": [
3
- "/testbed/test/unit-tests/components/views/rooms/MessageComposerButtons-test.tsx::MessageComposerButtons Renders other buttons in menu in wide mode"
4
- ],
5
- "invalid_none_to_pass": []
6
- }
 
 
 
 
 
 
 
navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-01/milestone_003_sub-01_classification.json CHANGED
@@ -5891,10 +5891,6 @@
5891
  "test_id": "github.com/navidrome/navidrome/persistence::sqlRepository > buildSortOrder > single field > forces snake case for field names",
5892
  "end_outcome": "passed"
5893
  },
5894
- {
5895
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is true > returns the index when PreferSortTags is true and SortArtistName is not empty",
5896
- "end_outcome": "passed"
5897
- },
5898
  {
5899
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > roleFilter > validates roles and returns appropriate SQL expressions > albumartist role",
5900
  "end_outcome": "failed"
@@ -6835,10 +6831,6 @@
6835
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > MBID and Text Search > prevents restricted user from finding artist by MBID when not in accessible library",
6836
  "end_outcome": "passed"
6837
  },
6838
- {
6839
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is NOT empty",
6840
- "end_outcome": "passed"
6841
- },
6842
  {
6843
  "test_id": "github.com/navidrome/navidrome/persistence::TranscodingRepository > Regular User > fails to create",
6844
  "end_outcome": "passed"
@@ -7027,10 +7019,6 @@
7027
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > ReadAll > should return all genres through ReadAll",
7028
  "end_outcome": "passed"
7029
  },
7030
- {
7031
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Count > returns the number of artists in the DB",
7032
- "end_outcome": "passed"
7033
- },
7034
  {
7035
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > Read > should not return non-genre tags",
7036
  "end_outcome": "passed"
@@ -7591,10 +7579,6 @@
7591
  "test_id": "github.com/navidrome/navidrome/model/metadata::Participants > PERFORMER tags > when MUSICBRAINZ_PERFORMERID tag is set > should handle mismatched performer names and MBIDs for sub-roles",
7592
  "end_outcome": "passed"
7593
  },
7594
- {
7595
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is empty",
7596
- "end_outcome": "passed"
7597
- },
7598
  {
7599
  "test_id": "github.com/navidrome/navidrome/model::MediaFiles > ToAlbum > Calculated attributes > Comments > when we have only one Comment > sets the correct Comment",
7600
  "end_outcome": "passed"
@@ -8339,10 +8323,6 @@
8339
  "test_id": "github.com/navidrome/navidrome/persistence::UserRepository > validateUsernameUnique > allows unique usernames",
8340
  "end_outcome": "passed"
8341
  },
8342
- {
8343
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when validating library IDs > returns artists when library IDs are provided (admin user sees all content)",
8344
- "end_outcome": "passed"
8345
- },
8346
  {
8347
  "test_id": "github.com/navidrome/navidrome/model/metadata::Metadata > Metadata > Performers > Vorbis > should return the performers",
8348
  "end_outcome": "passed"
 
5891
  "test_id": "github.com/navidrome/navidrome/persistence::sqlRepository > buildSortOrder > single field > forces snake case for field names",
5892
  "end_outcome": "passed"
5893
  },
 
 
 
 
5894
  {
5895
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > roleFilter > validates roles and returns appropriate SQL expressions > albumartist role",
5896
  "end_outcome": "failed"
 
6831
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > MBID and Text Search > prevents restricted user from finding artist by MBID when not in accessible library",
6832
  "end_outcome": "passed"
6833
  },
 
 
 
 
6834
  {
6835
  "test_id": "github.com/navidrome/navidrome/persistence::TranscodingRepository > Regular User > fails to create",
6836
  "end_outcome": "passed"
 
7019
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > ReadAll > should return all genres through ReadAll",
7020
  "end_outcome": "passed"
7021
  },
 
 
 
 
7022
  {
7023
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > Read > should not return non-genre tags",
7024
  "end_outcome": "passed"
 
7579
  "test_id": "github.com/navidrome/navidrome/model/metadata::Participants > PERFORMER tags > when MUSICBRAINZ_PERFORMERID tag is set > should handle mismatched performer names and MBIDs for sub-roles",
7580
  "end_outcome": "passed"
7581
  },
 
 
 
 
7582
  {
7583
  "test_id": "github.com/navidrome/navidrome/model::MediaFiles > ToAlbum > Calculated attributes > Comments > when we have only one Comment > sets the correct Comment",
7584
  "end_outcome": "passed"
 
8323
  "test_id": "github.com/navidrome/navidrome/persistence::UserRepository > validateUsernameUnique > allows unique usernames",
8324
  "end_outcome": "passed"
8325
  },
 
 
 
 
8326
  {
8327
  "test_id": "github.com/navidrome/navidrome/model/metadata::Metadata > Metadata > Performers > Vorbis > should return the performers",
8328
  "end_outcome": "passed"
navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-01/milestone_003_sub-01_filter_list.json CHANGED
@@ -420,7 +420,7 @@
420
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns a 'in' condition for multiples 'id' filters",
421
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns a 'like' condition for other filters",
422
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns nil if filters is empty",
423
- "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns nil if tries a filter with fullTextExpr(",
424
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > uses the custom filter"
425
  ],
426
  "invalid_none_to_pass": []
 
420
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns a 'in' condition for multiples 'id' filters",
421
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns a 'like' condition for other filters",
422
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns nil if filters is empty",
423
+ "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > returns nil if tries a filter with fullTextExpr(\"'\")",
424
  "github.com/navidrome/navidrome/persistence::sqlRestful > parseRestFilters > uses the custom filter"
425
  ],
426
  "invalid_none_to_pass": []
navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-03/milestone_003_sub-03_classification.json CHANGED
@@ -5180,10 +5180,6 @@
5180
  "test_id": "github.com/navidrome/navidrome/persistence::PlayerRepository > Get > Gets an existing item from another user",
5181
  "end_outcome": "passed"
5182
  },
5183
- {
5184
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Regular User Operations > when user gains library access > GetAll returns artists after gaining access",
5185
- "end_outcome": "passed"
5186
- },
5187
  {
5188
  "test_id": "github.com/navidrome/navidrome/persistence::PlaylistRepository > Put/Exists/Delete",
5189
  "end_outcome": "passed"
@@ -5208,10 +5204,6 @@
5208
  "test_id": "github.com/navidrome/navidrome/persistence::sqlRepository > buildSortOrder > single field > forces snake case for field names",
5209
  "end_outcome": "passed"
5210
  },
5211
- {
5212
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is true > returns the index when PreferSortTags is true and SortArtistName is not empty",
5213
- "end_outcome": "passed"
5214
- },
5215
  {
5216
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > roleFilter > validates roles and returns appropriate SQL expressions > albumartist role",
5217
  "end_outcome": "passed"
@@ -5488,10 +5480,6 @@
5488
  "test_id": "github.com/navidrome/navidrome/persistence::PlayQueueRepository > Retrieve > retrieves the playqueue with only track IDs (no full MediaFile data)",
5489
  "end_outcome": "passed"
5490
  },
5491
- {
5492
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Admin User Library Access > sees all artists regardless of library permissions",
5493
- "end_outcome": "passed"
5494
- },
5495
  {
5496
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > Library Filtering > Headless Processes (No User Context) > should count all genres from all libraries when no user is in context",
5497
  "end_outcome": "passed"
@@ -5896,10 +5884,6 @@
5896
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > MBID and Text Search > prevents restricted user from finding artist by MBID when not in accessible library",
5897
  "end_outcome": "passed"
5898
  },
5899
- {
5900
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is NOT empty",
5901
- "end_outcome": "passed"
5902
- },
5903
  {
5904
  "test_id": "github.com/navidrome/navidrome/persistence::TranscodingRepository > Regular User > fails to create",
5905
  "end_outcome": "passed"
@@ -5960,10 +5944,6 @@
5960
  "test_id": "github.com/navidrome/navidrome/persistence::Property Repository > returns a default value if property does not exist",
5961
  "end_outcome": "passed"
5962
  },
5963
- {
5964
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Regular User Operations > when user gains library access > CountAll returns correct count after gaining access",
5965
- "end_outcome": "passed"
5966
- },
5967
  {
5968
  "test_id": "github.com/navidrome/navidrome/core/agents::Agents > Agents > GetArtistMBID > returns not found if artist is Unknown Artist",
5969
  "end_outcome": "passed"
@@ -6036,10 +6016,6 @@
6036
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > ReadAll > should return all genres through ReadAll",
6037
  "end_outcome": "passed"
6038
  },
6039
- {
6040
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Count > returns the number of artists in the DB",
6041
- "end_outcome": "passed"
6042
- },
6043
  {
6044
  "test_id": "github.com/navidrome/navidrome/core/agents::Agents > Agents > GetArtistBiography > returns not found if artist is Unknown Artist",
6045
  "end_outcome": "passed"
@@ -6424,10 +6400,6 @@
6424
  "test_id": "github.com/navidrome/navidrome/persistence::Tag Library Filtering > TagRepository Library Filtering > Admin User > should see all tags regardless of library",
6425
  "end_outcome": "passed"
6426
  },
6427
- {
6428
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is empty",
6429
- "end_outcome": "passed"
6430
- },
6431
  {
6432
  "test_id": "github.com/navidrome/navidrome/persistence::PlayQueueRepository > RetrieveWithMediaFiles > retrieves the playqueue with full MediaFile data",
6433
  "end_outcome": "passed"
@@ -6636,10 +6608,6 @@
6636
  "test_id": "github.com/navidrome/navidrome/persistence::MediaRepository > returns songs ordered by lyrics with a specific title/artist",
6637
  "end_outcome": "passed"
6638
  },
6639
- {
6640
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Missing Artist Handling > missing artists are never returned by search",
6641
- "end_outcome": "passed"
6642
- },
6643
  {
6644
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > GetAll > filtering and sorting > should sort by name in ascending order",
6645
  "end_outcome": "passed"
@@ -6700,10 +6668,6 @@
6700
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostScan > parses stats and similar artists correctly",
6701
  "end_outcome": "passed"
6702
  },
6703
- {
6704
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Regular User Operations > when user gains library access > GetIndex returns artists with proper library filtering",
6705
- "end_outcome": "passed"
6706
- },
6707
  {
6708
  "test_id": "github.com/navidrome/navidrome/persistence::AlbumRepository > artistRoleFilter > creates correct SQL expressions for artist roles > composer role",
6709
  "end_outcome": "passed"
@@ -6944,10 +6908,6 @@
6944
  "test_id": "github.com/navidrome/navidrome/persistence::UserRepository > validateUsernameUnique > allows unique usernames",
6945
  "end_outcome": "passed"
6946
  },
6947
- {
6948
- "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when validating library IDs > returns artists when library IDs are provided (admin user sees all content)",
6949
- "end_outcome": "passed"
6950
- },
6951
  {
6952
  "test_id": "github.com/navidrome/navidrome/persistence::PlayerRepository > per context > admin context > Read > can read from other user or fail if not admin",
6953
  "end_outcome": "passed"
 
5180
  "test_id": "github.com/navidrome/navidrome/persistence::PlayerRepository > Get > Gets an existing item from another user",
5181
  "end_outcome": "passed"
5182
  },
 
 
 
 
5183
  {
5184
  "test_id": "github.com/navidrome/navidrome/persistence::PlaylistRepository > Put/Exists/Delete",
5185
  "end_outcome": "passed"
 
5204
  "test_id": "github.com/navidrome/navidrome/persistence::sqlRepository > buildSortOrder > single field > forces snake case for field names",
5205
  "end_outcome": "passed"
5206
  },
 
 
 
 
5207
  {
5208
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > roleFilter > validates roles and returns appropriate SQL expressions > albumartist role",
5209
  "end_outcome": "passed"
 
5480
  "test_id": "github.com/navidrome/navidrome/persistence::PlayQueueRepository > Retrieve > retrieves the playqueue with only track IDs (no full MediaFile data)",
5481
  "end_outcome": "passed"
5482
  },
 
 
 
 
5483
  {
5484
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > Library Filtering > Headless Processes (No User Context) > should count all genres from all libraries when no user is in context",
5485
  "end_outcome": "passed"
 
5884
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > MBID and Text Search > prevents restricted user from finding artist by MBID when not in accessible library",
5885
  "end_outcome": "passed"
5886
  },
 
 
 
 
5887
  {
5888
  "test_id": "github.com/navidrome/navidrome/persistence::TranscodingRepository > Regular User > fails to create",
5889
  "end_outcome": "passed"
 
5944
  "test_id": "github.com/navidrome/navidrome/persistence::Property Repository > returns a default value if property does not exist",
5945
  "end_outcome": "passed"
5946
  },
 
 
 
 
5947
  {
5948
  "test_id": "github.com/navidrome/navidrome/core/agents::Agents > Agents > GetArtistMBID > returns not found if artist is Unknown Artist",
5949
  "end_outcome": "passed"
 
6016
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > ReadAll > should return all genres through ReadAll",
6017
  "end_outcome": "passed"
6018
  },
 
 
 
 
6019
  {
6020
  "test_id": "github.com/navidrome/navidrome/core/agents::Agents > Agents > GetArtistBiography > returns not found if artist is Unknown Artist",
6021
  "end_outcome": "passed"
 
6400
  "test_id": "github.com/navidrome/navidrome/persistence::Tag Library Filtering > TagRepository Library Filtering > Admin User > should see all tags regardless of library",
6401
  "end_outcome": "passed"
6402
  },
 
 
 
 
6403
  {
6404
  "test_id": "github.com/navidrome/navidrome/persistence::PlayQueueRepository > RetrieveWithMediaFiles > retrieves the playqueue with full MediaFile data",
6405
  "end_outcome": "passed"
 
6608
  "test_id": "github.com/navidrome/navidrome/persistence::MediaRepository > returns songs ordered by lyrics with a specific title/artist",
6609
  "end_outcome": "passed"
6610
  },
 
 
 
 
6611
  {
6612
  "test_id": "github.com/navidrome/navidrome/persistence::GenreRepository > GetAll > filtering and sorting > should sort by name in ascending order",
6613
  "end_outcome": "passed"
 
6668
  "test_id": "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostScan > parses stats and similar artists correctly",
6669
  "end_outcome": "passed"
6670
  },
 
 
 
 
6671
  {
6672
  "test_id": "github.com/navidrome/navidrome/persistence::AlbumRepository > artistRoleFilter > creates correct SQL expressions for artist roles > composer role",
6673
  "end_outcome": "passed"
 
6908
  "test_id": "github.com/navidrome/navidrome/persistence::UserRepository > validateUsernameUnique > allows unique usernames",
6909
  "end_outcome": "passed"
6910
  },
 
 
 
 
6911
  {
6912
  "test_id": "github.com/navidrome/navidrome/persistence::PlayerRepository > per context > admin context > Read > can read from other user or fail if not admin",
6913
  "end_outcome": "passed"
navidrome_navidrome_v0.57.0_v0.58.0/test_results/milestone_003_sub-03/milestone_003_sub-03_filter_list.json CHANGED
@@ -75,13 +75,9 @@
75
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Get > returns ErrNotFound when the album does not exist",
76
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Participant Foreign Key Handling > handles complex nested JSON with multiple roles and sub-roles",
77
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Participant Foreign Key Handling > verifies that participant records are actually inserted into database",
78
- "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Count > returns the number of artists in the DB",
79
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Exists > returns false for an artist that is NOT in the DB",
80
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Exists > returns true for an artist that is in the DB",
81
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Get > retrieves existing artist data",
82
- "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is empty",
83
- "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is false > returns the index when SortArtistName is NOT empty",
84
- "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > GetIndex > when PreferSortTags is true > returns the index when PreferSortTags is true and SortArtistName is not empty",
85
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > does not override empty sort_artist_name and mbz_artist_id",
86
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > maps empty similar artists correctly",
87
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > maps similar artists and full text correctly",
 
75
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Get > returns ErrNotFound when the album does not exist",
76
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Participant Foreign Key Handling > handles complex nested JSON with multiple roles and sub-roles",
77
  "github.com/navidrome/navidrome/persistence::AlbumRepository > Participant Foreign Key Handling > verifies that participant records are actually inserted into database",
 
78
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Exists > returns false for an artist that is NOT in the DB",
79
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Exists > returns true for an artist that is in the DB",
80
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Admin User Operations > Basic Operations > Get > retrieves existing artist data",
 
 
 
81
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > does not override empty sort_artist_name and mbz_artist_id",
82
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > maps empty similar artists correctly",
83
  "github.com/navidrome/navidrome/persistence::ArtistRepository > Core Functionality > dbArtist mapping > PostMapArgs > maps similar artists and full text correctly",
scikit-learn_scikit-learn_1.5.2_1.6.0/test_results/M12.5/M12.5_filter_list.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "invalid_fail_to_pass": [],
3
- "invalid_none_to_pass": [
4
- "test_fixed_threshold_classifier_prefit"
5
- ]
6
- }
 
 
 
 
 
 
 
scripts/validate_data.py ADDED
@@ -0,0 +1,897 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Validate the SWE-Milestone dataset contract and its README statistics.
3
+
4
+ The source files are authoritative. README statistics are derived from them:
5
+
6
+ * catalog = every ID in milestones.csv
7
+ * active = selected_milestone_ids.txt when present, otherwise catalog
8
+ * non-graded = IDs in non-graded_milestone_ids.txt
9
+ * graded = active - non-graded
10
+ * effective DAG = unique base + additional edges with both endpoints active
11
+
12
+ Milestone count, DeltaSrcLoC, and SrcLoC CV are computed over graded IDs.
13
+ Dependency count is computed over the active DAG because non-graded milestones
14
+ are still implemented by the agent and participate in scheduling.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import argparse
20
+ import csv
21
+ import json
22
+ import statistics
23
+ import sys
24
+ from collections import Counter, deque
25
+ from dataclasses import asdict, dataclass
26
+ from pathlib import Path
27
+ from typing import Any, Iterable, Sequence
28
+
29
+
30
+ TRANSITION_CATEGORIES = (
31
+ "pass_to_pass",
32
+ "pass_to_fail",
33
+ "pass_to_skipped",
34
+ "fail_to_pass",
35
+ "fail_to_fail",
36
+ "fail_to_skipped",
37
+ "skipped_to_pass",
38
+ "skipped_to_fail",
39
+ "skipped_to_skipped",
40
+ "none_to_pass",
41
+ "none_to_fail",
42
+ "none_to_skipped",
43
+ "pass_to_none",
44
+ "fail_to_none",
45
+ "skipped_to_none",
46
+ )
47
+ AGGREGATE_CATEGORIES = ("new_tests", "removed_tests")
48
+ CLASSIFICATION_CATEGORIES = TRANSITION_CATEGORIES + AGGREGATE_CATEGORIES
49
+ FILTER_KEYS = (
50
+ "invalid_fail_to_pass",
51
+ "invalid_none_to_pass",
52
+ "invalid_pass_to_pass",
53
+ )
54
+ REQUIRED_DEPENDENCY_COLUMNS = {
55
+ "source_id",
56
+ "target_id",
57
+ "type",
58
+ "strength",
59
+ "rationale",
60
+ "confidence_score",
61
+ }
62
+ README_BEGIN = "<!-- BEGIN GENERATED DATASET STATISTICS -->"
63
+ README_END = "<!-- END GENERATED DATASET STATISTICS -->"
64
+
65
+
66
+ # Display-only metadata. All numeric values are derived from dataset files.
67
+ README_REPO_INFO = {
68
+ "zeromicro_go-zero_v1.6.0_v1.9.3": (
69
+ "[go-zero](https://github.com/zeromicro/go-zero)",
70
+ "Go",
71
+ "v1.6.0 \u2192 v1.9.3 (750d)",
72
+ ),
73
+ "element-hq_element-web_v1.11.95_v1.11.97": (
74
+ "[element-web](https://github.com/element-hq/element-web)",
75
+ "TypeScript",
76
+ "v1.11.95 \u2192 v1.11.97 (28d)",
77
+ ),
78
+ "nushell_nushell_0.106.0_0.108.0": (
79
+ "[nushell](https://github.com/nushell/nushell)",
80
+ "Rust",
81
+ "0.106.0 \u2192 0.108.0 (84d)",
82
+ ),
83
+ "apache_dubbo_dubbo-3.3.3_dubbo-3.3.6": (
84
+ "[dubbo](https://github.com/apache/dubbo)",
85
+ "Java",
86
+ "3.3.3 \u2192 3.3.6 (284d)",
87
+ ),
88
+ "scikit-learn_scikit-learn_1.5.2_1.6.0": (
89
+ "[scikit-learn](https://github.com/scikit-learn/scikit-learn)",
90
+ "Python",
91
+ "1.5.2 \u2192 1.6.0 (89d)",
92
+ ),
93
+ "BurntSushi_ripgrep_14.1.1_15.0.0": (
94
+ "[ripgrep](https://github.com/BurntSushi/ripgrep)",
95
+ "Rust",
96
+ "14.1.1 \u2192 15.0.0 (402d)",
97
+ ),
98
+ "navidrome_navidrome_v0.57.0_v0.58.0": (
99
+ "[navidrome](https://github.com/navidrome/navidrome)",
100
+ "Go",
101
+ "v0.57.0 \u2192 v0.58.0 (27d)",
102
+ ),
103
+ }
104
+
105
+
106
+ @dataclass(frozen=True)
107
+ class Diagnostic:
108
+ severity: str
109
+ path: str
110
+ message: str
111
+
112
+
113
+ @dataclass(frozen=True)
114
+ class RepoStats:
115
+ repo: str
116
+ catalog_milestones: int
117
+ active_milestones: int
118
+ graded_milestones: int
119
+ non_graded_milestones: int
120
+ base_active_dependencies: int
121
+ additional_active_dependencies: int
122
+ active_dependencies: int
123
+ strong_dependencies: int
124
+ weak_dependencies: int
125
+ graded_src_loc: int
126
+ graded_src_loc_cv: float
127
+ roots: int
128
+ leaves: int
129
+ max_depth_edges: int
130
+
131
+
132
+ class DatasetValidator:
133
+ def __init__(self, data_root: Path) -> None:
134
+ self.data_root = data_root.resolve()
135
+ self.diagnostics: list[Diagnostic] = []
136
+ self.stats: list[RepoStats] = []
137
+
138
+ def error(self, path: Path | str, message: str) -> None:
139
+ self._add("ERROR", path, message)
140
+
141
+ def warning(self, path: Path | str, message: str) -> None:
142
+ self._add("WARNING", path, message)
143
+
144
+ def info(self, path: Path | str, message: str) -> None:
145
+ self._add("INFO", path, message)
146
+
147
+ def _add(self, severity: str, path: Path | str, message: str) -> None:
148
+ path_obj = Path(path)
149
+ try:
150
+ display_path = str(path_obj.resolve().relative_to(self.data_root))
151
+ except (OSError, ValueError):
152
+ display_path = str(path)
153
+ self.diagnostics.append(Diagnostic(severity, display_path, message))
154
+
155
+ def validate(self) -> list[RepoStats]:
156
+ if not self.data_root.is_dir():
157
+ self.error(self.data_root, "data root does not exist or is not a directory")
158
+ return []
159
+
160
+ repo_dirs = sorted(
161
+ path
162
+ for path in self.data_root.iterdir()
163
+ if path.is_dir() and (path / "metadata.json").is_file()
164
+ )
165
+ if not repo_dirs:
166
+ self.error(self.data_root, "no repository directories containing metadata.json found")
167
+ return []
168
+
169
+ for repo_dir in repo_dirs:
170
+ stats = self._validate_repo(repo_dir)
171
+ if stats is not None:
172
+ self.stats.append(stats)
173
+ return self.stats
174
+
175
+ def _validate_repo(self, repo_dir: Path) -> RepoStats | None:
176
+ milestone_rows = self._read_csv(
177
+ repo_dir / "milestones.csv",
178
+ required_columns={"id", "src_loc", "src_additions", "src_deletions"},
179
+ required=True,
180
+ )
181
+ if milestone_rows is None:
182
+ return None
183
+
184
+ milestones: dict[str, dict[str, str]] = {}
185
+ for lineno, row in enumerate(milestone_rows, 2):
186
+ milestone_id = (row.get("id") or "").strip()
187
+ if not milestone_id:
188
+ self.error(repo_dir / "milestones.csv", f"line {lineno}: empty milestone ID")
189
+ continue
190
+ if milestone_id in milestones:
191
+ self.error(repo_dir / "milestones.csv", f"duplicate milestone ID {milestone_id!r}")
192
+ continue
193
+ milestones[milestone_id] = row
194
+ self._validate_loc_fields(repo_dir / "milestones.csv", lineno, milestone_id, row)
195
+
196
+ catalog = set(milestones)
197
+ if not catalog:
198
+ self.error(repo_dir / "milestones.csv", "catalog is empty")
199
+ return None
200
+
201
+ selected_path = repo_dir / "selected_milestone_ids.txt"
202
+ if selected_path.exists():
203
+ active_list = self._read_id_file(selected_path)
204
+ active = set(active_list)
205
+ if not active:
206
+ self.error(selected_path, "selected milestone set is empty")
207
+ else:
208
+ active = set(catalog)
209
+ self.info(repo_dir, "selected_milestone_ids.txt absent; active set defaults to catalog")
210
+
211
+ unknown_active = active - catalog
212
+ if unknown_active:
213
+ self.error(
214
+ selected_path,
215
+ f"active IDs missing from milestones.csv: {sorted(unknown_active)}",
216
+ )
217
+
218
+ non_graded_path = repo_dir / "non-graded_milestone_ids.txt"
219
+ non_graded = set(self._read_id_file(non_graded_path)) if non_graded_path.exists() else set()
220
+ unknown_non_graded = non_graded - active
221
+ if unknown_non_graded:
222
+ self.error(
223
+ non_graded_path,
224
+ f"non-graded IDs are not active: {sorted(unknown_non_graded)}",
225
+ )
226
+ graded = active - non_graded
227
+ if not graded:
228
+ self.error(repo_dir, "graded milestone set is empty")
229
+
230
+ self._validate_metadata(repo_dir / "metadata.json", active)
231
+ self._validate_artifact_directories(repo_dir, catalog)
232
+
233
+ classifications: dict[str, dict[str, set[str]]] = {}
234
+ for milestone_id in sorted(active):
235
+ self._validate_srs(repo_dir, milestone_id)
236
+ stable_ids = self._validate_classification(repo_dir, milestone_id)
237
+ if stable_ids is not None:
238
+ classifications[milestone_id] = stable_ids
239
+
240
+ for milestone_id, stable_ids in classifications.items():
241
+ self._validate_filter(repo_dir, milestone_id, stable_ids)
242
+
243
+ dependency_result = self._validate_dependencies(repo_dir, catalog, active)
244
+ (
245
+ base_active_count,
246
+ additional_active_count,
247
+ effective_edges,
248
+ strong_count,
249
+ weak_count,
250
+ roots,
251
+ leaves,
252
+ max_depth,
253
+ ) = dependency_result
254
+
255
+ src_locs = [
256
+ self._parse_nonnegative_int(milestones[mid].get("src_loc"))
257
+ for mid in sorted(graded)
258
+ if mid in milestones
259
+ ]
260
+ valid_src_locs = [value for value in src_locs if value is not None]
261
+ if len(valid_src_locs) != len(graded):
262
+ self.error(repo_dir / "milestones.csv", "cannot compute graded src_loc statistics")
263
+ graded_src_loc = sum(valid_src_locs)
264
+ graded_src_loc_cv = coefficient_of_variation(valid_src_locs)
265
+
266
+ return RepoStats(
267
+ repo=repo_dir.name,
268
+ catalog_milestones=len(catalog),
269
+ active_milestones=len(active),
270
+ graded_milestones=len(graded),
271
+ non_graded_milestones=len(non_graded),
272
+ base_active_dependencies=base_active_count,
273
+ additional_active_dependencies=additional_active_count,
274
+ active_dependencies=len(effective_edges),
275
+ strong_dependencies=strong_count,
276
+ weak_dependencies=weak_count,
277
+ graded_src_loc=graded_src_loc,
278
+ graded_src_loc_cv=graded_src_loc_cv,
279
+ roots=roots,
280
+ leaves=leaves,
281
+ max_depth_edges=max_depth,
282
+ )
283
+
284
+ def _read_csv(
285
+ self,
286
+ path: Path,
287
+ required_columns: set[str],
288
+ *,
289
+ required: bool,
290
+ ) -> list[dict[str, str]] | None:
291
+ if not path.exists():
292
+ if required:
293
+ self.error(path, "required CSV file is missing")
294
+ return None
295
+ try:
296
+ with path.open(newline="", encoding="utf-8-sig") as handle:
297
+ reader = csv.DictReader(handle)
298
+ columns = set(reader.fieldnames or [])
299
+ missing = required_columns - columns
300
+ if missing:
301
+ self.error(path, f"missing required columns: {sorted(missing)}")
302
+ return [dict(row) for row in reader]
303
+ except (OSError, UnicodeError, csv.Error) as exc:
304
+ self.error(path, f"failed to parse CSV: {exc}")
305
+ return None
306
+
307
+ def _read_id_file(self, path: Path) -> list[str]:
308
+ try:
309
+ lines = path.read_text(encoding="utf-8").splitlines()
310
+ except (OSError, UnicodeError) as exc:
311
+ self.error(path, f"failed to read ID file: {exc}")
312
+ return []
313
+ ids = [line.strip() for line in lines if line.strip() and not line.lstrip().startswith("#")]
314
+ duplicates = sorted(value for value, count in Counter(ids).items() if count > 1)
315
+ if duplicates:
316
+ self.error(path, f"duplicate IDs: {duplicates}")
317
+ return ids
318
+
319
+ def _read_json(self, path: Path) -> Any | None:
320
+ if not path.exists():
321
+ self.error(path, "required JSON file is missing")
322
+ return None
323
+ try:
324
+ return json.loads(path.read_text(encoding="utf-8"))
325
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
326
+ self.error(path, f"failed to parse JSON: {exc}")
327
+ return None
328
+
329
+ def _validate_loc_fields(
330
+ self,
331
+ path: Path,
332
+ lineno: int,
333
+ milestone_id: str,
334
+ row: dict[str, str],
335
+ ) -> None:
336
+ values: dict[str, int] = {}
337
+ for key in ("src_loc", "src_additions", "src_deletions"):
338
+ value = self._parse_nonnegative_int(row.get(key))
339
+ if value is None:
340
+ self.error(path, f"line {lineno} ({milestone_id}): {key} must be a non-negative integer")
341
+ else:
342
+ values[key] = value
343
+ if len(values) == 3 and values["src_loc"] != values["src_additions"] + values["src_deletions"]:
344
+ self.error(
345
+ path,
346
+ f"line {lineno} ({milestone_id}): src_loc != src_additions + src_deletions",
347
+ )
348
+
349
+ @staticmethod
350
+ def _parse_nonnegative_int(raw: Any) -> int | None:
351
+ if isinstance(raw, bool):
352
+ return None
353
+ try:
354
+ value = int(str(raw).strip())
355
+ except (TypeError, ValueError):
356
+ return None
357
+ return value if value >= 0 else None
358
+
359
+ def _validate_metadata(self, path: Path, active: set[str]) -> None:
360
+ metadata = self._read_json(path)
361
+ if not isinstance(metadata, dict):
362
+ if metadata is not None:
363
+ self.error(path, "metadata root must be an object")
364
+ return
365
+ raw_milestones = metadata.get("milestones")
366
+ if not isinstance(raw_milestones, list):
367
+ self.error(path, "metadata.milestones must be an array")
368
+ return
369
+ metadata_ids: list[str] = []
370
+ for index, item in enumerate(raw_milestones):
371
+ if not isinstance(item, dict) or not isinstance(item.get("id"), str) or not item["id"].strip():
372
+ self.error(path, f"metadata.milestones[{index}] must contain a non-empty string ID")
373
+ continue
374
+ metadata_ids.append(item["id"].strip())
375
+ duplicates = sorted(value for value, count in Counter(metadata_ids).items() if count > 1)
376
+ if duplicates:
377
+ self.error(path, f"duplicate metadata milestone IDs: {duplicates}")
378
+ missing_active = active - set(metadata_ids)
379
+ if missing_active:
380
+ self.error(path, f"active IDs missing from metadata.milestones: {sorted(missing_active)}")
381
+ total = metadata.get("total_milestones")
382
+ if total != len(metadata_ids):
383
+ self.error(path, f"total_milestones={total!r}, expected {len(metadata_ids)}")
384
+
385
+ def _validate_artifact_directories(self, repo_dir: Path, catalog: set[str]) -> None:
386
+ for dirname in ("srs", "test_results"):
387
+ root = repo_dir / dirname
388
+ if not root.is_dir():
389
+ self.error(root, "required directory is missing")
390
+ continue
391
+ unknown = sorted(path.name for path in root.iterdir() if path.is_dir() and path.name not in catalog)
392
+ if unknown:
393
+ self.error(root, f"directories reference IDs outside catalog: {unknown}")
394
+
395
+ def _validate_srs(self, repo_dir: Path, milestone_id: str) -> None:
396
+ path = repo_dir / "srs" / milestone_id / "SRS.md"
397
+ if not path.is_file():
398
+ self.error(path, "active milestone SRS is missing")
399
+ return
400
+ try:
401
+ if not path.read_text(encoding="utf-8").strip():
402
+ self.error(path, "SRS is empty")
403
+ except (OSError, UnicodeError) as exc:
404
+ self.error(path, f"failed to read SRS: {exc}")
405
+
406
+ def _validate_classification(
407
+ self,
408
+ repo_dir: Path,
409
+ milestone_id: str,
410
+ ) -> dict[str, set[str]] | None:
411
+ path = repo_dir / "test_results" / milestone_id / f"{milestone_id}_classification.json"
412
+ payload = self._read_json(path)
413
+ if not isinstance(payload, dict):
414
+ if payload is not None:
415
+ self.error(path, "classification root must be an object")
416
+ return None
417
+
418
+ summary = payload.get("summary")
419
+ if not isinstance(summary, dict):
420
+ self.error(path, "summary must be an object")
421
+ else:
422
+ for key, value in summary.items():
423
+ if isinstance(value, bool) or not isinstance(value, int) or value < 0:
424
+ self.error(path, f"summary.{key} must be a non-negative integer")
425
+
426
+ parsed: dict[str, dict[str, set[str]]] = {}
427
+ for section_name in ("classification", "stable_classification"):
428
+ section = payload.get(section_name)
429
+ if not isinstance(section, dict):
430
+ self.error(path, f"{section_name} must be an object")
431
+ continue
432
+ missing = sorted(set(CLASSIFICATION_CATEGORIES) - set(section))
433
+ if missing:
434
+ self.error(path, f"{section_name} missing categories: {missing}")
435
+ section_ids: dict[str, set[str]] = {}
436
+ for category in CLASSIFICATION_CATEGORIES:
437
+ values = section.get(category)
438
+ if not isinstance(values, list):
439
+ self.error(path, f"{section_name}.{category} must be an array")
440
+ section_ids[category] = set()
441
+ continue
442
+ aggregate = category in AGGREGATE_CATEGORIES
443
+ ids = self._validate_test_items(path, f"{section_name}.{category}", values, aggregate)
444
+ section_ids[category] = ids
445
+ parsed[section_name] = section_ids
446
+
447
+ full = parsed.get("classification")
448
+ stable = parsed.get("stable_classification")
449
+ if full is None or stable is None:
450
+ return None
451
+ for category in CLASSIFICATION_CATEGORIES:
452
+ outside = stable[category] - full[category]
453
+ if outside:
454
+ self.error(
455
+ path,
456
+ f"stable_classification.{category} contains {len(outside)} IDs absent from classification",
457
+ )
458
+
459
+ expected_new = stable["none_to_pass"] | stable["none_to_fail"] | stable["none_to_skipped"]
460
+ if stable["new_tests"] != expected_new:
461
+ self.warning(path, "stable new_tests does not equal the union of stable none_to_* categories")
462
+ expected_removed = stable["pass_to_none"] | stable["fail_to_none"] | stable["skipped_to_none"]
463
+ if stable["removed_tests"] != expected_removed:
464
+ self.warning(path, "stable removed_tests does not equal the union of stable *_to_none categories")
465
+ return stable
466
+
467
+ def _validate_test_items(
468
+ self,
469
+ path: Path,
470
+ label: str,
471
+ values: list[Any],
472
+ aggregate: bool,
473
+ ) -> set[str]:
474
+ ids: list[str] = []
475
+ for index, item in enumerate(values):
476
+ if aggregate:
477
+ if not isinstance(item, dict):
478
+ self.error(path, f"{label}[{index}] must be an object with test_id")
479
+ continue
480
+ test_id = item.get("test_id")
481
+ else:
482
+ if not isinstance(item, str):
483
+ self.error(path, f"{label}[{index}] must be a string test ID")
484
+ continue
485
+ test_id = item
486
+ if not isinstance(test_id, str) or not test_id.strip():
487
+ self.error(path, f"{label}[{index}] has an empty or invalid test_id")
488
+ continue
489
+ ids.append(test_id)
490
+ duplicates = sorted(value for value, count in Counter(ids).items() if count > 1)
491
+ if duplicates:
492
+ self.error(path, f"{label} contains {len(duplicates)} duplicate test IDs")
493
+ return set(ids)
494
+
495
+ def _validate_filter(
496
+ self,
497
+ repo_dir: Path,
498
+ milestone_id: str,
499
+ stable: dict[str, set[str]],
500
+ ) -> None:
501
+ path = repo_dir / "test_results" / milestone_id / f"{milestone_id}_filter_list.json"
502
+ if not path.exists():
503
+ return
504
+ payload = self._read_json(path)
505
+ if not isinstance(payload, dict):
506
+ if payload is not None:
507
+ self.error(path, "filter root must be an object")
508
+ return
509
+ unknown_keys = sorted(set(payload) - set(FILTER_KEYS))
510
+ if unknown_keys:
511
+ self.error(path, f"unknown filter keys: {unknown_keys}")
512
+ for required_key in FILTER_KEYS[:2]:
513
+ if required_key not in payload:
514
+ self.error(path, f"missing required filter key {required_key!r}")
515
+
516
+ parsed: dict[str, set[str]] = {}
517
+ for key in FILTER_KEYS:
518
+ values = payload.get(key, [])
519
+ if not isinstance(values, list):
520
+ self.error(path, f"{key} must be an array, not {type(values).__name__}")
521
+ parsed[key] = set()
522
+ continue
523
+ parsed[key] = self._validate_filter_items(path, key, values)
524
+
525
+ functional = parsed["invalid_fail_to_pass"] | parsed["invalid_none_to_pass"]
526
+ stable_functional = stable["fail_to_pass"] | stable["none_to_pass"]
527
+ stale_functional = functional - stable_functional
528
+ if stale_functional:
529
+ self.error(
530
+ path,
531
+ f"{len(stale_functional)} functional filter IDs are absent from stable F2P/N2P",
532
+ )
533
+ stale_p2p = parsed["invalid_pass_to_pass"] - stable["pass_to_pass"]
534
+ if stale_p2p:
535
+ self.error(path, f"{len(stale_p2p)} P2P filter IDs are absent from stable P2P")
536
+ def _validate_filter_items(self, path: Path, label: str, values: list[Any]) -> set[str]:
537
+ ids: list[str] = []
538
+ for index, item in enumerate(values):
539
+ if isinstance(item, str):
540
+ test_id = item
541
+ elif isinstance(item, dict):
542
+ test_id = item.get("test_id")
543
+ reason = item.get("reason")
544
+ if reason is not None and not isinstance(reason, str):
545
+ self.error(path, f"{label}[{index}].reason must be a string when present")
546
+ else:
547
+ self.error(path, f"{label}[{index}] must be a string or object")
548
+ continue
549
+ if not isinstance(test_id, str) or not test_id.strip():
550
+ self.error(path, f"{label}[{index}] has an empty or invalid test_id")
551
+ continue
552
+ ids.append(test_id)
553
+ duplicates = sorted(value for value, count in Counter(ids).items() if count > 1)
554
+ if duplicates:
555
+ self.error(path, f"{label} contains {len(duplicates)} duplicate test IDs")
556
+ return set(ids)
557
+
558
+ def _validate_dependencies(
559
+ self,
560
+ repo_dir: Path,
561
+ catalog: set[str],
562
+ active: set[str],
563
+ ) -> tuple[int, int, dict[tuple[str, str], dict[str, str]], int, int, int, int, int]:
564
+ base_rows = self._read_csv(
565
+ repo_dir / "dependencies.csv",
566
+ required_columns=REQUIRED_DEPENDENCY_COLUMNS,
567
+ required=True,
568
+ ) or []
569
+ additional_rows = self._read_csv(
570
+ repo_dir / "additional_dependencies.csv",
571
+ required_columns=REQUIRED_DEPENDENCY_COLUMNS,
572
+ required=False,
573
+ ) or []
574
+
575
+ effective: dict[tuple[str, str], dict[str, str]] = {}
576
+ edge_origins: dict[tuple[str, str], str] = {}
577
+ active_to_inactive_count = 0
578
+ base_active_count = 0
579
+ additional_active_count = 0
580
+ for origin, rows in (("dependencies.csv", base_rows), ("additional_dependencies.csv", additional_rows)):
581
+ for lineno, row in enumerate(rows, 2):
582
+ path = repo_dir / origin
583
+ source = (row.get("source_id") or "").strip()
584
+ target = (row.get("target_id") or "").strip()
585
+ if not source or not target:
586
+ self.error(path, f"line {lineno}: dependency endpoints must be non-empty")
587
+ continue
588
+ edge = (source, target)
589
+ if source == target:
590
+ self.error(path, f"line {lineno}: self-loop {source!r}")
591
+ unknown = sorted({source, target} - catalog)
592
+ if unknown:
593
+ self.error(path, f"line {lineno}: endpoints missing from catalog: {unknown}")
594
+ strength = (row.get("strength") or "").strip().lower()
595
+ if strength not in {"strong", "weak"}:
596
+ self.error(path, f"line {lineno}: strength must be Strong or Weak")
597
+ confidence_raw = (row.get("confidence_score") or "").strip()
598
+ try:
599
+ confidence = float(confidence_raw)
600
+ if not 0.0 <= confidence <= 1.0:
601
+ raise ValueError
602
+ except ValueError:
603
+ self.error(path, f"line {lineno}: confidence_score must be in [0, 1]")
604
+
605
+ if source not in active and target in active:
606
+ self.error(path, f"line {lineno}: inactive prerequisite {source!r} targets active {target!r}")
607
+ elif source in active and target not in active:
608
+ active_to_inactive_count += 1
609
+
610
+ if edge in edge_origins:
611
+ self.error(
612
+ path,
613
+ f"line {lineno}: duplicate edge {source!r} -> {target!r}; first seen in {edge_origins[edge]}",
614
+ )
615
+ continue
616
+ edge_origins[edge] = f"{origin}:{lineno}"
617
+
618
+ if source in active and target in active:
619
+ effective[edge] = row
620
+ if origin == "dependencies.csv":
621
+ base_active_count += 1
622
+ else:
623
+ additional_active_count += 1
624
+
625
+ if active_to_inactive_count:
626
+ self.info(
627
+ repo_dir,
628
+ f"excluded {active_to_inactive_count} active-to-inactive dependency edge(s)",
629
+ )
630
+
631
+ roots, leaves, max_depth = self._validate_active_dag(repo_dir, active, effective)
632
+ strengths = Counter((row.get("strength") or "").strip().lower() for row in effective.values())
633
+ return (
634
+ base_active_count,
635
+ additional_active_count,
636
+ effective,
637
+ strengths["strong"],
638
+ strengths["weak"],
639
+ roots,
640
+ leaves,
641
+ max_depth,
642
+ )
643
+
644
+ def _validate_active_dag(
645
+ self,
646
+ repo_dir: Path,
647
+ active: set[str],
648
+ edges: dict[tuple[str, str], dict[str, str]],
649
+ ) -> tuple[int, int, int]:
650
+ indegree = {node: 0 for node in active}
651
+ successors = {node: [] for node in active}
652
+ for source, target in edges:
653
+ indegree[target] += 1
654
+ successors[source].append(target)
655
+ roots = sorted(node for node, count in indegree.items() if count == 0)
656
+ leaves = sorted(node for node, targets in successors.items() if not targets)
657
+ queue = deque(roots)
658
+ remaining = dict(indegree)
659
+ depth = {node: 0 for node in active}
660
+ ordered = 0
661
+ while queue:
662
+ node = queue.popleft()
663
+ ordered += 1
664
+ for target in successors[node]:
665
+ depth[target] = max(depth[target], depth[node] + 1)
666
+ remaining[target] -= 1
667
+ if remaining[target] == 0:
668
+ queue.append(target)
669
+ if ordered != len(active):
670
+ cyclic = sorted(node for node, count in remaining.items() if count > 0)
671
+ self.error(repo_dir, f"effective active DAG contains a cycle involving: {cyclic}")
672
+ return len(roots), len(leaves), max(depth.values(), default=0)
673
+
674
+
675
+ def coefficient_of_variation(values: Sequence[int]) -> float:
676
+ if not values:
677
+ return 0.0
678
+ mean = statistics.fmean(values)
679
+ if mean == 0:
680
+ return 0.0
681
+ return statistics.pstdev(values) / mean
682
+
683
+
684
+ def ordered_stats(stats: Iterable[RepoStats]) -> list[RepoStats]:
685
+ by_repo = {item.repo: item for item in stats}
686
+ ordered = [by_repo[name] for name in README_REPO_INFO if name in by_repo]
687
+ ordered.extend(by_repo[name] for name in sorted(set(by_repo) - set(README_REPO_INFO)))
688
+ return ordered
689
+
690
+
691
+ def render_readme_stats(stats: Sequence[RepoStats]) -> str:
692
+ rows = ordered_stats(stats)
693
+ repo_count = len(rows)
694
+ graded_total = sum(row.graded_milestones for row in rows)
695
+ dependency_total = sum(row.active_dependencies for row in rows)
696
+ base_total = sum(row.base_active_dependencies for row in rows)
697
+ additional_total = sum(row.additional_active_dependencies for row in rows)
698
+ src_loc_total = sum(row.graded_src_loc for row in rows)
699
+ average_cv = statistics.fmean(row.graded_src_loc_cv for row in rows) if rows else 0.0
700
+
701
+ delta = "\u0394"
702
+ lines = [
703
+ README_BEGIN,
704
+ "",
705
+ (
706
+ f"SWE-Milestone covers **{repo_count} real-world open-source repositories** spanning "
707
+ f"5 programming languages, with **{graded_total} graded milestones**, "
708
+ f"**{dependency_total} active dependency edges** ({base_total} base + "
709
+ f"{additional_total} additional), and **{src_loc_total:,} total {delta}SrcLoC** "
710
+ "in graded gold patches."
711
+ ),
712
+ "",
713
+ f"| Repository | Language | Version Range | #Milestones | #Deps | {delta}SrcLoC | Src LoC CV |",
714
+ "|-----------|----------|---------------|:-----------:|:-----:|---------:|:----------:|",
715
+ ]
716
+ for row in rows:
717
+ display, language, version = README_REPO_INFO.get(row.repo, (f"`{row.repo}`", "-", "-"))
718
+ lines.append(
719
+ f"| {display} | {language} | {version} | {row.graded_milestones} | "
720
+ f"{row.active_dependencies} | {row.graded_src_loc:,} | {row.graded_src_loc_cv:.2f} |"
721
+ )
722
+
723
+ if rows:
724
+ average_milestones = graded_total / repo_count
725
+ average_dependencies = dependency_total / repo_count
726
+ average_src_loc = src_loc_total / repo_count
727
+ else:
728
+ average_milestones = average_dependencies = average_src_loc = 0.0
729
+ milestone_display = (
730
+ f"{average_milestones:.0f}"
731
+ if average_milestones.is_integer()
732
+ else f"{average_milestones:.1f}"
733
+ )
734
+ lines.extend(
735
+ [
736
+ (
737
+ f"| **Average** | | | **{milestone_display}** | **{average_dependencies:.1f}** | "
738
+ f"**{average_src_loc:,.0f}** | **{average_cv:.2f}** |"
739
+ ),
740
+ "",
741
+ "**Column definitions:**",
742
+ "- **#Milestones** - Number of graded milestones: active milestones excluding IDs in "
743
+ "`non-graded_milestone_ids.txt`.",
744
+ "- **#Deps** - Number of unique edges in the active DAG. It combines `dependencies.csv` "
745
+ "and `additional_dependencies.csv`, then keeps edges whose two endpoints are active. "
746
+ "Non-graded milestones remain part of this DAG because the agent still implements them.",
747
+ f"- **{delta}SrcLoC** - Sum of `src_loc` over graded milestones only. `src_loc` equals "
748
+ "`src_additions + src_deletions` and excludes test-only changes according to each repository's metadata.",
749
+ "- **Src LoC CV** - Population coefficient of variation (`pstdev / mean`) of graded "
750
+ "milestone `src_loc` values.",
751
+ "- **Active milestones** - IDs from `selected_milestone_ids.txt` when that file exists; "
752
+ "otherwise every ID in `milestones.csv`.",
753
+ "",
754
+ README_END,
755
+ ]
756
+ )
757
+ return "\n".join(lines)
758
+
759
+
760
+ def update_readme(readme_path: Path, block: str) -> None:
761
+ text = readme_path.read_text(encoding="utf-8")
762
+ if README_BEGIN in text and README_END in text:
763
+ start = text.index(README_BEGIN)
764
+ end = text.index(README_END, start) + len(README_END)
765
+ updated = text[:start] + block + text[end:]
766
+ else:
767
+ heading = "## Dataset Statistics"
768
+ next_heading = "## Dataset Structure"
769
+ heading_pos = text.find(heading)
770
+ if heading_pos < 0:
771
+ raise ValueError(f"README is missing {heading!r}")
772
+ content_start = text.find("\n", heading_pos + len(heading))
773
+ section_end = text.find(f"\n{next_heading}", content_start)
774
+ if content_start < 0 or section_end < 0:
775
+ raise ValueError("could not locate Dataset Statistics section boundaries")
776
+ updated = text[: content_start + 1] + "\n" + block + "\n" + text[section_end:]
777
+ if not updated.endswith("\n"):
778
+ updated += "\n"
779
+ readme_path.write_text(updated, encoding="utf-8")
780
+
781
+
782
+ def check_readme(readme_path: Path, expected_block: str) -> str | None:
783
+ try:
784
+ text = readme_path.read_text(encoding="utf-8")
785
+ except (OSError, UnicodeError) as exc:
786
+ return f"failed to read README: {exc}"
787
+ if README_BEGIN not in text or README_END not in text:
788
+ return "generated statistics markers are missing; run with --write-readme"
789
+ start = text.index(README_BEGIN)
790
+ end = text.index(README_END, start) + len(README_END)
791
+ actual = text[start:end]
792
+ if actual != expected_block:
793
+ return "generated statistics are stale; run with --write-readme"
794
+ return None
795
+
796
+
797
+ def build_parser() -> argparse.ArgumentParser:
798
+ default_root = Path(__file__).resolve().parents[1]
799
+ parser = argparse.ArgumentParser(description=__doc__)
800
+ parser.add_argument(
801
+ "--data-root",
802
+ type=Path,
803
+ default=default_root,
804
+ help=f"dataset root (default: {default_root})",
805
+ )
806
+ parser.add_argument(
807
+ "--write-readme",
808
+ action="store_true",
809
+ help="replace the generated Dataset Statistics block in README.md",
810
+ )
811
+ parser.add_argument(
812
+ "--skip-readme",
813
+ action="store_true",
814
+ help="do not check README.md statistics",
815
+ )
816
+ parser.add_argument("--json", action="store_true", help="emit machine-readable JSON")
817
+ parser.add_argument(
818
+ "--strict-warnings",
819
+ action="store_true",
820
+ help="return non-zero when warnings are present",
821
+ )
822
+ return parser
823
+
824
+
825
+ def main(argv: Sequence[str] | None = None) -> int:
826
+ args = build_parser().parse_args(argv)
827
+ validator = DatasetValidator(args.data_root)
828
+ stats = validator.validate()
829
+ expected_block = render_readme_stats(stats)
830
+ readme_path = args.data_root.resolve() / "README.md"
831
+
832
+ if args.write_readme:
833
+ try:
834
+ update_readme(readme_path, expected_block)
835
+ validator.info(readme_path, "updated generated Dataset Statistics block")
836
+ except (OSError, UnicodeError, ValueError) as exc:
837
+ validator.error(readme_path, f"failed to update README: {exc}")
838
+ elif not args.skip_readme:
839
+ problem = check_readme(readme_path, expected_block)
840
+ if problem:
841
+ validator.error(readme_path, problem)
842
+
843
+ counts = Counter(item.severity for item in validator.diagnostics)
844
+ summary = {
845
+ "repositories": len(stats),
846
+ "catalog_milestones": sum(item.catalog_milestones for item in stats),
847
+ "active_milestones": sum(item.active_milestones for item in stats),
848
+ "graded_milestones": sum(item.graded_milestones for item in stats),
849
+ "non_graded_milestones": sum(item.non_graded_milestones for item in stats),
850
+ "active_dependencies": sum(item.active_dependencies for item in stats),
851
+ "base_active_dependencies": sum(item.base_active_dependencies for item in stats),
852
+ "additional_active_dependencies": sum(item.additional_active_dependencies for item in stats),
853
+ "graded_src_loc": sum(item.graded_src_loc for item in stats),
854
+ "errors": counts["ERROR"],
855
+ "warnings": counts["WARNING"],
856
+ "info": counts["INFO"],
857
+ }
858
+
859
+ if args.json:
860
+ print(
861
+ json.dumps(
862
+ {
863
+ "summary": summary,
864
+ "repositories": [asdict(item) for item in ordered_stats(stats)],
865
+ "diagnostics": [asdict(item) for item in validator.diagnostics],
866
+ },
867
+ indent=2,
868
+ sort_keys=True,
869
+ )
870
+ )
871
+ else:
872
+ print(
873
+ "Dataset summary: "
874
+ f"{summary['repositories']} repos, {summary['catalog_milestones']} catalog, "
875
+ f"{summary['active_milestones']} active, {summary['graded_milestones']} graded, "
876
+ f"{summary['active_dependencies']} active dependencies "
877
+ f"({summary['base_active_dependencies']} base + "
878
+ f"{summary['additional_active_dependencies']} additional), "
879
+ f"{summary['graded_src_loc']:,} graded src_loc"
880
+ )
881
+ severity_order = {"ERROR": 0, "WARNING": 1, "INFO": 2}
882
+ for item in sorted(
883
+ validator.diagnostics,
884
+ key=lambda value: (severity_order[value.severity], value.path, value.message),
885
+ ):
886
+ print(f"{item.severity}: {item.path}: {item.message}")
887
+ print(
888
+ f"Validation result: {counts['ERROR']} error(s), "
889
+ f"{counts['WARNING']} warning(s), {counts['INFO']} info message(s)"
890
+ )
891
+
892
+ failed = counts["ERROR"] > 0 or (args.strict_warnings and counts["WARNING"] > 0)
893
+ return 1 if failed else 0
894
+
895
+
896
+ if __name__ == "__main__":
897
+ raise SystemExit(main())
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M007.1/M007.1_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M007.2/M007.2_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M008/M008_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M009/M009_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M010/M010_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M013/M013_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M014/M014_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M017/M017_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M018/M018_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M019/M019_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M020/M020_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M021/M021_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M022/M022_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M023/M023_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M025/M025_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M026/M026_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M027/M027_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }
zeromicro_go-zero_v1.6.0_v1.9.3/test_results/M028/M028_filter_list.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "invalid_fail_to_pass": null,
3
- "invalid_none_to_pass": null
4
  }
 
1
  {
2
+ "invalid_fail_to_pass": [],
3
+ "invalid_none_to_pass": []
4
  }