fix(projection): recognise a re-key by the slug, not the UUID version
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 24s

The previous commit tested UUID version as a proxy for "identity is derived".
It covers 19 of the 44 ad-hoc rows; the other 25 are legacy v4, so they kept
path matching and would have been updated in place — slug still
`adhoc-2026-07-02` while the file says `ADAPTIVE-WP-ADHOC-2026-07-02`. The
divergence would have persisted, and silently, for most of the records this
was meant to fix.

The distinction that actually matters is whether the row's slug is a
work-record identifier. A row whose slug is an identifier claims to be that
record, so a different derived identifier for the same file means two records.
A row whose slug is a title — `three-phoenix-ha-cluster` for RCLUSTER-WP-0007 —
never claimed one: those are hub-first rows from before ADR-001 where the
backing path is the only link there has ever been, and path matching is all
that holds them together.

730 pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 2583210@bnt-lap001
Assistant-Session: f2bff2d5-e9b2-4338-92ca-10282a927006
This commit is contained in:
tegwick 2026-08-28 00:52:26 +02:00
parent 612476b536
commit ccf4959423
2 changed files with 53 additions and 1 deletions

View file

@ -725,3 +725,30 @@ class TestRekeyIsNotRename:
assert fp.derived_record_uuid("ADHOC-2026-08-25") != fp.derived_record_uuid(
"CUST-WP-ADHOC-2026-08-25"
)
@pytest.mark.parametrize(
"slug",
[
"adhoc-2026-07-02", # grandfathered daily ad-hoc
"cust-wp-adhoc-2026-08-25", # qualified daily ad-hoc
"net-kingdom-adhoc-2026-07-02", # repo-name-qualified legacy form
"adhoc-llmc-2026-06-02", # another legacy qualification
"rcluster-wp-0007", # ordinary workplan
"cust-wp-0066-t01", # task
],
)
def test_identifier_slugs_are_recognised(self, slug):
"""A slug that claims to be an identifier is one, whatever its UUID.
25 of 44 ad-hoc rows are legacy v4, so a UUID-version test alone would
leave them path-matched and silently diverged from their files.
"""
assert fp._slug_is_identifier(slug)
@pytest.mark.parametrize(
"slug",
["three-phoenix-ha-cluster", "testdrive-jsui-publication", "state-hub-v0.1", ""],
)
def test_title_slugs_keep_path_matching(self, slug):
"""Hub-first rows never claimed an identifier; the path is their only link."""
assert not fp._slug_is_identifier(slug)