fix: advance TCS root only for numbered-source changes

This commit is contained in:
冰朔 2026-09-08 13:59:14 +08:00
commit 4a030c15ab
5 changed files with 21 additions and 6 deletions

View file

@ -53,6 +53,16 @@ class RootAgentTest(unittest.TestCase):
MODULE.refresh(ROOT, output, pointer, 'negative-test')
self.assertEqual(current.read_bytes(), before)
def test_ordinary_commit_equivalent_sources_do_not_advance_current(self):
with tempfile.TemporaryDirectory() as temp:
base = Path(temp)
output, pointer = base / 'state', base / 'TCS-ROOT.json'
first = MODULE.refresh(ROOT, output, pointer, 'test')
current = json.loads((output / 'CURRENT.json').read_text())
same = MODULE.refresh(ROOT, output, pointer, 'ordinary-commit-test')
self.assertIn(same['state'], ['CURRENT_IDEMPOTENT', 'CURRENT_NUMBER_NAV_UNCHANGED'])
self.assertEqual(json.loads((output / 'CURRENT.json').read_text())['freshness_token'], current['freshness_token'])
if __name__ == '__main__':
unittest.main()