repopact 3.0.0__tar.gz → 3.0.1__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.

Potentially problematic release.


This version of repopact might be problematic. Click here for more details.

Files changed (55) hide show
  1. repopact-3.0.1/MANIFEST.in +2 -0
  2. {repopact-3.0.0 → repopact-3.0.1}/PKG-INFO +2 -3
  3. {repopact-3.0.0 → repopact-3.0.1}/README.md +1 -2
  4. repopact-3.0.1/VERSION +1 -0
  5. {repopact-3.0.0 → repopact-3.0.1}/pyproject.toml +1 -1
  6. {repopact-3.0.0 → repopact-3.0.1}/repopact/__init__.py +4 -2
  7. repopact-3.0.1/repopact/package_version.py +68 -0
  8. {repopact-3.0.0 → repopact-3.0.1}/repopact/release_build.py +7 -2
  9. {repopact-3.0.0 → repopact-3.0.1}/repopact/repo_model.py +11 -3
  10. {repopact-3.0.0 → repopact-3.0.1}/repopact/validate_repo.py +74 -9
  11. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/PKG-INFO +2 -3
  12. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/SOURCES.txt +2 -0
  13. {repopact-3.0.0 → repopact-3.0.1}/tests/test_release_build.py +12 -6
  14. {repopact-3.0.0 → repopact-3.0.1}/tests/test_research_metadata.py +4 -4
  15. {repopact-3.0.0 → repopact-3.0.1}/tests/test_validate_repo.py +94 -7
  16. repopact-3.0.0/VERSION +0 -1
  17. {repopact-3.0.0 → repopact-3.0.1}/LICENSE +0 -0
  18. {repopact-3.0.0 → repopact-3.0.1}/repopact/adopt_repo.py +0 -0
  19. {repopact-3.0.0 → repopact-3.0.1}/repopact/check_frozen_surface.py +0 -0
  20. {repopact-3.0.0 → repopact-3.0.1}/repopact/cli.py +0 -0
  21. {repopact-3.0.0 → repopact-3.0.1}/repopact/doctor.py +0 -0
  22. {repopact-3.0.0 → repopact-3.0.1}/repopact/fleet_verify.py +0 -0
  23. {repopact-3.0.0 → repopact-3.0.1}/repopact/frontmatter.py +0 -0
  24. {repopact-3.0.0 → repopact-3.0.1}/repopact/generate_dashboard.py +0 -0
  25. {repopact-3.0.0 → repopact-3.0.1}/repopact/generate_spec.py +0 -0
  26. {repopact-3.0.0 → repopact-3.0.1}/repopact/init_repo.py +0 -0
  27. {repopact-3.0.0 → repopact-3.0.1}/repopact/new.py +0 -0
  28. {repopact-3.0.0 → repopact-3.0.1}/repopact/plan_import.py +0 -0
  29. {repopact-3.0.0 → repopact-3.0.1}/repopact/run_conformance.py +0 -0
  30. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/adopter-fleet.schema.json +0 -0
  31. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/audit-finding.schema.json +0 -0
  32. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/conformance-manifest.schema.json +0 -0
  33. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/evidence-run.schema.json +0 -0
  34. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/frozen-surface.schema.json +0 -0
  35. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/invariants.schema.json +0 -0
  36. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/record-frontmatter.schema.json +0 -0
  37. {repopact-3.0.0 → repopact-3.0.1}/repopact/schemas/work-item.schema.json +0 -0
  38. {repopact-3.0.0 → repopact-3.0.1}/repopact/takeover.py +0 -0
  39. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/README.md +0 -0
  40. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/decision.md +0 -0
  41. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/evidence-run.json +0 -0
  42. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/policy.md +0 -0
  43. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/work-item.README.md +0 -0
  44. {repopact-3.0.0 → repopact-3.0.1}/repopact/templates/work-item.json +0 -0
  45. {repopact-3.0.0 → repopact-3.0.1}/repopact/track_import.py +0 -0
  46. {repopact-3.0.0 → repopact-3.0.1}/repopact/validate_research.py +0 -0
  47. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/dependency_links.txt +0 -0
  48. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/entry_points.txt +0 -0
  49. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/requires.txt +0 -0
  50. {repopact-3.0.0 → repopact-3.0.1}/repopact.egg-info/top_level.txt +0 -0
  51. {repopact-3.0.0 → repopact-3.0.1}/setup.cfg +0 -0
  52. {repopact-3.0.0 → repopact-3.0.1}/tests/test_conformance.py +0 -0
  53. {repopact-3.0.0 → repopact-3.0.1}/tests/test_fleet_verify.py +0 -0
  54. {repopact-3.0.0 → repopact-3.0.1}/tests/test_plan_import_links.py +0 -0
  55. {repopact-3.0.0 → repopact-3.0.1}/tests/test_takeover_refs.py +0 -0
@@ -0,0 +1,2 @@
1
+ include VERSION
2
+ include RELEASE_LABEL
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: repopact
3
- Version: 3.0.0
3
+ Version: 3.0.1
4
4
  Summary: A repository-native standard for durable agent work: binding invariants, evidence-gated work items, and drift audits.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/ForgeWireLabs/repopact
@@ -26,8 +26,7 @@ cannot be silently weakened.
26
26
  > The repository is the pact: authority, intent, evidence, and history that survive every
27
27
  > session.
28
28
 
29
- `pip install repopact` · Apache-2.0 · current release **3.0.0**
30
- ([changelog](decisions/0030-release-repopact-3-0-0-package-boundary.md)).
29
+ `pip install repopact` · Apache-2.0 · current release **3.0.1** ([changelog](decisions/0033-release-repopact-3-0-1.md)).
31
30
 
32
31
  ## How it relates to `AGENTS.md`
33
32
 
@@ -9,8 +9,7 @@ cannot be silently weakened.
9
9
  > The repository is the pact: authority, intent, evidence, and history that survive every
10
10
  > session.
11
11
 
12
- `pip install repopact` · Apache-2.0 · current release **3.0.0**
13
- ([changelog](decisions/0030-release-repopact-3-0-0-package-boundary.md)).
12
+ `pip install repopact` · Apache-2.0 · current release **3.0.1** ([changelog](decisions/0033-release-repopact-3-0-1.md)).
14
13
 
15
14
  ## How it relates to `AGENTS.md`
16
15
 
repopact-3.0.1/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.0.1
@@ -33,4 +33,4 @@ include-package-data = false
33
33
  repopact = ["schemas/*.json", "templates/*"]
34
34
 
35
35
  [tool.setuptools.dynamic]
36
- version = { file = "VERSION" }
36
+ version = { attr = "repopact.package_version.__version__" }
@@ -21,9 +21,11 @@ def _version() -> str:
21
21
  distribution metadata.
22
22
  """
23
23
  from pathlib import Path
24
- candidate = Path(__file__).resolve().parent.parent / "VERSION"
24
+ root = Path(__file__).resolve().parent.parent
25
+ candidate = root / "VERSION"
25
26
  if candidate.is_file():
26
- return candidate.read_text(encoding="utf-8").strip()
27
+ from .package_version import package_version
28
+ return package_version(root)
27
29
  from importlib.metadata import PackageNotFoundError, version
28
30
  try:
29
31
  return version("repopact")
@@ -0,0 +1,68 @@
1
+ """Derive distribution identity without weakening the VERSION compatibility core."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from pathlib import Path
7
+
8
+
9
+ SEMVER_IDENT = r"(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)"
10
+ RELEASE_LABEL_RE = re.compile(
11
+ rf"(?P<base>[0-9]+\.[0-9]+\.[0-9]+)"
12
+ rf"-(?P<prerelease>{SEMVER_IDENT}(?:\.{SEMVER_IDENT})*)"
13
+ rf"(?:\+(?P<build>[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?"
14
+ )
15
+
16
+
17
+ class PackageVersionError(ValueError):
18
+ """Raised when governed source identity cannot form package metadata."""
19
+
20
+
21
+ def semver_label_to_pep440(label: str) -> str:
22
+ """Map a valid RepoPact SemVer pre-release identity deterministically to PEP 440.
23
+
24
+ Conventional alpha/beta/rc/dev labels stay readable. Other legal SemVer
25
+ pre-releases use a lossless hexadecimal local segment so setuptools never gets
26
+ to apply an incidental, potentially ambiguous normalization.
27
+ """
28
+ match = RELEASE_LABEL_RE.fullmatch(label)
29
+ if not match:
30
+ raise PackageVersionError(f"invalid SemVer RELEASE_LABEL: {label!r}")
31
+ base = match.group("base")
32
+ prerelease = match.group("prerelease")
33
+ build = match.group("build")
34
+ conventional = re.fullmatch(r"(?P<kind>alpha|a|beta|b|rc|dev)\.(?P<num>0|[1-9][0-9]*)", prerelease)
35
+ if conventional:
36
+ kind = {"alpha": "a", "a": "a", "beta": "b", "b": "b", "rc": "rc", "dev": "dev"}[
37
+ conventional.group("kind")
38
+ ]
39
+ rendered = f"{base}{kind}{conventional.group('num')}"
40
+ if build:
41
+ rendered += "+" + build.replace("-", ".")
42
+ return rendered
43
+ encoded = label[len(base) + 1 :].encode("utf-8").hex()
44
+ return f"{base}.dev0+semver.{encoded}"
45
+
46
+
47
+ def package_version(root: Path) -> str:
48
+ """Return stable VERSION or the explicit development distribution identity."""
49
+ version_path = root / "VERSION"
50
+ if not version_path.is_file():
51
+ from importlib.metadata import PackageNotFoundError, version as distribution_version
52
+ try:
53
+ return distribution_version("repopact")
54
+ except PackageNotFoundError:
55
+ return "unknown"
56
+ version = version_path.read_text(encoding="utf-8").strip()
57
+ label_path = root / "RELEASE_LABEL"
58
+ if not label_path.is_file():
59
+ return version
60
+ label = label_path.read_text(encoding="utf-8").strip()
61
+ match = RELEASE_LABEL_RE.fullmatch(label)
62
+ if not match or match.group("base") != version:
63
+ raise PackageVersionError("RELEASE_LABEL must be a SemVer pre-release whose core equals VERSION")
64
+ return semver_label_to_pep440(label)
65
+
66
+
67
+ # setuptools' dynamic attr reader obtains this value while building from the source tree.
68
+ __version__ = package_version(Path(__file__).resolve().parent.parent)
@@ -24,6 +24,8 @@ import zipfile
24
24
  from pathlib import Path
25
25
  from typing import Any
26
26
 
27
+ from .package_version import package_version
28
+
27
29
 
28
30
  EXPECTED_SCHEMAS = 8
29
31
  EXPECTED_TEMPLATES = 6
@@ -160,6 +162,7 @@ def _build_once(root: Path, revision: str, destination: Path) -> dict[str, Any]:
160
162
  _export(root, revision, source)
161
163
  output.mkdir()
162
164
  version = (source / "VERSION").read_text(encoding="utf-8").strip()
165
+ artifact_version = package_version(source)
163
166
  epoch = _run(["git", "show", "-s", "--format=%ct", revision], cwd=root)
164
167
  env = os.environ.copy()
165
168
  env["SOURCE_DATE_EPOCH"] = epoch
@@ -178,8 +181,9 @@ def _build_once(root: Path, revision: str, destination: Path) -> dict[str, Any]:
178
181
  _normalize_sdist(sdists[0], int(epoch))
179
182
  return {
180
183
  "version": version,
181
- "wheel": inspect_wheel(wheels[0], version),
182
- "sdist": inspect_sdist(sdists[0], version),
184
+ "artifact_version": artifact_version,
185
+ "wheel": inspect_wheel(wheels[0], artifact_version),
186
+ "sdist": inspect_sdist(sdists[0], artifact_version),
183
187
  "wheel_path": wheels[0],
184
188
  "sdist_path": sdists[0],
185
189
  }
@@ -212,6 +216,7 @@ def build_release(root: Path, outdir: Path, revision: str = "HEAD") -> dict[str,
212
216
  return {
213
217
  "commit": commit,
214
218
  "version": first["version"],
219
+ "artifact_version": first["artifact_version"],
215
220
  "reproducible": True,
216
221
  "wheel": first["wheel"],
217
222
  "sdist": first["sdist"],
@@ -8,11 +8,19 @@ from typing import Any
8
8
 
9
9
  STATUSES = ("proposed", "active", "blocked", "deferred", "completed")
10
10
 
11
- # Directories that are not part of the governed tree: tooling caches and, notably,
12
- # test fixtures, which are self-contained sub-repositories validated on their own.
11
+ # Directories that are not part of the governed tree: tooling caches, test
12
+ # fixtures (self-contained sub-repositories validated on their own), and
13
+ # `worktrees` -- the conventional directory name agent tooling (Claude Code's
14
+ # Agent isolation, Codex, etc.) uses for a scratch `git worktree` checkout.
15
+ # A worktree is a second working copy of the SAME repository; its own
16
+ # AGENTS.md files are already governed at their origin and must not be
17
+ # re-validated as if they were a nested subtree of this checkout, and a
18
+ # worktree can outlive the session that created it (left on disk after an
19
+ # agent's task completes) with no reliable, portable signal other than its
20
+ # name to distinguish it from a real nested contract.
13
21
  IGNORED_PARTS = {
14
22
  ".git", "__pycache__", "node_modules", ".venv", ".pytest_cache",
15
- "build", "dist", "fixtures",
23
+ "build", "dist", "fixtures", "worktrees",
16
24
  }
17
25
 
18
26
 
@@ -17,6 +17,7 @@ import jsonschema
17
17
  from .frontmatter import FrontMatterError, parse_file
18
18
  from . import generate_dashboard
19
19
  from . import validate_research
20
+ from .package_version import RELEASE_LABEL_RE, PackageVersionError, package_version
20
21
  from .repo_model import STATUSES, discover_evidence_ids, discover_work_items, iter_contracts, load_json
21
22
 
22
23
 
@@ -121,14 +122,6 @@ def validate_version(root: Path, problems: list[Problem]) -> None:
121
122
  # is captured so it can be pinned to VERSION, then the SemVer pre-release grammar
122
123
  # (dot-separated identifiers, numeric identifiers with no leading zeros) and the
123
124
  # optional build metadata (decision 0026).
124
- _SEMVER_IDENT = r"(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)"
125
- _RELEASE_LABEL_RE = re.compile(
126
- rf"(?P<base>[0-9]+\.[0-9]+\.[0-9]+)"
127
- rf"-{_SEMVER_IDENT}(?:\.{_SEMVER_IDENT})*"
128
- rf"(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?"
129
- )
130
-
131
-
132
125
  def validate_release_label(root: Path, problems: list[Problem]) -> None:
133
126
  """Validate the optional ``RELEASE_LABEL`` product/maturity identity (decision 0026).
134
127
 
@@ -142,7 +135,7 @@ def validate_release_label(root: Path, problems: list[Problem]) -> None:
142
135
  if not path.is_file():
143
136
  return
144
137
  label = path.read_text(encoding="utf-8").strip()
145
- match = _RELEASE_LABEL_RE.fullmatch(label)
138
+ match = RELEASE_LABEL_RE.fullmatch(label)
146
139
  if not match:
147
140
  problems.append(Problem(
148
141
  path,
@@ -159,6 +152,76 @@ def validate_release_label(root: Path, problems: list[Problem]) -> None:
159
152
  ))
160
153
 
161
154
 
155
+ _PACKAGE_IDENTITY_PATHS = (
156
+ "pyproject.toml",
157
+ "README.md",
158
+ "VERSION",
159
+ "RELEASE_LABEL",
160
+ "repopact/*.py",
161
+ "repopact/schemas",
162
+ "repopact/templates",
163
+ )
164
+
165
+
166
+ def _git(root: Path, *args: str) -> subprocess.CompletedProcess[str]:
167
+ return subprocess.run(
168
+ ["git", "-C", str(root), *args],
169
+ text=True,
170
+ capture_output=True,
171
+ check=False,
172
+ )
173
+
174
+
175
+ def validate_source_artifact_identity(root: Path, problems: list[Problem]) -> None:
176
+ """Distinguish post-tag package source from an already released artifact.
177
+
178
+ Repositories without Git metadata, including portable conformance fixtures and
179
+ exported source archives, remain valid. When the stable ``vVERSION`` tag exists,
180
+ its exact package/runtime tree may remain unlabeled. Materially later source at
181
+ the same compatibility core requires RELEASE_LABEL, whose package identity is
182
+ independently derived and checked above (decision 0032).
183
+ """
184
+ version_path = root / "VERSION"
185
+ label_path = root / "RELEASE_LABEL"
186
+ if not version_path.is_file() or label_path.is_file():
187
+ return
188
+ version = version_path.read_text(encoding="utf-8").strip()
189
+ tag = f"v{version}"
190
+ resolved = _git(root, "rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
191
+ if resolved.returncode != 0:
192
+ return
193
+ changed = _git(root, "diff", "--name-only", tag, "--", *_PACKAGE_IDENTITY_PATHS)
194
+ untracked = _git(root, "ls-files", "--others", "--exclude-standard", "--", *_PACKAGE_IDENTITY_PATHS)
195
+ if changed.returncode != 0 or untracked.returncode != 0:
196
+ return
197
+ paths = sorted({line for line in (changed.stdout + untracked.stdout).splitlines() if line})
198
+ if paths:
199
+ problems.append(Problem(
200
+ label_path,
201
+ f"package/runtime source differs from released {tag} but has no RELEASE_LABEL; "
202
+ f"add a VERSION-pinned development identity (changed: {', '.join(paths)})",
203
+ ))
204
+
205
+
206
+ def validate_package_version(root: Path, problems: list[Problem]) -> None:
207
+ """Prove the governed identity can be rendered as deterministic PEP 440 metadata."""
208
+ if not (root / "VERSION").is_file():
209
+ return
210
+ label_path = root / "RELEASE_LABEL"
211
+ if label_path.is_file():
212
+ label = label_path.read_text(encoding="utf-8").strip()
213
+ version = (root / "VERSION").read_text(encoding="utf-8").strip()
214
+ match = RELEASE_LABEL_RE.fullmatch(label)
215
+ # The structural/core diagnostics belong to validate_release_label; do
216
+ # not emit a second, less actionable error for the same malformed record.
217
+ if not match or match.group("base") != version:
218
+ return
219
+ try:
220
+ package_version(root)
221
+ except (OSError, PackageVersionError) as exc:
222
+ problems.append(Problem(root / "RELEASE_LABEL", f"invalid package identity: {exc}"))
223
+
224
+
162
225
  # The README convention this rule is gated on: a release line naming the current
163
226
  # version, optionally carrying a changelog link. Both groups are optional-friendly
164
227
  # so a README that omits the line (any adopter's, typically) is simply unaffected.
@@ -883,6 +946,8 @@ def validate(root: Path) -> list[Problem]:
883
946
  problems: list[Problem] = []
884
947
  validate_version(root, problems)
885
948
  validate_release_label(root, problems)
949
+ validate_package_version(root, problems)
950
+ validate_source_artifact_identity(root, problems)
886
951
  validate_release_surface(root, problems)
887
952
  validate_contracts(root, problems)
888
953
  validate_invariants(root, problems)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: repopact
3
- Version: 3.0.0
3
+ Version: 3.0.1
4
4
  Summary: A repository-native standard for durable agent work: binding invariants, evidence-gated work items, and drift audits.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/ForgeWireLabs/repopact
@@ -26,8 +26,7 @@ cannot be silently weakened.
26
26
  > The repository is the pact: authority, intent, evidence, and history that survive every
27
27
  > session.
28
28
 
29
- `pip install repopact` · Apache-2.0 · current release **3.0.0**
30
- ([changelog](decisions/0030-release-repopact-3-0-0-package-boundary.md)).
29
+ `pip install repopact` · Apache-2.0 · current release **3.0.1** ([changelog](decisions/0033-release-repopact-3-0-1.md)).
31
30
 
32
31
  ## How it relates to `AGENTS.md`
33
32
 
@@ -1,4 +1,5 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  VERSION
4
5
  pyproject.toml
@@ -13,6 +14,7 @@ repopact/generate_dashboard.py
13
14
  repopact/generate_spec.py
14
15
  repopact/init_repo.py
15
16
  repopact/new.py
17
+ repopact/package_version.py
16
18
  repopact/plan_import.py
17
19
  repopact/release_build.py
18
20
  repopact/repo_model.py
@@ -10,22 +10,28 @@ import zipfile
10
10
  from pathlib import Path
11
11
 
12
12
  from repopact import release_build
13
+ from repopact.package_version import semver_label_to_pep440
13
14
 
14
15
 
15
16
  ROOT = Path(__file__).resolve().parents[1]
16
17
 
17
18
 
18
19
  class ReleaseBuildTests(unittest.TestCase):
20
+ def test_release_label_maps_deterministically_to_pep440(self) -> None:
21
+ self.assertEqual("3.0.1rc1", semver_label_to_pep440("3.0.1-rc.1"))
22
+ first = semver_label_to_pep440("3.0.1-preview.1+windows")
23
+ self.assertEqual(first, semver_label_to_pep440("3.0.1-preview.1+windows"))
24
+ self.assertNotEqual("3.0.1", first)
19
25
  def _wheel(self, root: Path, *, flat_module: bool = False) -> Path:
20
- path = root / "repopact-3.0.0-py3-none-any.whl"
26
+ path = root / "repopact-3.0.1-py3-none-any.whl"
21
27
  with zipfile.ZipFile(path, "w") as archive:
22
28
  archive.writestr("repopact/__init__.py", "")
23
29
  for index in range(release_build.EXPECTED_SCHEMAS):
24
30
  archive.writestr(f"repopact/schemas/{index}.json", "{}")
25
31
  for index in range(release_build.EXPECTED_TEMPLATES):
26
32
  archive.writestr(f"repopact/templates/{index}.txt", "")
27
- archive.writestr("repopact-3.0.0.dist-info/top_level.txt", "repopact\n")
28
- archive.writestr("repopact-3.0.0.dist-info/METADATA", "Version: 3.0.0\n")
33
+ archive.writestr("repopact-3.0.1.dist-info/top_level.txt", "repopact\n")
34
+ archive.writestr("repopact-3.0.1.dist-info/METADATA", "Version: 3.0.1\n")
29
35
  if flat_module:
30
36
  archive.writestr("frontmatter.py", "")
31
37
  return path
@@ -34,7 +40,7 @@ class ReleaseBuildTests(unittest.TestCase):
34
40
  with tempfile.TemporaryDirectory() as temporary:
35
41
  report = release_build.inspect_wheel(
36
42
  self._wheel(Path(temporary)),
37
- "3.0.0",
43
+ "3.0.1",
38
44
  )
39
45
  self.assertEqual(["repopact"], report["import_roots"])
40
46
  self.assertEqual(0, report["data_files"])
@@ -46,7 +52,7 @@ class ReleaseBuildTests(unittest.TestCase):
46
52
  release_build.ReleaseBuildError,
47
53
  "import roots.*frontmatter.py",
48
54
  ):
49
- release_build.inspect_wheel(path, "3.0.0")
55
+ release_build.inspect_wheel(path, "3.0.1")
50
56
 
51
57
  def test_export_creates_nested_temporary_parent(self) -> None:
52
58
  with tempfile.TemporaryDirectory() as temporary:
@@ -59,7 +65,7 @@ class ReleaseBuildTests(unittest.TestCase):
59
65
  with path.open("wb") as raw:
60
66
  with gzip.GzipFile(filename="", mode="wb", fileobj=raw, mtime=timestamp) as compressed:
61
67
  with tarfile.open(fileobj=compressed, mode="w") as archive:
62
- member = tarfile.TarInfo("repopact-3.0.0/README.md")
68
+ member = tarfile.TarInfo("repopact-3.0.1/README.md")
63
69
  member.size = 5
64
70
  member.mtime = timestamp
65
71
  archive.addfile(member, io.BytesIO(b"hello"))
@@ -41,8 +41,8 @@ class ResearchMetadataTests(unittest.TestCase):
41
41
  self.assertEqual([], self.messages())
42
42
 
43
43
  def test_expired_research_claim_contract_is_rejected(self) -> None:
44
- problems = validate_research.validate(self.root, today=date(2026, 8, 10))
45
- self.assertTrue(any("freshness expired on 2026-08-09" in p.message for p in problems))
44
+ problems = validate_research.validate(self.root, today=date(2026, 9, 19))
45
+ self.assertTrue(any("freshness expired on 2026-09-18" in p.message for p in problems))
46
46
 
47
47
  def test_unregistered_research_claim_document_is_rejected(self) -> None:
48
48
  (self.root / "research" / "new-claim.md").write_text(
@@ -66,8 +66,8 @@ class ResearchMetadataTests(unittest.TestCase):
66
66
  self.assertTrue(any("expected 24; observed 21" in message for message in self.messages()))
67
67
 
68
68
  def test_stale_hypothesis_range_is_rejected(self) -> None:
69
- self.replace("research/benchmark-protocol.md", "H8–H13", "H8–H10")
70
- self.assertTrue(any("expected H8–H13; observed H8–H10" in message for message in self.messages()))
69
+ self.replace("research/benchmark-protocol.md", "H8–H14", "H8–H10")
70
+ self.assertTrue(any("expected H8–H14; observed H8–H10" in message for message in self.messages()))
71
71
 
72
72
  def test_future_provenance_wording_is_rejected(self) -> None:
73
73
  self.replace(
@@ -29,19 +29,55 @@ from repopact.validate_repo import validate # noqa: E402
29
29
 
30
30
 
31
31
  class RepositoryValidationTests(unittest.TestCase):
32
+ READ_ONLY_TESTS = {
33
+ "test_repository_is_valid",
34
+ "test_dashboard_generation_is_stable_between_audit_transitions",
35
+ "test_readme_without_checkboxes_is_unaffected",
36
+ "test_symbol_hits_detects_protected_symbol",
37
+ "test_symbol_hits_ignores_context_lines",
38
+ "test_seed_data_uses_package_resources_not_data_files",
39
+ "test_spec_generation_is_idempotent",
40
+ "test_cli_validate_returns_zero_on_valid_repo",
41
+ "test_split_num_strips_tracker_prefix",
42
+ "test_section_lifecycle_keywords",
43
+ }
44
+ TEMP_ONLY_TESTS = {
45
+ "test_bootstrap_produces_valid_repo",
46
+ "test_bootstrap_uses_installed_tooling_instead_of_vendoring_modules",
47
+ "test_adopt_existing_repo_validates",
48
+ "test_adopt_is_non_destructive",
49
+ "test_adopt_maps_workflows_and_codeowners",
50
+ "test_adopt_dry_run_writes_nothing",
51
+ "test_adopt_warns_on_gitignored_records",
52
+ "test_import_plan_populates_and_validates",
53
+ "test_import_plan_completed_items_are_waived_not_fabricated",
54
+ "test_import_plan_is_idempotent",
55
+ "test_import_plan_dry_run_writes_nothing",
56
+ "test_tracking_import_maps_to_record_types_and_validates",
57
+ "test_tracking_import_is_idempotent",
58
+ "test_import_plan_section_roadmap_without_checkboxes",
59
+ }
60
+
32
61
  def setUp(self) -> None:
62
+ self.temp: tempfile.TemporaryDirectory[str] | None = None
63
+ if self._testMethodName in self.READ_ONLY_TESTS:
64
+ self.root = ROOT
65
+ return
33
66
  self.temp = tempfile.TemporaryDirectory()
34
67
  self.root = Path(self.temp.name) / "repo"
68
+ if self._testMethodName in self.TEMP_ONLY_TESTS:
69
+ return
35
70
  shutil.copytree(
36
71
  ROOT,
37
72
  self.root,
38
73
  ignore=shutil.ignore_patterns(
39
- ".git", ".venv", ".pytest_cache", "__pycache__", "build", "dist", "*.egg-info"
74
+ ".git", ".venv", ".pytest_cache", "__pycache__", "build", "dist", "dist-*", "*.egg-info"
40
75
  ),
41
76
  )
42
77
 
43
78
  def tearDown(self) -> None:
44
- self.temp.cleanup()
79
+ if self.temp is not None:
80
+ self.temp.cleanup()
45
81
 
46
82
  def problems(self) -> list[str]:
47
83
  return [problem.message for problem in validate(self.root)]
@@ -217,6 +253,19 @@ class RepositoryValidationTests(unittest.TestCase):
217
253
  (extra / "AGENTS.md").write_text("# unregistered\n", encoding="utf-8")
218
254
  self.assertTrue(any("not registered in audits/registry.json" in v for v in self.problems()))
219
255
 
256
+ def test_worktree_scratch_checkouts_are_not_scanned_as_nested_contracts(self) -> None:
257
+ # A `worktrees/<name>/` directory is a second, independent working
258
+ # copy of this same repository (the convention agent tooling uses for
259
+ # a scratch `git worktree` checkout) -- its own AGENTS.md belongs to
260
+ # that checkout, not this one, and must not be flagged as an
261
+ # unregistered nested contract just because it happens to be reachable
262
+ # on disk under this root, including several levels deep and left
263
+ # behind after the session that created it ended.
264
+ worktree = self.root / "worktrees" / "some-agent-session" / "crates" / "example"
265
+ worktree.mkdir(parents=True)
266
+ (worktree / "AGENTS.md").write_text("# from a scratch worktree checkout\n", encoding="utf-8")
267
+ self.assertFalse(any("not registered in audits/registry.json" in v for v in self.problems()))
268
+
220
269
  def test_existing_audit_companion_must_be_complete(self) -> None:
221
270
  (self.root / "repopact" / "_audit" / "inventory.md").unlink()
222
271
  self.assertTrue(any("incomplete _audit companion" in v for v in self.problems()))
@@ -454,6 +503,44 @@ class RepositoryValidationTests(unittest.TestCase):
454
503
  (self.root / "VERSION").write_text("v1\n", encoding="utf-8")
455
504
  self.assertTrue(any("must be semantic" in v for v in self.problems()))
456
505
 
506
+ def _tag_identity_fixture(self) -> None:
507
+ self.root.joinpath("VERSION").write_text("9.9.9\n", encoding="utf-8")
508
+ readme = self.root / "README.md"
509
+ text = readme.read_text(encoding="utf-8")
510
+ start = text.index("`pip install repopact`")
511
+ end = text.index("\n\n", start)
512
+ readme.write_text(text[:start] + "current release **9.9.9**." + text[end:], encoding="utf-8")
513
+ generate_dashboard.write_dashboard(self.root)
514
+ subprocess.run(["git", "init", "--initial-branch=main"], cwd=self.root, check=True,
515
+ capture_output=True, text=True)
516
+ subprocess.run(["git", "config", "user.email", "test@example.invalid"], cwd=self.root, check=True)
517
+ subprocess.run(["git", "config", "user.name", "RepoPact Test"], cwd=self.root, check=True)
518
+ subprocess.run(["git", "add", "-A"], cwd=self.root, check=True)
519
+ subprocess.run(["git", "commit", "-m", "stable"], cwd=self.root, check=True,
520
+ capture_output=True, text=True)
521
+ subprocess.run(["git", "tag", "-a", "v9.9.9", "-m", "9.9.9"], cwd=self.root, check=True)
522
+
523
+ def test_exact_tagged_release_tree_is_accepted(self) -> None:
524
+ self._tag_identity_fixture()
525
+ self.assertEqual([], self.problems())
526
+
527
+ def test_later_package_source_requires_development_identity(self) -> None:
528
+ self._tag_identity_fixture()
529
+ (self.root / "repopact" / "repo_model.py").write_text(
530
+ (self.root / "repopact" / "repo_model.py").read_text(encoding="utf-8") + "\n# later runtime change\n",
531
+ encoding="utf-8",
532
+ )
533
+ self.assertTrue(any("differs from released v9.9.9" in v for v in self.problems()))
534
+
535
+ def test_later_package_source_with_label_is_accepted(self) -> None:
536
+ self._tag_identity_fixture()
537
+ (self.root / "repopact" / "repo_model.py").write_text(
538
+ (self.root / "repopact" / "repo_model.py").read_text(encoding="utf-8") + "\n# later runtime change\n",
539
+ encoding="utf-8",
540
+ )
541
+ (self.root / "RELEASE_LABEL").write_text("9.9.9-dev.1\n", encoding="utf-8")
542
+ self.assertFalse(any("differs from released" in v for v in self.problems()))
543
+
457
544
  # --- release surface (decision 0028) ------------------------------------
458
545
 
459
546
  def set_readme_release(self, line: str) -> None:
@@ -472,19 +559,19 @@ class RepositoryValidationTests(unittest.TestCase):
472
559
 
473
560
  def test_readme_release_changelog_link_must_name_current_release(self) -> None:
474
561
  self.set_readme_release(
475
- "current release **3.0.0** "
562
+ "current release **3.0.1** "
476
563
  "([changelog](decisions/0025-release-2.2.0-dashboard-integrity.md))."
477
564
  )
478
565
  self.assertTrue(any("does not name the current release" in v for v in self.problems()))
479
566
 
480
567
  def test_readme_release_changelog_link_must_resolve(self) -> None:
481
568
  self.set_readme_release(
482
- "current release **3.0.0** ([changelog](decisions/9999-nonexistent.md))."
569
+ "current release **3.0.1** ([changelog](decisions/9999-nonexistent.md))."
483
570
  )
484
571
  self.assertTrue(any("does not resolve" in v for v in self.problems()))
485
572
 
486
573
  def test_readme_release_line_without_link_is_accepted(self) -> None:
487
- self.set_readme_release("current release **3.0.0**.")
574
+ self.set_readme_release("current release **3.0.1**.")
488
575
  self.assertEqual([], self.problems())
489
576
 
490
577
  def test_readme_without_release_line_is_unaffected(self) -> None:
@@ -495,13 +582,13 @@ class RepositoryValidationTests(unittest.TestCase):
495
582
 
496
583
  def test_readme_release_link_may_be_an_external_url(self) -> None:
497
584
  self.set_readme_release(
498
- "current release **3.0.0** ([changelog](https://example.invalid/changelog))."
585
+ "current release **3.0.1** ([changelog](https://example.invalid/changelog))."
499
586
  )
500
587
  self.assertEqual([], self.problems())
501
588
 
502
589
  def test_readme_release_link_outside_decisions_is_existence_checked_only(self) -> None:
503
590
  (self.root / "CHANGELOG.md").write_text("# Changelog\n", encoding="utf-8")
504
- self.set_readme_release("current release **3.0.0** ([changelog](CHANGELOG.md)).")
591
+ self.set_readme_release("current release **3.0.1** ([changelog](CHANGELOG.md)).")
505
592
  self.assertEqual([], self.problems())
506
593
 
507
594
  # --- dependency cycles --------------------------------------------------
repopact-3.0.0/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.0.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes