Repository navigation
Conversation
fs.stat answered a symlink's size as the length of the canonical object that stores its target: the object envelope plus the LFS4LNK header, 27 bytes more than the target (a link to `a.txt` reported 32). A mounted Workspace reports the target's length (base/view.rs stat_resolved and the FUSE attributes), so the two views of one symlink disagreed. snapshot::size now decodes the stored target with SymlinkTarget::decode, as the Workspace base view does, and returns its byte length. The operator file history and stats use the same helper and now count a symlink the same way. Tests: new layerfs-api tests/stat_symlink.rs (a link and a dangling link); it fails on main with `left: Some(Int(32)) right: Some(Int(5))` and passes with the fix. The fs.stat reference in the layerfs-js-sdk skill now says what `size` means for each type. Verification (Linux arm64 VM, Rust 1.85.1): cargo fmt --all --check; clippy -p layerfs-store-service -p layerfs-api --all-targets -D warnings; test -p layerfs-store-service and each of the 46 layerfs-api test targets under a 120 s timeout: all passed. check_product_boundary.py reports the same 4 violations as main, none in the changed files. No tests deleted. Production LOC: 102160 -> 102161 (delta +1) Scope: combined core+api. Core: 96788 -> 96789 (layerfs-store-service 10009 -> 10010); api: 5372 -> 5372. Method: tools/production_loc.py --root <extracted tree> --json on git archive of the first parent and of the staged tree. Reference absent (retired R9c; last counted 65,417 at tree 498dd19).
yifanxuaaa
added a commit
that referenced
this pull request
Oct 26, 2026
fs.stat answered a symlink's size as the length of the object storing its target (target + 27 bytes); it now decodes the target and returns its length, as a mounted Workspace's lstat does. The operator storage and revision answers use the same helper, so they count a symlink the same way. No stored format changes. Rebased by the maintainer onto main after #465 moved the crates to engine/; the new test moved with it to engine/crates/layerfs-api/tests/. Checked on macOS (cargo 1.85.1): stat_symlink passes and fails on main's snapshot.rs with 32 vs 5; layerfs-store-service tests; layerfs-api sdk_method_golden, diff_resume, sdk_compare, write_refusals, sdk_reads_during_publish and init; fmt and Clippy -D warnings clean. Production LOC: 102164 -> 102165 (delta +1) First-parent comparison (main a944016 -> this merge). core 38241, engine 61290 -> 61291 (layerfs-store-service 10009 -> 10010), api 2633; reference absent (retired R9c; last counted 65,417 at tree 498dd19). Counted with tools/production_loc.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Merged into main as 3828268, thanks! #465 moved the crates to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #447.
fs.statreported a symlink's size as the length of the object that stores its target, which is the target plus 27 bytes of envelope and header. A mounted Workspace reports the target's length. The repro and cause are in the issue.Fix
size()inlayerfs-store-service/src/read/snapshot.rsnow decodes the stored target withSymlinkTarget::decode, the same waylayerfs-workspacebase/view.rsdoes, and returns its byte length.fs.statreference in thelayerfs-js-sdkskill now says whatsizemeans for a file, a symlink and a folder.Nothing changes in the stored format.
Tests
layerfs-apiteststat_symlink, covering a link and a dangling link. Onmainit fails withleft: Some(Int(32)) right: Some(Int(5)). It passes with the fix.Checks, run on Linux arm64 (Ubuntu 22.04 VM) with Rust 1.85.1:
cargo test -p layerfs-api --test stat_symlinkcargo test -p layerfs-store-servicelayerfs-apitest target, one at a time, 120 s timeout eachcargo clippy -p layerfs-store-service -p layerfs-api --all-targets -- -D warningscargo fmt --all -- --checkI also confirmed the mount side by running
kernel_mountunder FUSE with a temporary local probe, which is not part of this PR. For all five fixture symlinks,lstatsize equals thereadlinklength.Production LOC: 102,160 -> 102,161 (delta +1), in
layerfs-store-service. The counting method is in the commit message.