feat: let a profile state that its upstream is gone

Saying those profiles would stay open no matter what was wrong. A dead
forge is a verifiable fact, and a fact can be recorded: upstream_gone
carries why, and the profile stops being an open problem. The refs
describe the last revision anyone could reach, which is all any reader
can ask of them.

The declaration is guarded rather than trusted, because a forge can come
back and a profile that keeps asserting a death nobody rechecks is worse
than one that fails loudly. Declared and unreachable reports as a
recorded fact; declared and answering reports as the contradiction it
is, and the profile has to be read again.

yuzu and suyu carry GitHub's 451. citron carries the loss of
git.citron-emu.org and the squatter now sitting on the .com. Each names
what was probed and when, so the next reader retraces it rather than
repeating it.
This commit is contained in:
Abdessamad Derraz committed 2026-09-04 17:25:23 +02:00
1 parent 70d121e99a
commit ece637d52d
8 files changed
+80 -1

No files matched your search

+46
View File
@@ -1435,6 +1435,52 @@ def _sample_report():
)
class TestDeclaredDeadUpstream(TestBuildReport):
"""A forge that is gone can be stated, which closes the question.
yuzu and suyu were withdrawn, citron's domain was taken by a squatter.
Leaving those profiles to fail every pass reports an open problem where
there is a settled fact. Declaring it records the death; the guard is
that a declaration must stop being true the moment the forge answers.
"""
def _profile_with(self, note):
profile = self._profile(["a.c:1"])
profile["upstream_gone"] = note
return profile
def test_a_declared_death_is_reported_as_declared(self):
def boom(*a, **k):
raise profile_sync.upstream.GoneError("https://h/x: HTTP 451")
profile_sync.upstream.resolve_head = boom
report = build_report(
"test", self._profile_with("withdrawn, HTTP 451"), self.dir
)
self.assertIsNotNone(report.skipped)
self.assertIn("declared", report.skipped)
self.assertIn("withdrawn, HTTP 451", report.skipped)
self.assertEqual(report.needs_review(), 0)
def test_a_declaration_the_forge_contradicts_is_reported(self):
"""The forge answered: the declaration has outlived its truth."""
self.files[("pinsha", "a.c")] = ["hit"]
self.files[("headsha", "a.c")] = ["hit"]
report = build_report(
"test", self._profile_with("withdrawn, HTTP 451"), self.dir
)
self.assertIsNotNone(report.skipped)
self.assertIn("answers", report.skipped)
def test_an_undeclared_death_is_unchanged(self):
def boom(*a, **k):
raise profile_sync.upstream.GoneError("https://h/x: HTTP 451")
profile_sync.upstream.resolve_head = boom
with self.assertRaises(profile_sync.upstream.GoneError):
build_report("test", self._profile(["a.c:1"]), self.dir)
class TestRefsAheadOfTheirPin(TestBuildReport):
"""Say when a ref describes HEAD and the pin still names an older tree.