diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 2d345f69f..745e44ca2 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -341,8 +341,8 @@ void TDB2::invalidate_cached_info() { bool TDB2::get(const std::string& uuid, Task& task) { auto depmap = replica()->dependency_map(); - // Numeric task refs are per-user short IDs. Prefer them over numeric UUID - // prefixes; if no short ID matches, keep the historical UUID-prefix fallback. + // Numeric task refs are per-user short IDs. Only 8-char numeric refs may fall + // back to the historical displayed UUID-prefix form after a short-ID miss. if (taskref::looksLikeNumericShortId(uuid)) { auto maybe = replica()->get_task_data_by_ref(uuid); if (maybe.is_some()) { @@ -351,6 +351,10 @@ bool TDB2::get(const std::string& uuid, Task& task) { apply_depmap(task, *depmap); return true; } + + if (!taskref::looksLikeHexPrefix(uuid)) { + return false; + } } // Tier 1: full-UUID PK fast path. diff --git a/test/short_id.test.py b/test/short_id.test.py index dcfad4832..917c33fae 100644 --- a/test/short_id.test.py +++ b/test/short_id.test.py @@ -46,7 +46,8 @@ def setUp(self): "import -", input="""[ {"description":"short-id target","entry":"1700000000","status":"pending","uuid":"aaaaaaaa-1111-4111-8111-111111111111"}, - {"description":"numeric-prefix target","entry":"1700000000","status":"pending","uuid":"12345678-2222-4222-8222-222222222222"} + {"description":"numeric-prefix target","entry":"1700000000","status":"pending","uuid":"12345678-2222-4222-8222-222222222222"}, + {"description":"short-numeric-prefix target","entry":"1700000000","status":"pending","uuid":"42000000-3333-4333-8333-333333333333"} ]""", ) self._set_short_id(SHORT_ID_UUID, 12345678) @@ -90,6 +91,11 @@ def test_uuid_prefix_falls_back_when_no_short_id_matches(self): code, out, err = self.t("aaaaaaaa export") self.assertIn('"description":"short-id target"', out) + def test_short_numeric_id_miss_does_not_fallback_to_uuid_prefix(self): + code, out, err = self.t.runError("42 info") + self.assertNotIn("short-numeric-prefix target", out) + self.assertNotIn("short-numeric-prefix target", err) + if __name__ == "__main__": from simpletap import TAPTestRunner