Repository navigation
Close the fail-open in check_files' step 3 (DID-matlab#200) - #86
Merged
Merged
Conversation
check_files' step 3 looped over the actual file_info entries and fell through to is_valid = True when a required name had none -- an empty match loop, the same fail-open PR #182 closed for step 1, one step further down. A demoFile document declaring both filename1.ext and filename2.ext but binding neither was accepted by add_docs and only noticed at read time. Ported from DID-matlab 0ffc1b5 / PR #200. check_files now separates the two absences: a name missing from the document's file_list keeps the existing message, and a name that IS in the file_list with nothing bound for it gets its own, naming the file and file_info rather than sending the reader to the field that is correct. The other half of DID-matlab#200 -- reading file_list independently of file_info to survive a throw on the latter -- is not a bug on the Python side. _validate_files already reads the two fields independently and did not share MATLAB's try/catch shape, so no code change beyond check_files was needed. Mutation-checked: removing the guard turns the two diagnosis-pinning tests red and leaves the four guards green. Bridge: - database.matlab_last_sync_hash bumped ec1e733 -> 9b36124. - checkfiles decision_log records the port and its coverage. - sync_notes names the change and why the try/catch half was skipped. Coverage: tests/test_validation.py:TestFileValidationDiagnosis, six tests mirroring MATLAB's TestFileValidationDiagnosis one for one. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015sRBh2MWZi2LfLBszaDuuB
This was referenced Sep 9, 2026
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.
Summary
Ports the actionable half of DID-matlab#200 into Python.
check_files' step 3 looped over the actualfile_infoentries and fell through tois_valid = Truewhen a required name had none — the same fail-open PR #182 closed for step 1, one step further down. AdemoFiledocument declaring bothfilename1.extandfilename2.extbut binding neither was accepted byadd_docsand only noticed at read time.check_filesnow separates the two absences:file_listkeeps the existing message.file_listwith nothing bound for it gets its own message, naming the file andfile_inforather than sending the reader to the field that is correct.The other half of DID-matlab#200 — reading
file_listindependently offile_infoso a throw on the latter doesn't discard the former — is not a bug on the Python side._validate_filesalready reads the two fields independently and did not share MATLAB's try/catch shape, so no code change beyondcheck_fileswas needed.Everything else DID-matlab merged in the last 48 hours (PRs #190–#198) was already ported to DID-python in the same window in #76–#85.
Changes
src/did/validate.py—check_filesstep 3 no longer silently passes an unbound required file.tests/test_validation.py— newTestFileValidationDiagnosis(6 tests, mirroring MATLAB'sTestFileValidationDiagnosisone for one). Mutation-checked: reverting the guard turns the two diagnosis-pinning tests red and leaves the four keep-passing guards (no files section, optional files unbound, bound required files, unit-levelcheck_files) green.src/did/did_matlab_python_bridge.yaml— bumpeddatabase.matlab_last_sync_hashec1e733→9b36124and recorded the port in thecheckfilesdecision log andsync_notes.Test plan
pytest tests/ --ignore=tests/symmetry— 699 passed, 1 xfailedpytest tests/symmetry— 23 passed, 10 skipped (expected)black --check src/ tests/(pinned 26.5.1) — cleanruff check src/ tests/(pinned 0.16.5) — cleanvalidate.py, tests fail exactly as intended; restore, tests pass🤖 Generated with Claude Code
https://claude.ai/code/session_015sRBh2MWZi2LfLBszaDuuB
Generated by Claude Code