Skip to content

Add the File::Constants module and its missing flag constants - #459

Merged
tannevaled merged 1 commit into
mainfrom
feat/cluster29
Aug 25, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/cluster29

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

File defined its open-mode and fnmatch flag constants directly on the class but
had no File::Constants module, and was missing the flock operations
(LOCK_SH/LOCK_EX/LOCK_NB/LOCK_UN) and the NONBLOCK/NOCTTY/SYNC/
SHARE_DELETE open flags, so File::Constants and File::LOCK_EX were
uninitialized constants.

File::Constants is now a module carrying the open-mode, flock and fnmatch flag
constants (canonical Linux values — the specs only assert the names exist), and
File includes it, so File::RDONLY, File::Constants::RDONLY and
File::Constants.const_defined?(:RDONLY) all resolve. The names stay defined on
File itself as well, so the integer-mode form of File.open
(File::WRONLY | File::CREAT | File::TRUNC) keeps working.

Verified against ruby 4.0.6. Full package coverage stays at 100.0%.
Zero-regression rubyspec sweep; core/file/constants/constants_spec 0 → 21,
core/file/constants_spec 11 → 19, core/file/open_spec 36 → 38,
core/file/file_spec 4 → 5.

🤖 Generated with Claude Code

File defined its open-mode and fnmatch flag constants directly on the class but
had no File::Constants module, and was missing the flock operations (LOCK_SH/
LOCK_EX/LOCK_NB/LOCK_UN) and the NONBLOCK/NOCTTY/SYNC/SHARE_DELETE open flags, so
File::Constants and File::LOCK_EX were uninitialized constants.

File::Constants is now a module carrying the open-mode, flock and fnmatch flag
constants (canonical Linux values — the specs only assert the names exist), and
File includes it, so File::RDONLY, File::Constants::RDONLY and
File::Constants.const_defined?(:RDONLY) all resolve. The names stay defined on
File itself as well, so the integer-mode form of File.open
(File::WRONLY | File::CREAT | File::TRUNC) keeps working.

Verified against ruby 4.0.6. Full package coverage stays at 100.0%. Zero-
regression rubyspec sweep; core/file/constants/constants_spec 0 -> 21,
core/file/constants_spec 11 -> 19, core/file/open_spec 36 -> 38, core/file/
file_spec 4 -> 5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit d50dd72 into main Aug 25, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/cluster29 branch August 25, 2026 23:13
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.

1 participant