fix(keras): derive safe layer inventory from exports#718
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughA new generated inventory system is introduced to centralize known-safe Keras layer class names. A generation script auto-discovers and extracts layer names from the installed Keras source using AST parsing, producing a static Python module with a frozenset. The detector module now imports and uses this generated inventory instead of maintaining an inline definition. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
This fixes the false positives introduced by the custom Keras layer heuristic.
Instead of maintaining a hand-edited built-in layer allowlist, the scanner now reads from a generated inventory of public
keras.layers.*exports. The inventory is regenerated withscripts/generate_keras_layer_inventory.py, which parses the installed Keras source tree without making Keras a runtime dependency of the scanner.The follow-up also keeps regression coverage on real public layers that were misclassified (
RandomShearandRandomColorJitter) in both the H5 and.kerasscanners.Summary by CodeRabbit
Refactor
Tests