test(repo): the term check covers shared/ too; changelog notes the commons sync

shared/ now carries portfolio-optimiser-commons 8aa19ec (squash merge in the
parent commits), and no file under it matches the local term list any more
(22 of 67 files before, 0 of 50 after). The shared/ exception and the test
that kept it alive are removed, so the repository-wide check reads every
tracked file. The surface-count pin follows the manifest: 1427 -> 1410.

CHANGELOG 1.3.0 gains one line for the sync; the version stays 1.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-23 15:34:42 +02:00
commit 97469447e5
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
3 changed files with 7 additions and 30 deletions

View file

@ -13,10 +13,8 @@ place. ``test_the_term_list_is_never_tracked`` holds the other half: the list st
The same file carries each pattern's known-positive and a set of known-negatives, so a pattern
that cannot fire, or one that fires on ordinary prose, is red rather than silently useless.
**One named, tested exception:** ``shared/``, the ``git subtree`` of
``portfolio-optimiser-commons``. Its sync is pull-only: content changes there are committed in
commons and pulled here, never edited here. The exception is itself gated — once no file under
the prefix hits, the exception is dead and a test says to remove it.
``shared/``, the ``git subtree`` of ``portfolio-optimiser-commons``, is scanned like every other
prefix: its content is cleaned in commons and pulled here, so a hit there is fixed in commons.
Every scan carries its denominator: a gate that read zero files would be green and prove nothing.
"""
@ -32,9 +30,6 @@ import pytest
_REPO_ROOT = Path(__file__).resolve().parents[1]
TERMS_FILE = _REPO_ROOT / "tests" / "excluded-terms.local.md"
#: The subtree prefix whose content is owned by another repository (see the module docstring).
SUBTREE_PREFIX = "shared/"
def load_terms(
path: Path = TERMS_FILE,
@ -106,11 +101,7 @@ def test_no_tracked_file_carries_an_excluded_term(terms) -> None:
patterns = terms[0]
names = tracked_files()
assert len(names) > 100, f"git ls-files listed {len(names)} files -- too few to be this repo"
offending = {
name: hits
for name, hits in scan(names, patterns).items()
if not name.startswith(SUBTREE_PREFIX)
}
offending = scan(names, patterns)
report = "\n".join(
f"{name}:{number}: [{label}] {line}"
for name, hits in sorted(offending.items())
@ -142,20 +133,3 @@ def test_the_term_list_is_never_tracked() -> None:
assert rel not in tracked_files(), f"{rel} is tracked -- it must stay local-only"
ignored = subprocess.run(["git", "check-ignore", "-q", rel], cwd=_REPO_ROOT)
assert ignored.returncode == 0, f"{rel} is not covered by .gitignore"
def test_the_subtree_exception_is_still_needed_and_is_the_subtree(terms) -> None:
"""The ``shared/`` exception is alive only while the subtree still carries excluded terms.
Both halves are the claim: the prefix is the subtree (its README says so), and at least one
file under it still hits. When the cleanup has been pulled from commons, the second half goes
red and the exception must be deleted here rather than linger as a hole nobody remembers.
"""
readme = (_REPO_ROOT / SUBTREE_PREFIX / "README.md").read_text(encoding="utf-8")
assert "git subtree" in readme and "shared/" in readme
under = [name for name in tracked_files() if name.startswith(SUBTREE_PREFIX)]
assert under, "no tracked file under the subtree prefix -- the exception names nothing"
assert scan(under, terms[0]), (
"no file under shared/ carries an excluded term any more: remove SUBTREE_PREFIX from "
"this file"
)