second-source 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. second_source-0.5.0/.github/ISSUE_TEMPLATE/bug_report.yml +29 -0
  2. second_source-0.5.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. second_source-0.5.0/.github/ISSUE_TEMPLATE/feature_request.yml +19 -0
  4. second_source-0.5.0/.github/ISSUE_TEMPLATE/wrong_verdict.yml +48 -0
  5. second_source-0.5.0/.github/pull_request_template.md +15 -0
  6. second_source-0.5.0/.github/workflows/ci.yml +41 -0
  7. second_source-0.5.0/.github/workflows/release.yml +85 -0
  8. second_source-0.5.0/.gitignore +23 -0
  9. second_source-0.5.0/.python-version +1 -0
  10. second_source-0.5.0/CHANGELOG.md +75 -0
  11. second_source-0.5.0/CODE_OF_CONDUCT.md +18 -0
  12. second_source-0.5.0/CONTRIBUTING.md +83 -0
  13. second_source-0.5.0/LICENSE +202 -0
  14. second_source-0.5.0/NOTICE +9 -0
  15. second_source-0.5.0/PKG-INFO +311 -0
  16. second_source-0.5.0/README.md +282 -0
  17. second_source-0.5.0/SECURITY.md +40 -0
  18. second_source-0.5.0/action.yml +76 -0
  19. second_source-0.5.0/docs/ARCHITECTURE.md +262 -0
  20. second_source-0.5.0/docs/action.md +148 -0
  21. second_source-0.5.0/docs/benchmark-data/run2/README.md +26 -0
  22. second_source-0.5.0/docs/benchmark-data/run2/summary.json +970 -0
  23. second_source-0.5.0/docs/benchmark-data/run2/summary.md +107 -0
  24. second_source-0.5.0/docs/benchmark.md +286 -0
  25. second_source-0.5.0/docs/packs/coding.md +234 -0
  26. second_source-0.5.0/docs/sources/github.md +96 -0
  27. second_source-0.5.0/pyproject.toml +65 -0
  28. second_source-0.5.0/scripts/check.sh +7 -0
  29. second_source-0.5.0/src/second_source/__init__.py +3 -0
  30. second_source-0.5.0/src/second_source/action/__init__.py +4 -0
  31. second_source-0.5.0/src/second_source/action/commands.py +88 -0
  32. second_source-0.5.0/src/second_source/action/event.py +89 -0
  33. second_source-0.5.0/src/second_source/action/inputs.py +118 -0
  34. second_source-0.5.0/src/second_source/action/main.py +203 -0
  35. second_source-0.5.0/src/second_source/action/publish.py +184 -0
  36. second_source-0.5.0/src/second_source/action/setup.py +143 -0
  37. second_source-0.5.0/src/second_source/action/sweep.py +85 -0
  38. second_source-0.5.0/src/second_source/action/wait.py +49 -0
  39. second_source-0.5.0/src/second_source/benchmark/__init__.py +1 -0
  40. second_source-0.5.0/src/second_source/benchmark/aidev.py +248 -0
  41. second_source-0.5.0/src/second_source/benchmark/aidev_local.py +85 -0
  42. second_source-0.5.0/src/second_source/benchmark/golden.py +314 -0
  43. second_source-0.5.0/src/second_source/benchmark/redact.py +45 -0
  44. second_source-0.5.0/src/second_source/benchmark/rescore.py +388 -0
  45. second_source-0.5.0/src/second_source/benchmark/runner.py +159 -0
  46. second_source-0.5.0/src/second_source/benchmark/sample.py +243 -0
  47. second_source-0.5.0/src/second_source/benchmark/stats.py +363 -0
  48. second_source-0.5.0/src/second_source/cli/__init__.py +1 -0
  49. second_source-0.5.0/src/second_source/cli/bench.py +427 -0
  50. second_source-0.5.0/src/second_source/cli/main.py +182 -0
  51. second_source-0.5.0/src/second_source/core/__init__.py +4 -0
  52. second_source-0.5.0/src/second_source/core/aggregate.py +102 -0
  53. second_source-0.5.0/src/second_source/core/checks.py +470 -0
  54. second_source-0.5.0/src/second_source/core/engine.py +98 -0
  55. second_source-0.5.0/src/second_source/core/evidence.py +29 -0
  56. second_source-0.5.0/src/second_source/core/expr.py +206 -0
  57. second_source-0.5.0/src/second_source/core/hashing.py +41 -0
  58. second_source-0.5.0/src/second_source/core/model.py +112 -0
  59. second_source-0.5.0/src/second_source/core/pack.py +156 -0
  60. second_source-0.5.0/src/second_source/packs/__init__.py +1 -0
  61. second_source-0.5.0/src/second_source/packs/coding/__init__.py +16 -0
  62. second_source-0.5.0/src/second_source/packs/coding/checks/ci_config_caution.yaml +23 -0
  63. second_source-0.5.0/src/second_source/packs/coding/checks/ci_result.yaml +133 -0
  64. second_source-0.5.0/src/second_source/packs/coding/checks/ci_weakening_caution.yaml +27 -0
  65. second_source-0.5.0/src/second_source/packs/coding/checks/deployed.yaml +36 -0
  66. second_source-0.5.0/src/second_source/packs/coding/checks/docs_updated.yaml +22 -0
  67. second_source-0.5.0/src/second_source/packs/coding/checks/fixes_issue.yaml +58 -0
  68. second_source-0.5.0/src/second_source/packs/coding/checks/fixes_issue_durable.yaml +60 -0
  69. second_source-0.5.0/src/second_source/packs/coding/checks/integrity_guard.yaml +34 -0
  70. second_source-0.5.0/src/second_source/packs/coding/checks/integrity_inspection.yaml +21 -0
  71. second_source-0.5.0/src/second_source/packs/coding/checks/lint_caution.yaml +22 -0
  72. second_source-0.5.0/src/second_source/packs/coding/checks/matching_jobs_caution.yaml +22 -0
  73. second_source-0.5.0/src/second_source/packs/coding/checks/not_reverted.yaml +38 -0
  74. second_source-0.5.0/src/second_source/packs/coding/checks/tests_added.yaml +25 -0
  75. second_source-0.5.0/src/second_source/packs/coding/checks/tests_added_guard.yaml +26 -0
  76. second_source-0.5.0/src/second_source/packs/coding/checks/tests_removed_caution.yaml +23 -0
  77. second_source-0.5.0/src/second_source/packs/coding/detection.py +94 -0
  78. second_source-0.5.0/src/second_source/packs/coding/diff_facts.py +665 -0
  79. second_source-0.5.0/src/second_source/packs/coding/extract.py +911 -0
  80. second_source-0.5.0/src/second_source/packs/coding/functions.py +241 -0
  81. second_source-0.5.0/src/second_source/packs/coding/pack.yaml +33 -0
  82. second_source-0.5.0/src/second_source/packs/coding/trusted_rules.yaml +50 -0
  83. second_source-0.5.0/src/second_source/pipeline.py +112 -0
  84. second_source-0.5.0/src/second_source/report/__init__.py +1 -0
  85. second_source-0.5.0/src/second_source/report/render.py +503 -0
  86. second_source-0.5.0/src/second_source/sources/__init__.py +1 -0
  87. second_source-0.5.0/src/second_source/sources/github/__init__.py +4 -0
  88. second_source-0.5.0/src/second_source/sources/github/auth.py +48 -0
  89. second_source-0.5.0/src/second_source/sources/github/cache.py +67 -0
  90. second_source-0.5.0/src/second_source/sources/github/client.py +261 -0
  91. second_source-0.5.0/src/second_source/sources/github/mappers.py +454 -0
  92. second_source-0.5.0/src/second_source/sources/github/source.py +385 -0
  93. second_source-0.5.0/src/second_source/sources/github/urls.py +51 -0
  94. second_source-0.5.0/tests/action/test_commands.py +101 -0
  95. second_source-0.5.0/tests/action/test_event.py +82 -0
  96. second_source-0.5.0/tests/action/test_inputs.py +101 -0
  97. second_source-0.5.0/tests/action/test_main.py +271 -0
  98. second_source-0.5.0/tests/action/test_publish.py +295 -0
  99. second_source-0.5.0/tests/action/test_setup.py +78 -0
  100. second_source-0.5.0/tests/action/test_sweep.py +109 -0
  101. second_source-0.5.0/tests/action/test_wait.py +96 -0
  102. second_source-0.5.0/tests/benchmark/conftest.py +84 -0
  103. second_source-0.5.0/tests/benchmark/test_aidev.py +135 -0
  104. second_source-0.5.0/tests/benchmark/test_aidev_local.py +82 -0
  105. second_source-0.5.0/tests/benchmark/test_bench_cli.py +239 -0
  106. second_source-0.5.0/tests/benchmark/test_golden.py +163 -0
  107. second_source-0.5.0/tests/benchmark/test_redact.py +43 -0
  108. second_source-0.5.0/tests/benchmark/test_rescore.py +218 -0
  109. second_source-0.5.0/tests/benchmark/test_runner.py +126 -0
  110. second_source-0.5.0/tests/benchmark/test_sample.py +162 -0
  111. second_source-0.5.0/tests/benchmark/test_stats.py +205 -0
  112. second_source-0.5.0/tests/cli/test_main.py +112 -0
  113. second_source-0.5.0/tests/conftest.py +119 -0
  114. second_source-0.5.0/tests/core/test_aggregate.py +146 -0
  115. second_source-0.5.0/tests/core/test_checks.py +279 -0
  116. second_source-0.5.0/tests/core/test_engine.py +112 -0
  117. second_source-0.5.0/tests/core/test_evidence.py +54 -0
  118. second_source-0.5.0/tests/core/test_expr.py +146 -0
  119. second_source-0.5.0/tests/core/test_hashing.py +56 -0
  120. second_source-0.5.0/tests/core/test_model.py +37 -0
  121. second_source-0.5.0/tests/core/test_pack.py +132 -0
  122. second_source-0.5.0/tests/fixtures/customer_support_demo/checks/refund_issued.yaml +29 -0
  123. second_source-0.5.0/tests/fixtures/customer_support_demo/checks/refund_stays_issued.yaml +24 -0
  124. second_source-0.5.0/tests/fixtures/customer_support_demo/pack.yaml +14 -0
  125. second_source-0.5.0/tests/fixtures/test_customer_support_suite.py +124 -0
  126. second_source-0.5.0/tests/packs/coding/golden/claims.yaml +238 -0
  127. second_source-0.5.0/tests/packs/coding/golden/real/GUIDE.md +86 -0
  128. second_source-0.5.0/tests/packs/coding/golden/real/README.md +124 -0
  129. second_source-0.5.0/tests/packs/coding/golden/real/cases.jsonl +402 -0
  130. second_source-0.5.0/tests/packs/coding/test_adversarial_text.py +104 -0
  131. second_source-0.5.0/tests/packs/coding/test_cardinal_rule.py +390 -0
  132. second_source-0.5.0/tests/packs/coding/test_checks.py +778 -0
  133. second_source-0.5.0/tests/packs/coding/test_contradiction_oracles.py +354 -0
  134. second_source-0.5.0/tests/packs/coding/test_contradiction_paths.py +45 -0
  135. second_source-0.5.0/tests/packs/coding/test_detection.py +84 -0
  136. second_source-0.5.0/tests/packs/coding/test_diff_facts.py +663 -0
  137. second_source-0.5.0/tests/packs/coding/test_extract.py +642 -0
  138. second_source-0.5.0/tests/packs/coding/test_functions.py +210 -0
  139. second_source-0.5.0/tests/packs/coding/test_golden.py +42 -0
  140. second_source-0.5.0/tests/packs/coding/test_golden_real.py +78 -0
  141. second_source-0.5.0/tests/report/test_render.py +188 -0
  142. second_source-0.5.0/tests/sources/github/test_auth.py +56 -0
  143. second_source-0.5.0/tests/sources/github/test_cache.py +58 -0
  144. second_source-0.5.0/tests/sources/github/test_client.py +251 -0
  145. second_source-0.5.0/tests/sources/github/test_mappers.py +371 -0
  146. second_source-0.5.0/tests/sources/github/test_source.py +310 -0
  147. second_source-0.5.0/tests/sources/github/test_urls.py +51 -0
  148. second_source-0.5.0/tests/test_action_yml.py +46 -0
  149. second_source-0.5.0/tests/test_pipeline.py +123 -0
  150. second_source-0.5.0/uv.lock +561 -0
@@ -0,0 +1,29 @@
1
+ name: Bug report
2
+ description: Something crashed, errored or behaved unexpectedly (other than a wrong verdict).
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: what
7
+ attributes:
8
+ label: What happened?
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: reproduce
13
+ attributes:
14
+ label: How to reproduce
15
+ description: The command you ran and, if possible, a public PR URL.
16
+ render: text
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: output
21
+ attributes:
22
+ label: Output or error
23
+ description: Never paste tokens. Second Source does not print them, but check before posting.
24
+ render: text
25
+ - type: input
26
+ id: env
27
+ attributes:
28
+ label: Version and environment
29
+ description: "`second-source --version`, Python version, OS."
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/Rarebuffalo/second-source/security/advisories/new
5
+ about: Please report security issues privately, not as public issues.
@@ -0,0 +1,19 @@
1
+ name: Idea or feature request
2
+ description: A new claim type, agent, check, domain or improvement.
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What problem would this solve?
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: idea
13
+ attributes:
14
+ label: What do you suggest?
15
+ - type: textarea
16
+ id: examples
17
+ attributes:
18
+ label: Examples
19
+ description: Real PR URLs or agent wording that show the need.
@@ -0,0 +1,48 @@
1
+ name: Wrong verdict
2
+ description: A claim was marked contradicted, verified, pending or unverifiable when it should not have been.
3
+ labels: ["wrong verdict"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks! Wrong verdicts are the most useful reports we get: each one becomes a test case.
9
+ - type: input
10
+ id: pr
11
+ attributes:
12
+ label: Pull request
13
+ description: URL of the pull request you checked.
14
+ placeholder: https://github.com/owner/repo/pull/123
15
+ validations:
16
+ required: true
17
+ - type: input
18
+ id: claim
19
+ attributes:
20
+ label: Claim
21
+ description: The claim as Second Source showed it, e.g. "Tests pass".
22
+ validations:
23
+ required: true
24
+ - type: dropdown
25
+ id: got
26
+ attributes:
27
+ label: Verdict shown
28
+ options: [contradicted, verified, pending, unverifiable, "not found (claim was missed)", "invented (text is not a claim)"]
29
+ validations:
30
+ required: true
31
+ - type: textarea
32
+ id: expected
33
+ attributes:
34
+ label: What should it be, and why?
35
+ description: Point to the evidence (CI run, changed files, issue) or the wording.
36
+ validations:
37
+ required: true
38
+ - type: textarea
39
+ id: output
40
+ attributes:
41
+ label: Output
42
+ description: Paste `second-source check <url>` output (or `--json`).
43
+ render: text
44
+ - type: input
45
+ id: version
46
+ attributes:
47
+ label: Version
48
+ description: Output of `second-source --version`.
@@ -0,0 +1,15 @@
1
+ ## What and why
2
+
3
+ <!-- What does this change, and why is it needed? Link the issue if there is one. -->
4
+
5
+ ## How it was tested
6
+
7
+ <!-- New or changed tests. For extraction changes: dev-split score before and after. -->
8
+
9
+ ## Checklist
10
+
11
+ - [ ] `./scripts/check.sh` passes
12
+ - [ ] Tests cover the change (a bug fix has a test that fails without it)
13
+ - [ ] Missing or stale evidence still gives UNVERIFIABLE, never CONTRADICTED
14
+ - [ ] Extraction changes were tuned on the dev split only
15
+ - [ ] Docs updated if behaviour or commands changed
@@ -0,0 +1,41 @@
1
+ # Continuous integration: runs the same quality gate as scripts/check.sh on every push and
2
+ # pull request, on the oldest and newest supported Python versions.
3
+ name: CI
4
+
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ pull_request:
9
+
10
+ # Least privilege: CI only needs to read the code.
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ check:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python-version: ["3.12", "3.13"]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
26
+ with:
27
+ version: "0.13.6"
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ # --locked fails if uv.lock is out of date, so dependency changes are always reviewed.
31
+ - name: Install dependencies
32
+ run: uv sync --locked
33
+
34
+ - name: Lint
35
+ run: uv run ruff check src tests
36
+
37
+ - name: Format
38
+ run: uv run ruff format --check src tests
39
+
40
+ - name: Tests
41
+ run: uv run pytest -q
@@ -0,0 +1,85 @@
1
+ # Release: a tag vX.Y.Z builds the package, publishes it to PyPI and creates the GitHub
2
+ # release. See CONTRIBUTING.md, "Releasing".
3
+ #
4
+ # PyPI uses trusted publishing (OpenID Connect): no token is stored anywhere. The "pypi"
5
+ # environment must be configured as a trusted publisher on pypi.org for this repository and
6
+ # this workflow file, and can require a manual approval before publishing.
7
+ # Every action is pinned to a commit, as the Action itself is.
8
+ name: Release
9
+
10
+ on:
11
+ push:
12
+ tags: ["v[0-9]+.[0-9]+.[0-9]+"]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ persist-credentials: false
24
+
25
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
26
+ with:
27
+ version: "0.13.6"
28
+ enable-cache: false
29
+
30
+ # The tag, the package version and the changelog must agree before anything is published.
31
+ - name: Check the version
32
+ env:
33
+ TAG: ${{ github.ref_name }}
34
+ run: |
35
+ version=$(uv run --frozen python -c "import second_source; print(second_source.__version__)")
36
+ test "v$version" = "$TAG" || { echo "::error::tag $TAG but package version $version"; exit 1; }
37
+ grep -q "^## \[$version\]" CHANGELOG.md || { echo "::error::CHANGELOG has no [$version] section"; exit 1; }
38
+
39
+ - name: Lint and test
40
+ run: ./scripts/check.sh
41
+
42
+ - name: Build
43
+ run: uv build
44
+
45
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ pypi:
51
+ needs: build
52
+ runs-on: ubuntu-latest
53
+ environment: pypi
54
+ permissions:
55
+ id-token: write # trusted publishing; nothing else
56
+ steps:
57
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
58
+ with:
59
+ name: dist
60
+ path: dist/
61
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
62
+
63
+ github-release:
64
+ needs: pypi
65
+ runs-on: ubuntu-latest
66
+ permissions:
67
+ contents: write # create the release
68
+ steps:
69
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
70
+ with:
71
+ persist-credentials: false
72
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
73
+ with:
74
+ name: dist
75
+ path: dist/
76
+ # Notes are this version's CHANGELOG section. Publishing the Action to the Marketplace is
77
+ # done by a maintainer on the release page (GitHub has no API for it).
78
+ - name: Create the release
79
+ env:
80
+ GH_TOKEN: ${{ github.token }}
81
+ TAG: ${{ github.ref_name }}
82
+ run: |
83
+ version="${TAG#v}"
84
+ awk -v v="$version" '$0 ~ "^## \\[" v "\\]" {on=1; next} /^## \[/ {on=0} on' CHANGELOG.md > notes.md
85
+ gh release create "$TAG" dist/* --title "Second Source $TAG" --notes-file notes.md --prerelease
@@ -0,0 +1,23 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .mypy_cache/
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+
12
+ # Benchmark data and caches (large, regenerated)
13
+ data/
14
+ .cache/
15
+
16
+ # Editors / OS
17
+ .idea/
18
+ .vscode/
19
+ .DS_Store
20
+
21
+ # Local-only material (internal planning documents, backups); never committed.
22
+ private/
23
+ .hypothesis/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,75 @@
1
+ # Changelog
2
+
3
+ All notable changes to Second Source. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/). Before 1.0, a minor version may change behaviour;
6
+ the GitHub Action is used through the moving major tag (`@v0`), which `second-source init`
7
+ writes for you.
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [0.5.0] - 2026-11-26
12
+
13
+ The first public release: a beta. Interfaces may change before 1.0.
14
+
15
+ ### Added
16
+ - Engine: claims → evidence → YAML + CEL checks → verdicts (VERIFIED, CONTRADICTED, PENDING,
17
+ UNVERIFIABLE), with reasons and an input hash per check. No AI model decides a verdict.
18
+ - Coding pack: "tests pass", "build succeeds", "lint passes", "tests added", "docs updated",
19
+ "fixes #N" (closed, and stayed closed), "deployed", and "the merge holds" (not reverted).
20
+ - Integrity guards: a verified claim is withdrawn when the PR skips tests, weakens its test
21
+ command or lowers a coverage gate; cautions for CI-config changes, removed tests and lint
22
+ suppressions. Guards never contradict.
23
+ - CLI: `second-source check <PR URL>`, `second-source init`, and `second-source bench`
24
+ (sample, run, summarize, facts, rescore) for the Agent Claim Truth benchmark.
25
+ - GitHub Action: one check run per PR, updated as CI finishes; daily durability sweep;
26
+ `/second-source recheck` and `/second-source dispute` commands. Advice by default: never
27
+ fails a check unless `fail-on-contradiction` is set.
28
+ - Benchmark run 2 findings (docs/benchmark.md, section 11).
29
+
30
+ - Every check ends with "Evidence at a glance" (CI on the head commit, what the change touched,
31
+ merge and revert state), also on PRs that make no claims; reasons are shown in words.
32
+ - `ignore-claims` input to switch off claim types a repository finds noisy.
33
+
34
+ ### Fixed (from the pre-launch review)
35
+ - A claim no longer shows "Waiting for CI" for hours when the commit's CI finished without a
36
+ matching job, or has no CI at all; it does wait while GitHub Actions workflows on the commit
37
+ are queued, waiting on `needs:` jobs or held for approval (Copilot and fork PRs).
38
+ - An older report no longer replaces a newer check run when runs on one PR overlap; CI
39
+ re-checks share the PR's concurrency group, comment commands are never dropped from the
40
+ queue, and one wait budget covers a whole run, within the job's timeout.
41
+ - The daily sweep keeps API requests for PR events, starts at a different PR each day, and
42
+ stops at the rate limit instead of failing; a report cut short by the rate limit is never
43
+ published.
44
+ - `second-source init` writes the Action tag that matches its own version (`@v0`).
45
+
46
+ ### Fixed (from live testing on a sandbox repository)
47
+ - A CI job GitHub reports with a conclusion but a stale `in_progress` status counts as finished.
48
+ - A check is grey, titled "(a CI job failed)", when CI failed behind a claim that is only
49
+ unverifiable ("tests pass locally", a partial run, a failure on one of two commits).
50
+ - Watched claims say what is watched: "issue closed; watching for a reopen", "not reverted so
51
+ far; watching for a revert".
52
+ - The daily sweep finds agent PRs known only from a commit trailer.
53
+
54
+ - "Fixes #N" is never contradicted in the minutes before GitHub closes the issue after the
55
+ merge (the durability check lacked the close tolerance).
56
+
57
+ ### Security (independent security review before release)
58
+ - The Action installs only its hash-locked dependencies and runs from source; it no longer
59
+ builds itself, which fetched an unpinned build backend while the write token was present.
60
+ - PR text can no longer stall a run (linear-time cleaning, bounded patterns, a 20,000-character
61
+ read per text), crash it (bounded numbers, a per-PR catch-all), or spend the repository's API
62
+ quota (at most 20 issue references, 8 CI commits and 4 deploy commits per PR; beyond that the
63
+ claims are unverifiable).
64
+ - PR text is shown inert: quotes are code spans in the check table, control characters are
65
+ stripped in terminal output, and the dispute reply never repeats the commenter's words and is
66
+ posted once per PR. The report link is no longer prefilled with a possibly private PR.
67
+ - Only a check run created by GitHub Actions is updated, and a future report time is ignored, so
68
+ a look-alike check cannot freeze the real one.
69
+ - The CLI cache never stores diff patches, and its files are owner-only. Caches written by
70
+ earlier versions may hold patches: delete `~/.cache/second-source` to remove them.
71
+ - The token is never sent to a pagination link off the API host; the job summary stays under
72
+ GitHub's 1 MiB limit.
73
+ - The Action pins `astral-sh/setup-uv` to a commit and uv to an exact version whose checksum
74
+ that release bundles, and keeps setup-uv's dependency cache off (it can be poisoned on
75
+ `pull_request_target` and `workflow_run`).
@@ -0,0 +1,18 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the
4
+ [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
5
+
6
+ In short: be respectful and constructive, assume good intent, welcome newcomers, and focus
7
+ criticism on ideas and code rather than people. Harassment, insults and personal attacks are
8
+ not tolerated in issues, pull requests, discussions or any other project space.
9
+
10
+ ## Reporting
11
+
12
+ If you experience or witness unacceptable behaviour, report it privately to the maintainers
13
+ through GitHub's private reporting on this repository (the **Security** tab, **Report a
14
+ vulnerability**, with "Code of conduct" in the title), or by contacting a maintainer directly
15
+ on GitHub. Reports are handled confidentially.
16
+
17
+ Maintainers may remove comments, commits or other contributions that break this code, and may
18
+ temporarily or permanently ban contributors whose behaviour is harmful.
@@ -0,0 +1,83 @@
1
+ # Contributing to Second Source
2
+
3
+ Thanks for helping. Second Source is early, so the most valuable contributions right now are:
4
+
5
+ - **Wrong verdicts.** A claim marked contradicted that was true, or verified that was false.
6
+ Open a "Wrong verdict" issue with the PR URL; these directly improve the rules.
7
+ - **Missed or invented claims.** Agent wording we do not recognise, or text we read as a claim
8
+ when it is not.
9
+ - **Agent detection.** New coding agents, or signals we miss for existing ones.
10
+ - **Checks and packs.** New checks for the coding pack, or a pack for a new domain.
11
+
12
+ ## Set up
13
+
14
+ Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).
15
+
16
+ ```bash
17
+ git clone https://github.com/Rarebuffalo/second-source && cd second-source
18
+ ```
19
+
20
+ ```bash
21
+ uv sync
22
+ ```
23
+
24
+ ```bash
25
+ ./scripts/check.sh
26
+ ```
27
+
28
+ `scripts/check.sh` runs ruff lint, the ruff format check and the full test suite. It must pass
29
+ before every commit, and CI runs the same checks on Python 3.12 and 3.13.
30
+
31
+ ## How we work
32
+
33
+ - **Small, focused commits.** One logical change per commit, with a message that says what
34
+ changed and why (`coding: ...`, `github: ...`, `test: ...`, `docs: ...`).
35
+ - **Tests with every change.** New behaviour gets a test; a bug fix gets a test that fails
36
+ without the fix. Tests never touch the network: use the fake GitHub API in
37
+ `tests/conftest.py`.
38
+ - **Comments explain why.** Every module starts with a docstring saying what it is for;
39
+ non-obvious code gets a short comment explaining the reason.
40
+ - **Read [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) first.** The core is domain-neutral and
41
+ pure (no network, clock or filesystem); keep coding-specific logic in `packs/coding`.
42
+
43
+ ## Changing claim extraction
44
+
45
+ Extraction rules are measured on a labelled golden set of real agent PRs
46
+ (`tests/packs/coding/golden/real/`). If you change a rule:
47
+
48
+ 1. Look at mistakes on the **dev** split only:
49
+ `uv run second-source bench golden tests/packs/coding/golden/real/cases.jsonl --split dev`.
50
+ 2. Add a unit test in `tests/packs/coding/test_extract.py` for the wording you handle.
51
+ 3. Keep precision at or above the target (0.95); `test_golden_real.py` enforces this on dev.
52
+ 4. Never tune rules on the **test** split. It exists so our published numbers stay honest.
53
+
54
+ Precision matters more than recall: a claim the agent never made can become an unfair
55
+ "contradicted" verdict.
56
+
57
+ ## Adding a check
58
+
59
+ Checks are YAML files with CEL expressions in `src/second_source/packs/coding/checks/`. Copy
60
+ an existing one, add scenario tests in `tests/packs/coding/test_checks.py`, and remember the
61
+ rule: missing or stale evidence gives `UNVERIFIABLE`, never `CONTRADICTED`.
62
+
63
+ ## Releasing (maintainers)
64
+
65
+ `second-source init` writes the Action's moving major tag (`@v0` while 0.x), so every release
66
+ must move it, or new workflows point at a tag that does not exist.
67
+
68
+ 1. Set `version` in `pyproject.toml` and `__version__` in `src/second_source/__init__.py`, run
69
+ `uv lock`, and move the `[Unreleased]` notes in `CHANGELOG.md` under `## [X.Y.Z] - date`.
70
+ 2. Run `scripts/check.sh`, commit, and push `main`.
71
+ 3. Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`. The Release workflow
72
+ (`.github/workflows/release.yml`) checks that the tag, the version and the changelog agree,
73
+ runs the tests, builds, publishes to PyPI through trusted publishing (the `pypi`
74
+ environment; no token is stored), and creates a pre-release with the changelog section.
75
+ 4. Move the major tag to the same commit: `git tag -f v0 vX.Y.Z && git push -f origin v0`.
76
+ 5. On the release page, edit the release and tick "Publish this Action to the GitHub
77
+ Marketplace" (GitHub has no API for this).
78
+ 6. Workflows pinned to a commit SHA do not get the fix; say so in the release notes.
79
+
80
+ ## Code of conduct and security
81
+
82
+ By taking part you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). Report security
83
+ issues privately as described in [SECURITY.md](SECURITY.md), not in public issues.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ Second Source
2
+ Copyright 2026 The Second Source contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This repository includes pull request texts from the AIDev dataset by Hao Li et al.
7
+ (https://huggingface.co/datasets/hao-li/AIDev), licensed under the Creative Commons
8
+ Attribution 4.0 International licence (CC-BY-4.0), in tests/packs/coding/golden/real/.
9
+ Those texts remain under CC-BY-4.0; the labels added to them are part of this product.