Skip to content

fix: resolve NV sentinel collision for direct mock_file_check#97

Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-nv-sentinel-direct-callback
Draft

fix: resolve NV sentinel collision for direct mock_file_check#97
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-nv-sentinel-direct-callback

Conversation

@Koan-Bot
Copy link
Copy Markdown
Contributor

@Koan-Bot Koan-Bot commented Apr 27, 2026

What

Complete fix for the -M/-C/-A sentinel collision where returning -1.0 from a direct mock_file_check callback was indistinguishable from FALLBACK_TO_REAL_OP.

Why

PR #87 fixed the mock_all_from_stat path via scalar ref wrapping, but the direct mock_file_check path still had the collision. A callback returning -1.0 (file 1 day in the future) was silently treated as fallback. Closes #88.

How

Make FALLBACK_TO_REAL_OP a dualvar: numeric -1 (backward compat for == -1 checks), string __OFC_FALLBACK__ (unique sentinel). The Perl-layer _check() now uses string comparison for NV ops, cleanly distinguishing real -1.0 from the sentinel.

Testing

  • Added 5 subtests to nv-sentinel-collision.t covering direct callbacks for -M/-A/-C returning exactly -1.0
  • Verified FALLBACK_TO_REAL_OP backward compat (numeric comparisons still work)
  • Full test suite passes (1491 tests)

🤖 Generated with Claude Code


Quality Report

Changes: 4 files changed, 86 insertions(+), 4 deletions(-)

Code scan: clean

Tests: passed (0 Tests)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

…allbacks

FALLBACK_TO_REAL_OP (-1) collides with the legitimate NV value -1.0
(file modified exactly 1 day in the future). PR cpan-authors#87 fixed the
mock_all_from_stat path via scalar ref wrapping, but direct
mock_file_check callbacks still had the collision.

Fix: make FALLBACK_TO_REAL_OP a dualvar (numeric -1, string
"__OFC_FALLBACK__"). The Perl-layer _check() now uses string
comparison for NV ops, distinguishing real -1.0 from the sentinel.
Numeric comparisons (== -1) remain backward compatible.

Closes cpan-authors#88

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

correctness: -M/-C/-A sentinel collision — -1.0 triggers silent FALLBACK

1 participant