From 112cb7e69c1930802f11e06206b478806e1a139f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 22 Oct 2026 00:02:16 +0500 Subject: [PATCH] Read new Manager release notes from Git without unsupported subprocess arguments --- tools/sync_history.py | 6 +++--- tools/test_sync_history.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/sync_history.py b/tools/sync_history.py index ee50c5e..c777e1c 100644 --- a/tools/sync_history.py +++ b/tools/sync_history.py @@ -75,14 +75,14 @@ def remote_fragments(repo, sha, seen, areas): def collect_manager(root, tag, seen): - sha = subprocess.check_output(['git', '-C', str(root), 'rev-parse', tag + '^{commit}'], encoding='utf8', newline='\n').strip() - paths = subprocess.check_output(['git', '-C', str(root), 'ls-tree', '-r', '--name-only', sha, 'changelog.d'], encoding='utf8', newline='\n').splitlines() + sha = subprocess.check_output(['git', '-C', str(root), 'rev-parse', tag + '^{commit}'], encoding='utf8').strip() + paths = subprocess.check_output(['git', '-C', str(root), 'ls-tree', '-r', '--name-only', sha, 'changelog.d'], encoding='utf8').splitlines() paths = [p for p in paths if re.fullmatch(r'changelog.d/\d{8}-[a-z0-9-]+\.md', p)] repo = 'Corfirean/coa-server-manager' notes = [] for path in paths: if repo + ':' + Path(path).name not in seen: - text = subprocess.check_output(['git', '-C', str(root), 'show', f'{sha}:{path}'], encoding='utf8', newline='\n') + text = subprocess.check_output(['git', '-C', str(root), 'show', f'{sha}:{path}'], encoding='utf8') note = fragment_note(text, MANAGER_AREAS) if note: notes.append(note) diff --git a/tools/test_sync_history.py b/tools/test_sync_history.py index abe0d37..33a7cc2 100644 --- a/tools/test_sync_history.py +++ b/tools/test_sync_history.py @@ -51,6 +51,26 @@ class ComponentHistoryTests(unittest.TestCase): api.assert_called_once_with('repos/owner/repo/contents/changelog.d?ref=' + 'a' * 40) with self.assertRaises(ValueError): sync.remote_fragments('owner/repo', 'main', set(), sync.SERVER_AREAS) + def test_manager_collection_reads_the_real_frozen_tag(self): + with tempfile.TemporaryDirectory() as folder: + root = Path(folder) + fragments = root / 'changelog.d' + fragments.mkdir() + own = fragments / '20261021-own.md' + own.write_text('---\narea: manager\ntitle: Characters show their saved versions\n---\n', encoding='utf8') + (fragments / '20261021-server.md').write_text('---\narea: server\ntitle: Server only\n---\n', encoding='utf8') + subprocess.run(['git', 'init', '-q', str(root)], check=True) + subprocess.run(['git', '-C', str(root), 'add', '.'], check=True) + subprocess.run(['git', '-C', str(root), '-c', 'user.name=Fixture', '-c', 'user.email=fixture@example.invalid', '-c', 'commit.gpgsign=false', 'commit', '-qm', 'Frozen notes'], check=True) + subprocess.run(['git', '-C', str(root), 'tag', 'v0.7.0'], check=True) + own.write_text('Uncommitted content must not become release notes', encoding='utf8') + notes, ids, source = sync.collect_manager(root, 'v0.7.0', set()) + self.assertEqual(notes, ['Characters show their saved versions']) + self.assertEqual(len(ids), 2) + self.assertEqual(len(source['commit']), 40) + seen = {'Corfirean/coa-server-manager:20261021-own.md'} + self.assertEqual(sync.collect_manager(root, 'v0.7.0', seen)[0], []) + def test_render_is_component_scoped_and_stable(self): text = sync.render(self.history()) self.assertIn('# CoA Server Manager changelog', text)