Repository navigation
feat: optional active_grammars with shipped-grammar fallback - #20
Conversation
Slash-delimited ISO dates share ISO 8601's calendar-date position mapping and canonical form, so the new grammar wires into the existing Section 4.3.1 rule via target_grammars. Recognizes 4-digit-year-first slash dates that previously resolved MISSING.
README gains the slash-ISO format in the Date table, capability blurb, and a worked example. HOW_TO_ADD_NEW_GRAMMAR.md is a new contributor guide for teaching an existing capability a new representation, using the slash-ISO grammar as its validated worked example.
CapabilityContract.active_grammars returns None instead of being abstract; the engine falls back to the capability's shipped get_grammars() names, in order. Adding a grammar to get_grammars() now activates it with no contract edit. Community grammars stay opt-in via extra_grammars — the fallback never activates them. Gated capabilities (Email, IP, ISBN) keep their feature-flag overrides; all-active capabilities drop them next.
Both contracts return None now; the engine runs every shipped grammar.
HOW_TO_ADD_NEW_CAPABILITY.md: active_grammars is optional — implement only for feature-gated recognition; static always-all overrides are now an anti-pattern. ARCHITECTURE.md and CONTEXT.md describe the engine's fallback to every shipped get_grammars() entry. The homogeneity audit marks F5 (static vs toggleable active_grammars) resolved 2026-08-11.
📝 WalkthroughWalkthroughThe PR makes ChangesGrammar activation defaults
Slash-ISO date recognition
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
HOW_TO_ADD_NEW_GRAMMAR.md (1)
15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the root specification a required first step.
Line 15 only references
HOW_TO_ADD_NEW_CAPABILITY.md. Require contributors to read it before modifying a capability directory. State that the root specification prevails if this guide conflicts with it.Based on learnings: “Before modifying a capability directory, read the root
HOW_TO_ADD_NEW_CAPABILITY.md; where it conflicts with this compact guide, the root specification prevails.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@HOW_TO_ADD_NEW_GRAMMAR.md` at line 15, Update the introductory guidance in HOW_TO_ADD_NEW_GRAMMAR.md to require contributors to read HOW_TO_ADD_NEW_CAPABILITY.md before modifying any capability directory, and explicitly state that the root specification takes precedence whenever the two guides conflict.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@HOW_TO_ADD_NEW_GRAMMAR.md`:
- Line 15: Update the introductory guidance in HOW_TO_ADD_NEW_GRAMMAR.md to
require contributors to read HOW_TO_ADD_NEW_CAPABILITY.md before modifying any
capability directory, and explicitly state that the root specification takes
precedence whenever the two guides conflict.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 77a1abf4-44c1-4506-b354-0aa08e50586d
📒 Files selected for processing (31)
ARCHITECTURE.mdCONTEXT.mdHOW_TO_ADD_NEW_CAPABILITY.mdHOW_TO_ADD_NEW_GRAMMAR.mdREADME.mdcapability_homogeneity_audit.mdpaxman/capabilities/AGENTS.mdpaxman/capabilities/Country/contract.pypaxman/capabilities/Currency/contract.pypaxman/capabilities/Date/capability.pypaxman/capabilities/Date/contract.pypaxman/capabilities/Date/grammar/slash_iso_recognition.pypaxman/capabilities/Date/rules/iso_8601_ed2019.pypaxman/capabilities/Money/contract.pypaxman/capabilities/Phone/contract.pypaxman/capabilities/URL/contract.pypaxman/core/AGENTS.mdpaxman/core/capability_contract.pypaxman/core/contract.pypaxman/engine/orchestrator.pytests/capabilities/country/test_capability.pytests/capabilities/currency/test_contract.pytests/capabilities/date/test_capability.pytests/capabilities/date/test_grammar.pytests/capabilities/money/test_contract.pytests/capabilities/phone/test_capability.pytests/capabilities/url/test_capability.pytests/capabilities/url/test_contract.pytests/integration/test_date_capability.pytests/integration/test_recognition_seam.pytests/unit/test_capability_contract.py
💤 Files with no reviewable changes (6)
- paxman/capabilities/Phone/contract.py
- paxman/capabilities/Money/contract.py
- paxman/capabilities/Country/contract.py
- paxman/capabilities/Currency/contract.py
- paxman/capabilities/URL/contract.py
- paxman/capabilities/Date/contract.py
Summary
Makes
active_grammarsoptional so every capability accepts new shipped grammars with a single-line change toget_grammars().Change
CapabilityContract.active_grammarsreturnsNoneby default (was abstract) — the engine falls back to the capability's shippedget_grammars()names, in order.active_grammarsoverrides.extra_grammars; the fallback never activates them.Also included: the slash-ISO date grammar (
YYYY/MM/DD) with its new contributor guideHOW_TO_ADD_NEW_GRAMMAR.md, which uses that grammar as its worked example.Verification
ruff check paxman/ tests/+ruff format --check paxman/ tests/— cleanpyright— 0 errorsimport-linter lint— contracts keptpytest— 2082 passedCommits (8)
feat(date): slash-ISO grammar + testsdocs(date): README + new-grammar guiderefactor(core): optionalactive_grammars+ engine fallback + tests4–6.
refactor(capabilities): drop static overrides (by capability pair, with paired test rewrites)7–8.
docs: guides, architecture, audit (F5 marked resolved), AGENTS.mdSummary by CodeRabbit
New Features
2024/3/7, with canonical ISO formatting and support for single-digit components.Improvements
Documentation