cognitive-modules 0.5.0__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cognitive/__init__.py CHANGED
@@ -9,4 +9,4 @@ Usage:
9
9
  cog doctor # Check environment setup
10
10
  """
11
11
 
12
- __version__ = "0.5.0"
12
+ __version__ = "0.5.1"
cognitive/loader.py CHANGED
@@ -166,12 +166,23 @@ def load_v2_format(module_path: Path) -> dict:
166
166
  tier: Optional[ModuleTier] = manifest.get("tier")
167
167
  schema_strictness: SchemaStrictness = manifest.get("schema_strictness", "medium")
168
168
 
169
- overflow = manifest.get("overflow", {
170
- "enabled": False,
171
- "recoverable": True,
172
- "max_items": 5,
173
- "require_suggested_mapping": True
174
- })
169
+ # Determine default max_items based on strictness (SPEC-v2.2)
170
+ # high=0 (disabled), medium=5, low=20
171
+ strictness_max_items = {
172
+ "high": 0,
173
+ "medium": 5,
174
+ "low": 20
175
+ }
176
+ default_max_items = strictness_max_items.get(schema_strictness, 5)
177
+ default_enabled = schema_strictness != "high"
178
+
179
+ overflow_raw = manifest.get("overflow", {})
180
+ overflow = {
181
+ "enabled": overflow_raw.get("enabled", default_enabled),
182
+ "recoverable": overflow_raw.get("recoverable", True),
183
+ "max_items": overflow_raw.get("max_items", default_max_items),
184
+ "require_suggested_mapping": overflow_raw.get("require_suggested_mapping", True)
185
+ }
175
186
 
176
187
  enums = manifest.get("enums", {
177
188
  "strategy": "extensible" if tier in ("decision", "exploration") else "strict",
cognitive/migrate.py CHANGED
@@ -265,13 +265,19 @@ def _migrate_from_v2(
265
265
  manifest_changes.append("Added schema_strictness: medium")
266
266
 
267
267
  if 'overflow' not in manifest:
268
+ # Determine default max_items based on schema_strictness (consistent with loader.py)
269
+ schema_strictness = manifest.get('schema_strictness', 'medium')
270
+ strictness_max_items = {'high': 0, 'medium': 5, 'low': 20}
271
+ default_max_items = strictness_max_items.get(schema_strictness, 5)
272
+ default_enabled = schema_strictness != 'high'
273
+
268
274
  manifest['overflow'] = {
269
- 'enabled': True,
275
+ 'enabled': default_enabled,
270
276
  'recoverable': True,
271
- 'max_items': 5,
277
+ 'max_items': default_max_items,
272
278
  'require_suggested_mapping': True
273
279
  }
274
- manifest_changes.append("Added overflow config")
280
+ manifest_changes.append(f"Added overflow config (max_items={default_max_items} based on schema_strictness={schema_strictness})")
275
281
 
276
282
  if 'enums' not in manifest:
277
283
  manifest['enums'] = {