PR-03: Rules as data (scanner) - #26
Merged
Merged
Conversation
Extract all 106 patterns from dsgai_scanner_tool.md Step 2 into rules/dsgai-rules.yaml as the source of truth. Patterns are copied VERBATIM (v0.2 bugs preserved — fixes land in PR-11 as reviewable diffs); every PCRE verified byte-identical to the skill and confirmed to compile under rg --pcre2. - rules/rules.schema.json: draft 2020-12 schema; the full file validates. - Encoded compound logic from the Step 2 prose: subtract (P04.1-P04.2), requires_nearby (P11.1/P18.4/P20.5/P05.1/P06.5), exclude_globs (P12.6), gated_on (multimodal/synthetic_data/labeling), plus notes for absence-group rules not yet fully formalized. - Per-rule classification/signal/confidence seeded; all DSGAI02/13/14/15 rules are value_bearing (21 total). - build/generate_rules.py: one-time extraction bootstrap (kept for audit). - build/build_rules_json.py: repeatable YAML->JSON build (--check gates CI); the CLI loads the JSON with stdlib only, preserving the one-file install. - rules/README.md documents the format; CONTRIBUTING now links it; skill Step 2 banner marks the YAML canonical. Acceptance: schema validation passes; rule-ID set == skill pattern-ID set (diff empty); all four value-bearing controls carry classification:value_bearing.
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.
Phase 1 foundation. Extracts every detection pattern into reviewable, testable data. Depends on nothing; unblocks PR-04/05/11.
What's here
rules/dsgai-rules.yaml— all 106 patterns (P01.1–P21.4) extracted verbatim fromdsgai_scanner_tool.mdStep 2. v0.2 bugs are preserved on purpose so PR-11 fixes are clean diffs against a tested baseline.rules/rules.schema.json— draft 2020-12 schema; the whole file validates.rules/dsgai-rules.json— generated; the CLI loads it with stdlib only (no runtime PyYAML), preserving the one-file install story.build/generate_rules.py— one-time extraction bootstrap (kept for audit/provenance).build/build_rules_json.py— repeatable YAML→JSON build;--checkgates CI so the JSON can't drift.rules/README.md— field reference; CONTRIBUTING now links it; skill Step 2 carries a banner marking the YAML canonical.Encoded compound logic (from the Step 2 prose)
subtract: P04.1 − P04.2 (torch.load(withoutweights_only=True).requires_nearby: P11.1→P11.2 (±15), P18.4→P18.5 (±10), P20.5→P20.1/P20.2, P05.1→P05.2/P05.3 (module), P06.5→P06.2 (module, absent).exclude_globs: P12.6 excludes migrations/fixtures/tests.gated_on: P09.x multimodal, P10.x synthetic_data, P19.x labeling.notes: absence-group rules (P07/P08/P16/P17) captured faithfully pending formalization.Verification (all run locally)
rg --pcre2(0 failures).rg -o 'P\d\d\.\d+' skill | sort -u== rule IDs in YAML (empty diff).jsonschema.validate(...)acceptance command passes.value_bearing(21 total).scanner-lint(yamllint + md-link-check) green locally.Notes
remediation/referencesare left optional/unpopulated (Step 2 has no per-pattern remediation) — no fabrication; populated later.