guardian-framework 0.1.160 → 0.1.162

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.
package/dist/cli.js CHANGED
@@ -3206,7 +3206,7 @@ __export(exports_package, {
3206
3206
  bin: () => bin,
3207
3207
  author: () => author
3208
3208
  });
3209
- var name = "guardian-framework", version = "0.1.160", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3209
+ var name = "guardian-framework", version = "0.1.162", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3210
3210
  var init_package = __esm(() => {
3211
3211
  exports = {
3212
3212
  ".": {
package/dist/exports.js CHANGED
@@ -1991,7 +1991,7 @@ __export(exports_package, {
1991
1991
  bin: () => bin,
1992
1992
  author: () => author
1993
1993
  });
1994
- var name = "guardian-framework", version = "0.1.160", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1994
+ var name = "guardian-framework", version = "0.1.162", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1995
1995
  var init_package = __esm(() => {
1996
1996
  exports = {
1997
1997
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardian-framework",
3
- "version": "0.1.160",
3
+ "version": "0.1.162",
4
4
  "description": "Token-optimized agentic framework scaffolder with pi-first architecture",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-11-13T19:38:17Z",
2
+ "timestamp": "2026-11-13T20:21:08Z",
3
3
  "mode": "all",
4
4
  "stages_run": [],
5
5
  "summary": {
@@ -169,8 +169,24 @@ def deps_of(slug):
169
169
  return found
170
170
 
171
171
  def state_of(state, slug):
172
+ """frozen | implemented | frozen-stale | unfrozen.
173
+
174
+ A module that is genuinely implemented needs no freeze: implementation is a
175
+ stronger fact than a frozen contract. Without this, an implemented module
176
+ read as "unfrozen" and blocked every module that depends on it.
177
+ """
172
178
  e = entry(state, slug)
173
- return e.get("state") or ("frozen" if e.get("contractFrozen") else "unfrozen")
179
+ explicit = e.get("state")
180
+ doc = module_doc(slug)
181
+ text = read(doc) if doc else ""
182
+ m = re.search(r"\*\*Status:\*\*\s*([A-Za-z][A-Za-z ]*)", text)
183
+ doc_state = (m.group(1).strip().lower() if m else "")
184
+ implemented = doc_state.startswith(("implemented", "done", "complete"))
185
+ if implemented:
186
+ return "implemented"
187
+ if explicit:
188
+ return explicit
189
+ return "frozen" if e.get("contractFrozen") else "unfrozen"
174
190
 
175
191
  # ── the verification ────────────────────────────────────────────────────────
176
192
  STRUCTURAL_ONLY = re.compile(
@@ -190,6 +206,20 @@ SHAPE_ASSERT = re.compile(
190
206
  r"\bnames\b|annotations\[|startswith\(\s*[\"']set_|__dict__|dir\()"
191
207
  )
192
208
 
209
+ # Guardian's own generated scaffolding: `assert False, "TODO: ..."`. Red by
210
+ # construction, proves nothing — accepting it is how a "freeze" ends up with no
211
+ # net at all.
212
+ PLACEHOLDER = re.compile(
213
+ r"(assert\s+False\b|fail\(\s*[\"']TODO|t\.Fatal\(\s*[\"']Test not yet implemented|"
214
+ r"throw new Error\(\s*[\"']TODO|panic!\(\s*[\"']Test not yet implemented|"
215
+ r"TODO: uncomment when|TODO: implement dependency test)",
216
+ re.I,
217
+ )
218
+
219
+ def is_placeholder(src):
220
+ return bool(PLACEHOLDER.search(src))
221
+
222
+
193
223
  def classify(code):
194
224
  """Return 'behaviour' | 'structural' | 'none'."""
195
225
  asserts = [l for l in code.splitlines() if re.match(r"\s*assert\b", l)]
@@ -223,13 +253,18 @@ def find_tests(slug):
223
253
 
224
254
  def analyse_tests(slug, tests):
225
255
  """Return (total, behaviour, structural_only, ac_named, details)."""
226
- total = behaviour = struct_only = ac_named = 0
256
+ total = behaviour = struct_only = ac_named = placeholders = 0
227
257
  details = []
228
258
  for f in tests:
229
259
  src = read(f)
230
260
  if not src.strip():
231
261
  continue
232
262
  code = "\n".join(l for l in src.splitlines() if not l.strip().startswith("#"))
263
+ if is_placeholder(code):
264
+ placeholders += 1
265
+ details.append(f"{os.path.relpath(f, root)}: placeholder scaffolding (assert False/TODO)")
266
+ total += 1
267
+ continue
233
268
  kind = classify(code)
234
269
  body_struct = kind == "structural"
235
270
  body_behav = kind == "behaviour"
@@ -244,7 +279,7 @@ def analyse_tests(slug, tests):
244
279
  details.append(f"{os.path.relpath(f, root)}: structural assertions only")
245
280
  if acs:
246
281
  ac_named += 1
247
- return total, behaviour, struct_only, ac_named, details
282
+ return total, behaviour, struct_only, ac_named, details, placeholders
248
283
 
249
284
  def run_python_tests(tests):
250
285
  """Return (status, reason, sample) where status: red_ok|red_wrong|green|unknown."""
@@ -271,6 +306,12 @@ def verify(slug):
271
306
  checks = []
272
307
  ok_all = True
273
308
 
309
+ # Implemented modules need no freeze and cannot be re-frozen; they satisfy
310
+ # every dependency gate.
311
+ if state_of(load_state(), slug) == "implemented":
312
+ checks.append(("state", True, "implemented — no freeze required (dependency satisfied)"))
313
+ return True, checks, "", {"implemented": True, "contracts": [], "tests": []}
314
+
274
315
  doc = module_doc(slug)
275
316
  checks.append(("module doc", bool(doc), doc and os.path.relpath(doc, root) or f"missing .pi/architecture/modules/{slug}.md"))
276
317
  ok_all &= bool(doc)
@@ -303,11 +344,17 @@ def verify(slug):
303
344
 
304
345
  # 3. tests exist, are behaviour (not structural-only), and name ACs
305
346
  tests = find_tests(slug)
306
- total, behaviour, struct_only, ac_named, tdetails = analyse_tests(slug, tests)
347
+ total, behaviour, struct_only, ac_named, tdetails, placeholders = analyse_tests(slug, tests)
307
348
  ok_tests = bool(tests)
308
349
  checks.append(("contract tests", ok_tests, f"{len(tests)} file(s)" if tests else "no tests referencing the module"))
309
350
  ok_all &= ok_tests
310
351
 
352
+ ok_placeholder = placeholders == 0
353
+ checks.append(("no placeholders", ok_placeholder,
354
+ "no generated scaffolding" if ok_placeholder
355
+ else f"{placeholders} suite(s) are guardian scaffolding (assert False / TODO), not tests"))
356
+ ok_all &= ok_placeholder
357
+
311
358
  # Advisory only: a syntactic shape-vs-behaviour classifier is always
312
359
  # arguable. The objective gate is the RED check below — tests that are GREEN
313
360
  # over NotImplementedError bodies are structural by definition, whatever the
@@ -325,6 +372,10 @@ def verify(slug):
325
372
  # 4. RED for the right reason
326
373
  status, reason, sample = run_python_tests(tests) if tests else ("unknown", "no tests", "")
327
374
  ok_red = status == "red_ok"
375
+ if placeholders > 0 and status == "red_ok":
376
+ ok_red = False
377
+ reason = (f"{placeholders} placeholder suite(s) fail by construction — "
378
+ f"red is not evidence until they assert a rule")
328
379
  if status == "green":
329
380
  reason = ("tests are GREEN while the module is unimplemented — they assert shape, "
330
381
  "not rules; a freeze needs failing behaviour tests")