Skip to content

[TASK] Upgrade league/flysystem from v1 to v3#1186

Merged
linawolf merged 1 commit intoTYPO3-Documentation:mainfrom
CybotTM:feature/flysystem-3
Mar 1, 2026
Merged

[TASK] Upgrade league/flysystem from v1 to v3#1186
linawolf merged 1 commit intoTYPO3-Documentation:mainfrom
CybotTM:feature/flysystem-3

Conversation

@CybotTM
Copy link
Copy Markdown
Contributor

@CybotTM CybotTM commented Feb 22, 2026

Summary

Upgrade league/flysystem from abandoned v1 (EOL since 2022) to v3. The upstream phpdocumentor/guides already supports flysystem v3 via its FileSystem interface shim.

Dependency changes

  • league/flysystem: ^1.1.10^3.29 (resolved: 3.32.0)
  • league/flysystem-local: new transitive dependency (3.31.0)
  • phpdocumentor/flyfinder: 1.1.0 → 2.0.0 (flysystem v3 compatible)

Code changes

File Change
CopyResources.php Adapter\LocalLocalFilesystemAdapter, FilesystemException try/catch/finally for both readStream() and putStream() with proper stream cleanup
TwigExtension.php League\Flysystem\ExceptionLeague\Flysystem\FilesystemException
IncludeDirective.php Removed 3 @throws FileNotFoundException docblocks (class removed in v3)
SiteSetSettingsDirective.php Removed 1 @throws FileNotFoundException docblock
Integration test logs Updated expected error messages: "Path is outside of the defined root" → "Path traversal detected"

Error handling

In v3, readStream() throws UnableToReadFile and writeStream() throws UnableToWriteFile instead of returning false. A try/catch(FilesystemException) block wraps both read and write operations with a finally clause to ensure fclose() on the stream. Individual file failures are logged and skipped — a single unreadable/unwritable file will not abort the entire resource copy loop.

Compatibility

The phpdocumentor FileSystem interface shim (phpdocumentor/filesystem) provides backward compatibility. The FilesystemInterface union type in IncludeDirective is preserved since the shim provides a polyfill for the v1 interface.

Test plan

  • PHPStan passes (0 errors)
  • Unit tests pass (83/83)
  • Integration tests pass (113/113)
  • CI green

@CybotTM CybotTM marked this pull request as draft February 22, 2026 12:04
@CybotTM CybotTM marked this pull request as ready for review February 22, 2026 13:48
@CybotTM CybotTM force-pushed the feature/flysystem-3 branch from 8c46e6f to 05a32ed Compare March 1, 2026 12:52
Upgrade league/flysystem from v1 (1.x) to v3 (3.x):

- Replace league/flysystem ^1.1.10 with ^3.29
- Add league/flysystem-local ^3.0 dependency
- Replace Flysystem v1 API (put/putStream/has/read/readStream)
  with v3 equivalents (write/writeStream/fileExists/read/readStream)
- Update CopyResources to use FilesystemException with try/catch/finally
  for proper error handling and stream cleanup
- Update composer.lock (flysystem 3.32.0, flysystem-local 3.31.0,
  flyfinder 2.0.0)

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@CybotTM CybotTM force-pushed the feature/flysystem-3 branch from 05a32ed to b54885e Compare March 1, 2026 12:54
@CybotTM
Copy link
Copy Markdown
Contributor Author

CybotTM commented Mar 1, 2026

added another fix and rebased/resolved conflict.

@linawolf
Copy link
Copy Markdown
Member

linawolf commented Mar 1, 2026

Thanks for taking care of this! I had planned to do the upgrade and then life happened...

@linawolf linawolf merged commit 5bfadfd into TYPO3-Documentation:main Mar 1, 2026
9 checks passed
CybotTM added a commit to netresearch/typo3-ci-workflows that referenced this pull request Apr 23, 2026
## Summary

Bumps the pinned `render-guides` image to **0.37.1** and corrects a
stale/mislabelled pin.

| | Before | After |
|---|---|---|
| Comment | `# typo3-documentation/render-guides 0.37.0` | `#
typo3-documentation/render-guides 0.37.1` |
| Digest | `sha256:431ac264…` (built **2026-01-18**) |
`sha256:2281eeae9bf0b8f490d9be6c8d6a3b64ccb7e178f8dd14a390fc92997524f0c5`
(built 2026-03-27) |
| `league/flysystem` | 1.1.10 (EOL) | 3.32.0 |

## The stale-pin story

The previous pin's comment said **0.37.0** but the digest was built on
**2026-01-18** — a full two months before the `0.37.0` git tag existed
(2026-03-20). Whoever added the pin captured `:latest` or `:main` at the
time, not a resolved `:0.37.0` image.

Even more: **no `:0.37.0` Docker image exists on ghcr.io**. Published
tags on the registry jump from `0.36.0` straight to `0.37.1`. The
reason: the 0.37.0 release's Docker-publish workflow was missing write
permission.
[TYPO3-Documentation/render-guides#1211](TYPO3-Documentation/render-guides#1211)
("Update docker.yaml - add permissions") fixed it in 0.37.1.

## Why this matters

The old pinned digest still ships `league/flysystem` v1, whose `Local`
adapter throws `NotSupportedException` on any symbolic link encountered
during `listContents()` — aborting the entire render, with no way to
pre-exclude via `--exclude-path`.

The upstream Flysystem v1 → v3 upgrade is
[TYPO3-Documentation/render-guides#1186](TYPO3-Documentation/render-guides#1186)
(merged 2026-03-01). The source fix is present from `0.37.0` onward; the
first **image** carrying it is `0.37.1`.

## Concrete failure this fixes

- Repo: `netresearch/t3x-nr-llm`
- Failing run:
https://github.com/netresearch/t3x-nr-llm/actions/runs/24824959021/job/72658428311
- PR that triggered it:
netresearch/t3x-nr-llm#136

## Verification

```bash
$ docker pull ghcr.io/typo3-documentation/render-guides:0.37.1
$ docker inspect ghcr.io/typo3-documentation/render-guides:0.37.1 \
    --format '{{index .RepoDigests 0}}'
ghcr.io/typo3-documentation/render-guides@sha256:2281eeae9bf0b8f490d9be6c8d6a3b64ccb7e178f8dd14a390fc92997524f0c5

$ docker run --rm --entrypoint sh \
    ghcr.io/typo3-documentation/render-guides:0.37.1 \
    -c "grep -A1 'league/flysystem\"' /opt/guides/composer.lock | head -2"
            "name": "league/flysystem",
            "version": "3.32.0",
```

## Test plan
- [ ] Self-CI passes on this workflow repo
- [ ] Downstream docs workflow (e.g. `nr-llm`) renders `Documentation/`
successfully with symlinks present
CybotTM added a commit to netresearch/t3x-nr-llm that referenced this pull request Apr 23, 2026
Upstream root cause is fixed: render-guides 0.37.1 ships
league/flysystem 3.32.0, which handles symbolic links natively. The
shared CI workflow (netresearch/typo3-ci-workflows@main) now pins
that image, so the docs build no longer crashes on symlinks in
Documentation/.

Chain:
- TYPO3-Documentation/render-guides#1186 — flysystem v1 -> v3 (merged 2026-03-01)
- TYPO3-Documentation/render-guides 0.37.1 — first image carrying it
- netresearch/typo3-ci-workflows#63 — bumped pinned digest
- netresearch/typo3-ci-workflows#64 — added Renovate customManager
  so this kind of env-var digest pin cannot rot silently again

Effectively reverts 54dbb51 now that the blocker is gone, giving
Claude Code users scoped auto-loading of Documentation/AGENTS.md when
editing RST files under that directory.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants