Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,16 @@ jobs:
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"

# Debug: Show downloaded files and their encoding
echo "=== Downloaded files debug ==="
ls -la *.py *.sh
file format-csharp-files.py
hexdump -C format-csharp-files.py | head -5

# Remove BOM (Byte Order Mark) if present
sed -i '1s/^\xEF\xBB\xBF//' ./format-csharp-files.py

# Replace python-pygments with python3-pygments and python2 with python3
sed -i 's/python-pygments/python3-pygments/g' ./generate-csharp-pdf.sh
sed -i 's/python2/python3/g' ./format-csharp-document.sh
Expand All @@ -222,13 +222,30 @@ jobs:
sed -i '1i import importlib' ./format-csharp-files.py
# Also remove sys.setdefaultencoding which doesn't exist in Python 3
sed -i '/sys.setdefaultencoding/d' ./format-csharp-files.py


# Fix paths: the project uses Link.Foundation.Links.Notation namespace, not Platform.$REPOSITORY_NAME
# Also fix the ./csharp/ prefix since the script runs from the csharp/ working directory
sed -i 's|\./csharp/Platform\.\$REPOSITORY_NAME|./Link.Foundation.Links.Notation|g' ./format-csharp-document.sh

# Fix the PDF output filename to match the documented link name
sed -i 's|_site/Platform\.\$REPOSITORY_NAME\.pdf|_site/Link.Foundation.Links.Notation.pdf|g' ./generate-csharp-pdf.sh

# Debug: Show file after fixes
echo "=== After fixes ==="
file format-csharp-files.py
head -5 format-csharp-files.py

echo "=== format-csharp-document.sh after fixes ==="
cat ./format-csharp-document.sh
echo "=== generate-csharp-pdf.sh after fixes ==="
cat ./generate-csharp-pdf.sh

bash ./generate-csharp-pdf.sh
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: csharp-pdf
path: csharp/_site/Link.Foundation.Links.Notation.pdf
retention-days: 1

publishDocumentation:
runs-on: ubuntu-latest
Expand All @@ -238,6 +255,11 @@ jobs:
- uses: actions/checkout@v6
with:
submodules: true
- name: Download PDF artifact
uses: actions/download-artifact@v4
with:
name: csharp-pdf
path: csharp/pdf-artifact
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
Expand Down Expand Up @@ -274,6 +296,8 @@ jobs:
sed -i 's/^nuget install docfx.console.*$/echo "Skipping docfx installation via nuget"/g' ./publish-csharp-docs.sh
# Remove --force flag as it's not supported in DocFX 2.78.3
sed -i 's/^docfx docfx.json --force$/docfx docfx.json/g' ./publish-csharp-docs.sh
# Copy generated PDF into _site after DocFX generates documentation
sed -i '/^docfx docfx.json$/a cp -v "$GITHUB_WORKSPACE/csharp/pdf-artifact/Link.Foundation.Links.Notation.pdf" _site/ 2>/dev/null || echo "PDF artifact not found, skipping"' ./publish-csharp-docs.sh

# Clean up ALL build artifacts to avoid conflicts
echo "=== Cleaning up ALL build artifacts ==="
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ language-specific documentation:

- **[C# Documentation](https://link-foundation.github.io/links-notation/csharp/api/Link.Foundation.Links.Notation.html)**
\- Complete API reference
- **[PDF Documentation](https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf)**
\- Complete reference for offline reading
- **[C# README](csharp/README.md)** - Installation and usage guide
- **[JavaScript README](js/README.md)** - Modern web development guide
- **[Rust README](rust/README.md)** - High-performance parsing guide
Expand All @@ -160,8 +162,6 @@ language-specific documentation:
Additional resources:

- [Test Case Comparison](TEST_CASE_COMPARISON.md) - Comprehensive test coverage comparison across all 6 language implementations
- [PDF Documentation](https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf)
\- Complete reference for offline reading
- [Links Theory 0.0.2](https://habr.com/en/articles/895896) - Theoretical
foundation that Links Notation fully supports

Expand Down
9 changes: 4 additions & 5 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ List<Link> links = parser.parse("папа (любитМаму: любит мам

- **[Документация C#](https://link-foundation.github.io/links-notation/csharp/api/Link.Foundation.Links.Notation.html)**
\- Полный справочник API
- **[PDF Документация](https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf)**
\- Полный справочник для офлайн чтения
- **[README C#](csharp/README.ru.md)** - Руководство по установке и использованию
- **[README JavaScript](js/README.ru.md)** - Руководство для современной
веб-разработки
Expand All @@ -136,10 +138,7 @@ List<Link> links = parser.parse("папа (любитМаму: любит мам

Дополнительные ресурсы:

- [Сравнение возможностей](FEATURE_COMPARISON.md) - Анализ возможностей LINO
по сравнению с YAML/XML/JSON

- [PDF Документация](https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf)
\- Полный справочник для офлайн чтения
- [Сравнение тестовых сценариев](TEST_CASE_COMPARISON.md) - Всестороннее
сравнение тестового покрытия по всем реализациям
- [Теория связей 0.0.2](https://habr.com/ru/articles/804617) -
Теоретическая основа, которую Нотация Связей полностью поддерживает
212 changes: 212 additions & 0 deletions docs/case-studies/issue-217/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Case Study: Issue #217 - Broken Links

**Issue**: [#217 - Broken links](https://github.com/link-foundation/links-notation/issues/217)
**Author**: konard
**Date Reported**: 2026-02-27
**Status**: Root cause identified, full CI/CD fix implemented

## Summary

Two broken links were reported in the project documentation:

1. `https://github.com/link-foundation/links-notation/blob/main/FEATURE_COMPARISON.md`
- **Status**: File does not exist in the repository
2. `https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf`
- **Status**: File does not exist on GitHub Pages

Both links are present in `README.md`, `README.ru.md`, and `docs/website/index.html`.

---

## Broken Link 1: FEATURE_COMPARISON.md

### Current State

The file `FEATURE_COMPARISON.md` does not exist in the repository. References remain in:

- `README.ru.md`: `- [Сравнение возможностей](FEATURE_COMPARISON.md) - Анализ возможностей LINO`

Note: `README.md` does NOT reference `FEATURE_COMPARISON.md` currently — that reference was replaced
in commit `1ee4eca` with `TEST_CASE_COMPARISON.md`. Only `README.ru.md` still has the dead link.

### Root Cause

**Primary Cause**: Accidental omission when synchronizing the Russian README during file deletion.

**Timeline of Events**:

| Date | Commit | Action |
|------|--------|--------|
| 2025-09-10 | `a3ea131` (konard) | `FEATURE_COMPARISON.md` created (225 lines, YAML/XML/JSON/LINO comparison) |
| 2025-09-28 | `9f555b9` (konard) | Minor whitespace fixes to `FEATURE_COMPARISON.md` |
| 2025-10-12 | `b8bfb4b` (konard) | Updated link in `FEATURE_COMPARISON.md` from `linksplatform` to `link-foundation` |
| 2025-11-16 | `1ee4eca` (Claude) | **File deleted** — "Remove redundant analysis files" |

The deletion commit (`1ee4eca`) removed `FEATURE_COMPARISON.md` and updated `README.md` to point
to `TEST_CASE_COMPARISON.md` instead. However, the corresponding update to `README.ru.md` was
missed — `README.ru.md` still points to the deleted `FEATURE_COMPARISON.md`.

### File Content (Last Known State Before Deletion)

The file contained a feature comparison of data serialization formats: YAML vs XML vs JSON vs LINO,
focused on cyclic reference support. It was 225 lines and addressed
[issue #55](https://github.com/link-foundation/links-notation/issues/55).

The content is preserved in git history at commit `b8bfb4b:FEATURE_COMPARISON.md`.

### Fix

Remove the dead link from `README.ru.md`. Since `README.md` (English version) was correctly updated
to point to `TEST_CASE_COMPARISON.md`, the Russian README should be updated consistently.

---

## Broken Link 2: Link.Foundation.Links.Notation.pdf

### Current State

The URL `https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf`
returns 404. The GitHub Pages (`gh-pages` branch) contains only two PDF files:

- `csharp/Platform.Communication.Protocol.Lino.pdf` (last updated 2022-01-24)
- `csharp/Platform.Protocols.Lino.pdf` (last updated 2022-01-31)

Neither matches `Link.Foundation.Links.Notation.pdf`.

### Root Cause

**Three compounding problems**:

#### Problem 1: Wrong PDF filename in documentation links

| Date | Commit | Action |
|------|--------|--------|
| Before 2022-01-31 | Legacy state | PDF generated as `Platform.Communication.Protocol.Lino.pdf` |
| 2022-01-31 | `6970453` (Deploy) | PDF renamed to `Platform.Protocols.Lino.pdf` on gh-pages |
| 2025-10-12 | `b8bfb4b` (konard) | README PDF link changed from `Platform.Protocols.Lino.pdf` to `LinkFoundation.LinksNotation.pdf` |
| 2025-10-18 | `d3b635d` (konard) | README PDF link updated from `LinkFoundation.LinksNotation.pdf` to `Link.Foundation.Links.Notation.pdf` |

The link in `README.md` was updated twice to reflect namespace migrations, but the **actual PDF file
on `gh-pages` was never regenerated or renamed**. The last PDF deployment was in **January 2022**
(commit `6e15be0`), before the repository was migrated from `linksplatform/Protocols.Lino` to
`link-foundation/links-notation`.

#### Problem 2: PDF generation script uses wrong filename

The `generatePdfWithCode` CI job (in `.github/workflows/csharp.yml`) runs the script
`generate-csharp-pdf.sh` from the `linksplatform/Scripts` repository. That script generates
the PDF as:

```bash
cp document.pdf "_site/Platform.$REPOSITORY_NAME.pdf"
```

Where `REPOSITORY_NAME=$(basename ${{ github.repository }})` = `links-notation`.

So the generated PDF would be named `Platform.links-notation.pdf` — not `Link.Foundation.Links.Notation.pdf`.

The script also looks for a directory `csharp/Platform.links-notation/` which doesn't exist
(evidence from CI logs):

```
find: './csharp/Platform.links-notation/obj': No such file or directory
find: './csharp/Platform.links-notation.Tests/obj': No such file or directory
find: './csharp/Platform.links-notation': No such file or directory
find: './csharp/Platform.links-notation.Tests': No such file or directory
```

This means the `generatePdfWithCode` job runs successfully (exit code 0) but produces an empty
or minimal PDF, and never integrates with the documentation deployment.

#### Problem 3: PDF artifact not shared between CI jobs

The `generatePdfWithCode` job and `publishDocumentation` job are separate GitHub Actions jobs
with no artifact sharing between them. Even if `generatePdfWithCode` produced a correctly named
PDF, `publishDocumentation` would not include it in the deployed documentation.

The `publishDocumentation` job runs DocFX which generates API documentation, but there is no
step to copy the PDF from `generatePdfWithCode` into the DocFX `_site` output.

### CI Logs Evidence

CI log from run `20053077913` (2025-12-09, push to main):
- `generatePdfWithCode` shows `find: './csharp/Platform.links-notation': No such file or directory`
- `publishDocumentation` never references any PDF file
- The deployed gh-pages only contains HTML/CSS/JS API docs with no PDF

Full log saved to: `ci-logs/csharp-push-20053077913.log`

### Fix (Implemented)

**Full fix** — fixing the PDF generation pipeline in `csharp.yml`:

1. **Fixed paths in `format-csharp-document.sh`**: Patched `Platform.$REPOSITORY_NAME` references
to use `Link.Foundation.Links.Notation` (the actual C# project directory name).
2. **Fixed PDF filename in `generate-csharp-pdf.sh`**: Patched the `cp` command to produce
`_site/Link.Foundation.Links.Notation.pdf` instead of `_site/Platform.links-notation.pdf`.
3. **Added artifact upload**: After PDF generation, uploads the PDF as a GitHub Actions artifact
(`csharp-pdf`) using `actions/upload-artifact@v4`.
4. **Added artifact download**: `publishDocumentation` job downloads the PDF artifact before
running the documentation script.
5. **Added PDF copy into `_site/`**: After DocFX runs and generates `_site/`, the PDF is copied
in so it gets included in the deployment to gh-pages.
6. **Restored PDF links**: All documentation files (`README.md`, `README.ru.md`,
`docs/website/index.html`, `docs/website/dist/index.html`) have their PDF links restored
to point to `Link.Foundation.Links.Notation.pdf`.

---

## Affected Files

| File | Broken Link | Status |
|------|-------------|--------|
| `README.md` | PDF link | Fixed (CI/CD pipeline fixed to generate PDF) |
| `README.ru.md` | `FEATURE_COMPARISON.md` | Fixed (updated to point to `TEST_CASE_COMPARISON.md`) |
| `README.ru.md` | PDF link | Fixed (CI/CD pipeline fixed to generate PDF) |
| `docs/website/index.html` | PDF link | Fixed (CI/CD pipeline fixed to generate PDF) |
| `docs/website/dist/index.html` | PDF link | Fixed (CI/CD pipeline fixed to generate PDF) |
| `.github/workflows/csharp.yml` | N/A | Fixed (generatePdfWithCode + publishDocumentation pipeline) |

---

## Proposed Solutions

### For FEATURE_COMPARISON.md reference in README.ru.md

**Option 1** (Recommended): Update `README.ru.md` to match `README.md` — replace the
`FEATURE_COMPARISON.md` link with a link to `TEST_CASE_COMPARISON.md` (which exists).

**Option 2**: Restore `FEATURE_COMPARISON.md` from git history (commit `b8bfb4b:FEATURE_COMPARISON.md`).
However, this file was intentionally deleted as "redundant", so restoration is not recommended
without deliberate intent.

### For the PDF link

**Implemented (Full fix)**: Fix the CI pipeline to correctly generate and deploy the PDF:
- Patched `format-csharp-document.sh` to use `Link.Foundation.Links.Notation` directory paths
- Patched `generate-csharp-pdf.sh` to produce `Link.Foundation.Links.Notation.pdf` as output
- Added artifact upload/download between `generatePdfWithCode` and `publishDocumentation` jobs
- Added PDF copy into DocFX `_site/` output before deployment

### Known Libraries/Tools for PDF Documentation Generation

For generating PDF documentation from .NET/C# code:
- **DocFX** (already in use): Can generate PDF via `docfx pdf` command. See
[DocFX PDF documentation](https://dotnet.github.io/docfx/docs/pdf.html)
- **wkhtmltopdf**: Convert HTML documentation to PDF
- **Pandoc**: Convert Markdown to PDF
- **LaTeX/dvipdf**: Currently used approach (via `generate-csharp-pdf.sh`), but requires
fixing the filename mismatch

---

## References

- [Issue #217](https://github.com/link-foundation/links-notation/issues/217)
- [PR #218](https://github.com/link-foundation/links-notation/pull/218)
- Commit `a3ea131`: FEATURE_COMPARISON.md created
- Commit `1ee4eca`: FEATURE_COMPARISON.md deleted
- Commit `b8bfb4b`: PDF link first renamed (linksplatform → link-foundation)
- Commit `d3b635d`: PDF link namespace updated (LinkFoundation.LinksNotation → Link.Foundation.Links.Notation)
- CI Run `20053077913`: Evidence of broken PDF generation (2025-12-09)
- [linksplatform/Scripts generate-csharp-pdf.sh](https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository/generate-csharp-pdf.sh)
1 change: 1 addition & 0 deletions docs/website/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ <h3>Resources</h3>
<ul>
<li><a href="https://github.com/link-foundation/links-notation">GitHub Repository</a></li>
<li><a href="https://link-foundation.github.io/Documentation/">Link Foundation Docs</a></li>
<li><a href="https://link-foundation.github.io/links-notation/csharp/api/Link.Foundation.Links.Notation.html">C# API Documentation</a></li>
<li><a href="https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf">PDF Documentation</a></li>
</ul>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ <h3>Resources</h3>
<ul>
<li><a href="https://github.com/link-foundation/links-notation">GitHub Repository</a></li>
<li><a href="https://link-foundation.github.io/Documentation/">Link Foundation Docs</a></li>
<li><a href="https://link-foundation.github.io/links-notation/csharp/api/Link.Foundation.Links.Notation.html">C# API Documentation</a></li>
<li><a href="https://link-foundation.github.io/links-notation/csharp/Link.Foundation.Links.Notation.pdf">PDF Documentation</a></li>
</ul>
</div>
Expand Down
Loading