pub struct SourceBase { /* private fields */ }Expand description
Where a link that leaves the site points instead: the repository’s own web view, at the commit the site was built from.
The Build Plan cites code as evidence for its claims — [sync](../crates/… /sync.rs) — which is correct in a checkout and dead on roteiro.dev, because
render docs publishes documents and not source. Six such links were live on
the site (issue #456). This is the answer chosen for them: keep the link’s
affordance and move its target to the one place the file is actually served.
§Pinned to a commit, not to a branch
blob carries a sha (…/blob/<sha>), not …/blob/main. GitHub serves a
blob by sha forever, so the link keeps resolving after the file is renamed or
deleted; a main link 404s on the next rename, and this is a retired plan
whose citations describe the code as it stood, so drifting them onto today’s
main would be wrong even when it resolved. It is also the rule the vault
renderer already ships (source_blob_base + head_commit_id), and one repo
with two answers to “which commit does a source link mean” is its own defect.
The cost is stated rather than hidden: a site rendered from a commit that was never pushed yields links the host has never heard of. That is a local preview, not the published site — the Website workflow renders from a commit GitHub already has.
§No mappable origin
Construction goes through SourceBase::new, which yields None when the
caller has no blob base to offer — no origin remote, or a remote whose URL
does not map to a web view. Links are then left exactly as they are: still
correct in a checkout, still dead on the site. That is deliberate and is the
least-bad of the three: refusing to render would break render docs in any
repository without an origin (every test fixture, every fresh git init),
and demoting the link to plain text would destroy information to hide a
problem the reader can otherwise route around.
§Can the class recur?
Not while a base exists: the rule is structural, not a list of the six links
that were found. Any link climbing above the site root is re-aimed, so a new
citation added to any rendered document is handled the day it is written, and
a_link_out_of_the_site_goes_to_the_repository is what fails if that stops.
It recurs silently in exactly one case — a site rendered where no base can be
derived — and nothing catches that, because the output is the authored link
and there is no rendered-site link gate (issue #459) to notice. That case is
the one the deploy does not hit: the Website workflow checks out with an
origin on github.com, and without_an_origin_remote_a_source_link_is_left_as_authored
pins the behaviour rather than the absence of a gate.
Implementations§
Trait Implementations§
Source§impl Clone for SourceBase
impl Clone for SourceBase
Source§fn clone(&self) -> SourceBase
fn clone(&self) -> SourceBase
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceBase
impl Debug for SourceBase
impl Eq for SourceBase
Source§impl PartialEq for SourceBase
impl PartialEq for SourceBase
impl StructuralPartialEq for SourceBase
Auto Trait Implementations§
impl Freeze for SourceBase
impl RefUnwindSafe for SourceBase
impl Send for SourceBase
impl Sync for SourceBase
impl Unpin for SourceBase
impl UnsafeUnpin for SourceBase
impl UnwindSafe for SourceBase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.