Skip to content

(likely cosmetic) The UNSUPPORTED remedy says 'create a manual OPENANT.md override file' but not what it must contain — and seven near-miss override shapes are skipped silently (only a missing key inside a parsed fence warns) #735

Description

@gadievron

Summary (likely cosmetic)

The UNSUPPORTED remedy says "create a manual OPENANT.md override file" but
not what the file must contain — and the override loader skips seven
near-miss shapes silently (no warning): prose-only, an uppercase JSON fence tag, an untagged fence, an unclosed fence, a BOM before YAML
frontmatter, a leading blank line before frontmatter, and an empty file.
Only one failure mode warns (a missing key inside an otherwise-parsed fence).

Mechanism (at ad2bb7e)

  1. context/application_context.py:106 — the remedy line: "To analyze this
    repository, create a manual OPENANT.md override file." No shape stated.
  2. The loader (check_manual_override, :661-714): .md via a json fence
    (the re.search at :695) or YAML frontmatter (the re.match at
    :701), .json directly (:687-689); the except at :710 warns on
    parse errors — but a file whose fence/frontmatter did not
    match falls through both ifs to the return None at :713 with no
    warning (the only continue, at :685, is the file-absent branch).

Executed at ad2bb7e

$ python3 override_matrix.py
json fence                   -> parsed type=library [silent]
YAML frontmatter             -> parsed type=library [silent]
.openant.md lowercase        -> parsed type=library [silent]
CRLF file                    -> parsed type=library [silent]
BOM + json fence             -> parsed type=library [silent]
prose only                   -> None               [silent]
uppercase JSON fence tag     -> None               [silent]
untagged fence               -> None               [silent]
unclosed fence               -> None               [silent]
BOM + YAML frontmatter       -> None               [silent]
leading blank line           -> None               [silent]
empty file                   -> None               [silent]
fence missing purpose        -> None               [WARNED]
override_matrix.py — full script
#!/usr/bin/env python3
"""The override-file acceptance matrix: which shapes parse, which warn, which
silently skip. Run from the OpenAnt checkout root."""
import os, sys, json, tempfile, io, contextlib
sys.path.insert(0, "libs/openant-core")
from pathlib import Path
from context import application_context as ac

fence = chr(96) * 3
body = {"application_type": "library", "purpose": "probe"}
cases = [
  ("json fence",                 "OPENANT.md", "# ctx\n" + fence + "json\n" + json.dumps(body) + "\n" + fence + "\n"),
  ("YAML frontmatter",           "OPENANT.md", "---\napplication_type: library\npurpose: probe\n---\n"),
  (".openant.md lowercase",      ".openant.md", fence + "json\n" + json.dumps(body) + "\n" + fence + "\n"),
  ("CRLF file",                  "OPENANT.md", ("---\napplication_type: library\npurpose: probe\n---\n").replace("\n", "\r\n")),
  ("BOM + json fence",           "OPENANT.md", "\ufeff" + fence + "json\n" + json.dumps(body) + "\n" + fence + "\n"),
  ("prose only",                 "OPENANT.md", "# My app\nThis is a library.\n"),
  ("uppercase JSON fence tag",   "OPENANT.md", fence + "JSON\n" + json.dumps(body) + "\n" + fence + "\n"),
  ("untagged fence",             "OPENANT.md", fence + "\n" + json.dumps(body) + "\n" + fence + "\n"),
  ("unclosed fence",             "OPENANT.md", fence + "json\n" + json.dumps(body) + "\n"),
  ("BOM + YAML frontmatter",     "OPENANT.md", "\ufeff---\napplication_type: library\npurpose: probe\n---\n"),
  ("leading blank line",         "OPENANT.md", "\n---\napplication_type: library\npurpose: probe\n---\n"),
  ("empty file",                 "OPENANT.md", ""),
  ("fence missing purpose",      "OPENANT.md", fence + "json\n" + json.dumps({"application_type": "library"}) + "\n" + fence + "\n"),
]
for label, fn, content in cases:
    d = Path(tempfile.mkdtemp(prefix="mx.", dir=os.environ.get("TMPDIR")))
    (d / fn).write_text(content)
    err = io.StringIO()
    with contextlib.redirect_stderr(err):
        ctx = ac.check_manual_override(d)
    outcome = ("parsed type=" + str(getattr(ctx, "application_type", None))) if ctx else "None"
    warn = "WARNED" if err.getvalue().strip() else "silent"
    print(f"{label:28s} -> {outcome:18s} [{warn}]")

The ask (two halves)

  1. The remedy line names the required shape — a fenced JSON block or YAML
    frontmatter declaring application_type and purpose (a one-line fix at
    :106).
  2. A discovered override file that fails to load warns. Every silent shape
    in the matrix falls through the same two missed ifs to the one
    return None, so a single warning on that path covers all seven — the
    way the missing-key parse error already warns. (A maintainer who instead
    widens the matcher — the BOM-before-frontmatter and leading-blank-line
    cases are matcher quirks — makes those shapes parse, which equally
    removes their silence.)

Falsifier

The remedy naming the shape, and the fall-through path at the loader
warning (or the matcher widened so the quirk shapes parse). Authored at
filing time; no falsifier existed in the source record.

Prior art

None on the message or the loader's silence. An earlier one-line version of
this note landed in #720's thread (the UNSUPPORTED raise is that issue's
trigger); this issue supersedes it — the silent-skip set measured here is
broader than that note's "prose-only", and the remedy belongs to this file,
not that mechanism.

Fix-direction: neither — diagnostics and wording; no finding changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions