Skip to content

Commit 0b8bcb0

Browse files
authored
Check links on CI (#902)
# Description Markdown files contain a plenty of links which tend to get outdated occasionally. It's hard to notice when a certain link (local or global) becomes broken. In the past, the [`xrefcheck`](https://github.com/serokell/xrefcheck) tool was used to find broken links: * #3 * #454 This PR automates `xrefcheck` running by adding it as a new GitHub Action job. It uses [xrefcheck-action](https://github.com/serokell/xrefcheck-action) under the hood. Resolves #4 In the second commit I tried to fix/ignore broken links detected by `xrefcheck` using my best judgement. AFAIU `docs/website` contains sources for https://ouroboros-consensus.cardano.intersectmbo.org/, so I used that site to check some links. 1. Links in `References.md`, `index.md` and `TechnicalReports.md` don't work on GitHub because they are invalid in the sense of Markdown, but they work fine on the website, so I didn't touch them and added a comment to make `xrefcheck` ignore them. 2. `Glossary.md` contains many links to anchors in the same file. These anchors work differently in Markdown and Docusarus as can be seen [here](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary/). Ideally, they should be fixed to work on the resulting website, in which case all of them would be broken in the sense of Markdown. Fixing them for Docusaurus is out of scope of this PR, but since they will probably become broken in the sense of Markdown, I've instructed `xrefcheck` to ignore all links in that file. 3. There is also an anchor link in `VersioningSchemeDecision.md`, but this file is not used in the resulting website, so I've fixed it according to Markdown rules. There are also some global/absolute links that return 404 and I couldn't find how to fix them. ``` ➥ In file docs/website/contents/for-developers/AbstractProtocol.md bad reference (external) at src:7:3-178: - text: "Ouroboros.Consensus.Tutorial.Simple" - link: https://github.com/IntersectMBO/ouroboros-consensus/blob/master/ouroboros-consensus/src/tutorials/Ouroboros/Consensus/Tutorial/Simple.lhs - anchor: - ⛂ Resource unavailable (404 Not Found) ➥ In file docs/website/contents/for-developers/AbstractProtocol.md bad reference (external) at src:9:3-184: - text: "Ouroboros.Consensus.Tutorial.WithEpoch" - link: https://github.com/IntersectMBO/ouroboros-consensus/blob/master/ouroboros-consensus/src/tutorials/Ouroboros/Consensus/Tutorial/WithEpoch.lhs - anchor: - ⛂ Resource unavailable (404 Not Found) ```
2 parents b25e8e8 + 0a47d62 commit 0b8bcb0

File tree

14 files changed

+41
-18
lines changed

14 files changed

+41
-18
lines changed

.github/workflows/checks.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,14 @@ jobs:
108108

109109
- name: Diff plans
110110
run: GH=1 ./scripts/release/cabal-plan-diff.sh
111+
112+
xrefcheck:
113+
114+
name: Check references
115+
runs-on: ubuntu-latest
116+
117+
steps:
118+
- uses: actions/checkout@v4
119+
- uses: serokell/xrefcheck-action@v1
120+
with:
121+
xrefcheck-version: 0.3.1

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ We have two types of documentation:
2828
When starting to work on Consensus, we recommend to take a look at the following
2929
resources:
3030

31-
- [Preflight guide](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/PreflightGuide)
32-
- [Glossary](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary)
31+
- [Preflight guide](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/PreflightGuide/)
32+
- [Glossary](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary/)
3333

3434
When adding or improving documentation about the implementation, it is
3535
preferable to add haddock comments since they are closer to the code. However
@@ -53,7 +53,7 @@ live in this repository.
5353

5454
## Using Nix
5555

56-
Consensus can be built using [Nix](https://nixos.org/download.html). The
56+
Consensus can be built using [Nix](https://nixos.org/download/). The
5757
installation and configuration instructions are taken from
5858
[cardano-node](https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/getting-started/building-the-node-using-nix.md),
5959
and detailed below. To install `nix` run:
@@ -378,5 +378,5 @@ See [Cardano engineering
378378
handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/CODE-OF-CONDUCT.md)'s
379379
code of conduct.
380380

381-
[haddock-site]: https://haskell-haddock.readthedocs.io/en/latest/
381+
[haddock-site]: https://haskell-haddock.readthedocs.io/latest/
382382
[chap]: https://github.com/IntersectMBO/cardano-haskell-packages

docs/website/contents/about-ouroboros/References.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
The following artifacts influence and/or describe the Consensus implementation.
44

5+
<!-- xrefcheck: ignore link -->
56
* [Technical reports](../for-developers/TechnicalReports)
67
* From the IOG researchers:
78
* [Ouroboros BFT][ouroboros-bft]
89
* [Ouroboros Praos][ouroboros-praos]
910
* [Ouroboros Genesis][ouroboros-genesis]
1011
* [Ledger specifications][cardano-ledger].
11-
* Consensus (Praos) specification: [Agda style](/pdfs/consensus-spec-agda.pdf), [LaTeX style](/pdfs/consensus-spec.pdf)
12+
* Consensus (Praos) specification:
13+
<!-- xrefcheck: ignore link -->
14+
[Agda style](/pdfs/consensus-spec-agda.pdf),
15+
<!-- xrefcheck: ignore link -->
16+
[LaTeX style](/pdfs/consensus-spec.pdf)
1217
* [Quick reference table for all Cardano features](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-table.md).
1318
This includes the dates and first slot numbers of all eras and hard forks.
1419
* IOG media:

docs/website/contents/about-ouroboros/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The Ouroboros research papers that formalize the different protocols (such as Pr
4040
- the honest nodes will all continually and eventually agree on what the best chain is (unless an adversary controls more than half of the network's stake).
4141
- the best chain grows over time.
4242

43+
<!-- xrefcheck: ignore link -->
4344
The Consensus Layer defines the core Consensus components and logic, notably the
4445
Ouroboros protocol. See [References](References).
4546

docs/website/contents/for-developers/ChainSync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ trim their fragment so that it is anchored at our anchor point.
158158
sufficient number of headers to determine if their chain is preferred over
159159
ours (this needs careful consideration when adopting genesis).
160160

161-
[^glossary]: See the [Glossary](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary)
161+
[^glossary]: See the [Glossary](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary/)

docs/website/contents/for-developers/GitProcess.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ If you'd like to opt-in to that or similar, add a `cabal.project.local` file.
6666
#NNNN`. See the [GitHub documentation][gh-auto-link-issue] for similar
6767
keywords and syntax that will trigger useful automatic behaviors.
6868

69-
[gh-auto-link-issue]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
69+
[gh-auto-link-issue]: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
7070

7171
* Your PR should be a [Draft PR][github-draft-pr] until you think it is ready
7272
for final review and merging. I often open my PR as Draft PR in order to get
@@ -76,7 +76,7 @@ If you'd like to opt-in to that or similar, add a `cabal.project.local` file.
7676
This is far superior to including "WIP" or "DO NOT MERGE" in the PR title,
7777
or a WIP label, etc.
7878

79-
[github-draft-pr]: https://github.blog/2019-02-14-introducing-draft-pull-requests/
79+
[github-draft-pr]: https://github.blog/news-insights/product-news/introducing-draft-pull-requests/
8080

8181
* Your branch name is impermanent, so it's less important than the above.
8282
However, we prefer the format `username/issue-NNNN-short-description` or

docs/website/contents/for-developers/Glossary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- xrefcheck: ignore all -->
12
# Glossary
23

34
Notes on the use and maintenance of this glossary:

docs/website/contents/for-developers/HandlingBlocksFromTheFuture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ In the future we might delete blocks from the future from the `VolatileDB` to im
4141
# References
4242

4343
- [Original issue that prompted the fix](https://github.com/IntersectMBO/ouroboros-network/issues/4251)
44-
- [Blocks from the future (Incident report)](https://updates.cardano.intersectmbo.org/2024-09-07-incident)
44+
- [Blocks from the future (Incident report)](https://updates.cardano.intersectmbo.org/2024-09-07-incident/)

docs/website/contents/for-developers/NodeTasks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Overview of the tasks of a caught-up node
22

3+
<!-- xrefcheck: ignore link -->
34
This document gives an overview of the tasks of a [caught-up](./Glossary.md#honest-caught-up-parties) node, both as a relay and as a block producer.
45

56
## In a single node
@@ -22,7 +23,8 @@ The selection is made up of an immutable and a volatile part:
2223
- The volatile part of the selection are the newest $k$ blocks.
2324
They are stored in the VolatileDB, together with other blocks that could be on a fork we might switch to in the future.
2425

25-
Additionally, the LedgerDB contains the ledger state corresponding to all [points](./Glossary/#point) on the volatile part of the chain as well as the tip of the immutable chain, in order to validate new blocks and potential forks.
26+
<!-- xrefcheck: ignore link -->
27+
Additionally, the LedgerDB contains the ledger state corresponding to all [points](./Glossary.md#point) on the volatile part of the chain as well as the tip of the immutable chain, in order to validate new blocks and potential forks.
2628

2729
The flow of information is depicted in the following diagram.
2830
Rectangular boxes stand for logical components, and hexagons correspond to Haskell RTS threads.

docs/website/contents/for-developers/PreflightGuide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ Finally, we shall note that there are various ideas of how to eliminate grinding
259259
[^utxo-hd]: The main reason for this is that the ledger state, ie the aggregated information necessary to validate blocks, is currently fully stored in memory.
260260
The Consensus team is currently working on *UTxO HD*, a solution to move the ledger state to disk.
261261
262-
[^resource-relative]: Cardano is not a huge outlier in either direction, there are many examples for blockchains that are either much less resource-intensive (due to very low activity or new age, or due to very fancy cryptography, like Mina) or much more resource-intensive (due to very old age and large accumulated history, like Bitcoin, or a hyperfocus on performance, like [Solana](https://docs.solana.com/running-validator/validator-reqs#hardware-recommendations)).
262+
[^resource-relative]: Cardano is not a huge outlier in either direction, there are many examples for blockchains that are either much less resource-intensive (due to very low activity or new age, or due to very fancy cryptography, like Mina) or much more resource-intensive (due to very old age and large accumulated history, like Bitcoin, or a hyperfocus on performance, like [Solana](https://docs.anza.xyz/operations/requirements#hardware-recommendations)).
263263
264264
[^genesis-syncing]: As of early 2024, syncing is a fully trusted process; if any node you are syncing from is adversarial, you might end up on an adversarial chain.
265265
There is an ongoing effort to implement *Ouroboros Genesis* in order to reduce this strong trust assumption; in particular, it will involve reaching out to lots of nodes while syncing.
@@ -293,17 +293,17 @@ for Ungrindable Blockchains" by Kiayias et al](https://eprint.iacr.org/2021/1698
293293
[cardano-cli]: https://github.com/IntersectMBO/cardano-cli
294294
[cardano-db-sync]: https://github.com/IntersectMBO/cardano-db-sync
295295
[kupo]: https://github.com/cardanosolutions/kupo
296-
[hydra]: https://github.com/input-output-hk/hydra
296+
[hydra]: https://github.com/cardano-scaling/hydra
297297
[ogmios]: https://github.com/CardanoSolutions/ogmios
298298
[node release page]: https://github.com/IntersectMBO/cardano-node/releases
299299
[cardano mainnet conf]: https://github.com/IntersectMBO/cardano-node/blob/master/configuration/cardano/mainnet-config.yaml
300300
[cardano mainnet topo]: https://github.com/IntersectMBO/cardano-node/blob/master/configuration/cardano/mainnet-topology.json
301-
[Mithril client]: https://mithril.network/doc
302-
[Mithril instructions]: https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node
301+
[Mithril client]: https://mithril.network/doc/
302+
[Mithril instructions]: https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node/
303303
[Magic Wormhole]: https://github.com/magic-wormhole/magic-wormhole
304304
[db-analyser]: https://github.com/IntersectMBO/ouroboros-consensus/blob/main/ouroboros-consensus-cardano/README.md#db-analyser
305305
[Cardano ledger]: https://github.com/IntersectMBO/cardano-ledger
306-
[Glossary]: https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary
306+
[Glossary]: https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary/
307307
[db-analyser snapshot]: https://github.com/IntersectMBO/ouroboros-consensus/blob/main/ouroboros-consensus-cardano/README.md#saving-a-snapshot
308308
[preflight epic]: https://github.com/IntersectMBO/ouroboros-consensus/issues/887
309309
[Ouroboros Praos paper]: https://iohk.io/en/research/library/papers/ouroboros-praos-an-adaptively-secure-semi-synchronous-proof-of-stake-protocol/

0 commit comments

Comments
 (0)