feat(okf-v0.2): D4 — door C surfaces the §10 pointers it imports [skip-docs]
V6, settled by the operator today: import and report, not refuse. Door C imports the POINTER to executable code and never the code — it writes concepts verbatim and skips every non-`.md` file. So an imported Attested Computation can name an `executor`/`attester` resource that did not arrive, or one that RESOLVES against a file the destination tree already holds under that path. The second is the outcome worth surfacing: it looks valid. Refusing was the plan's leaning and is not what shipped. §14 forbids a consumer to reject a bundle over a broken cross-link and does not settle whether `executor.resource` is one; §10.5 asks a consumer to surface rather than silently drop. Reporting honours the second without testing the first, and leaves the door's one invariant — verbatim bytes — alone. `ImportResult.unverified_references` is an advisory over the merged set, not a fifth bucket: every concept it names has already merged, the bytes are unchanged, and a refused concept is never named (there is no imported pointer to check). The report is at KEY level, and that is a measured limit rather than a choice. Resolving the resource means reading `executor.resource` — the value the line-oriented parser cannot recover in either canonical form: a block mapping flattens and collides, a flow mapping stays one opaque string. A resource-level report would be empty or wrong on exactly the forms upstream writes. Precision arrives with the structured reader (D1b); the key-level signal is robust in both forms today. [skip-docs] is on the CLAUDE.md half only: README carries the new public surface (`unverified_references`), and the invariant this work put in CLAUDE.md — flow form, never block — landed with the previous commit and needs no restatement. 584 tests, mypy --strict clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KKKMwi7e7PVHoFW6dJK5XP
This commit is contained in:
parent
deeb248091
commit
c6d64c3fd6
4 changed files with 188 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ import pytest
|
|||
|
||||
from llm_ingestion_okf.materialize import parse_frontmatter
|
||||
from llm_ingestion_okf.profiles import DEFAULT, OKF_V0_2, STRICT_V1, FrontmatterSchema
|
||||
from test_import_flow import CONCEPT, StubImportGate, place, run
|
||||
|
||||
ATTESTED = "Attested Computation"
|
||||
|
||||
|
|
@ -193,3 +194,122 @@ def test_two_nested_block_mappings_sharing_a_key_collide_in_the_scalar_parser(
|
|||
assert parsed["attester"] == ""
|
||||
assert parsed["resource"] == "attesters/revenue.py"
|
||||
assert "skills/run-on-bq.md" not in parsed.values()
|
||||
|
||||
|
||||
# --- door C surfaces the §10 pointers it imports ---------------------------
|
||||
#
|
||||
# V6, decided by the operator 2026-07-31. Door C imports the POINTER to
|
||||
# executable code while never importing the code: it writes concepts verbatim
|
||||
# and skips every non-`.md` file. So an imported Attested Computation can
|
||||
# reference an executor or attester that did not arrive — or, worse, one that
|
||||
# resolves to a file the destination tree already holds under that name.
|
||||
#
|
||||
# The operator ruled: import and report, not refuse. Refusing sits against §14
|
||||
# (a consumer MUST NOT reject a bundle for broken cross-links, and whether
|
||||
# `executor.resource` is one the spec does not settle), while §10.5 asks a
|
||||
# consumer to surface rather than silently drop. Reporting satisfies the second
|
||||
# without testing the first.
|
||||
#
|
||||
# The report is at KEY level, not resource level, and that is a measured limit
|
||||
# rather than a choice: resolving the resource means reading `executor.resource`,
|
||||
# which is exactly the value this library's parser cannot recover (see above).
|
||||
# Precision arrives with the structured reader (D1b).
|
||||
|
||||
|
||||
def test_a_merged_concept_declaring_an_executor_is_reported(tmp_path: Path) -> None:
|
||||
gate = StubImportGate()
|
||||
place(
|
||||
tmp_path / "source",
|
||||
"computations/margin.md",
|
||||
"---\ntype: Attested Computation\nruntime: bigquery\n"
|
||||
"executor: { resource: skills/run-on-bq.md, receipt: [job_id] }\n---\n\n# Computation\n",
|
||||
)
|
||||
|
||||
result, _ = run(tmp_path, gate)
|
||||
|
||||
assert [(r.concept_path, r.key) for r in result.unverified_references] == [
|
||||
("computations/margin.md", "executor")
|
||||
]
|
||||
|
||||
|
||||
def test_the_block_form_is_reported_too(tmp_path: Path) -> None:
|
||||
"""The form whose VALUE the parser loses. Key presence survives it, which is
|
||||
what makes a key-level report robust where a resource-level one would be
|
||||
silently empty on exactly the canonical presentation."""
|
||||
gate = StubImportGate()
|
||||
place(
|
||||
tmp_path / "source",
|
||||
"computations/margin.md",
|
||||
"---\ntype: Attested Computation\nruntime: bigquery\n"
|
||||
"attester:\n resource: attesters/margin.py\n---\n\n# Computation\n",
|
||||
)
|
||||
|
||||
result, _ = run(tmp_path, gate)
|
||||
|
||||
assert [(r.concept_path, r.key) for r in result.unverified_references] == [
|
||||
("computations/margin.md", "attester")
|
||||
]
|
||||
|
||||
|
||||
def test_both_pointers_are_reported_in_deterministic_order(tmp_path: Path) -> None:
|
||||
gate = StubImportGate()
|
||||
place(
|
||||
tmp_path / "source",
|
||||
"computations/margin.md",
|
||||
"---\ntype: Attested Computation\nruntime: bigquery\n"
|
||||
"executor: { resource: skills/run-on-bq.md }\n"
|
||||
"attester: { resource: attesters/margin.py }\n---\n\n# Computation\n",
|
||||
)
|
||||
|
||||
result, _ = run(tmp_path, gate)
|
||||
|
||||
assert [(r.concept_path, r.key) for r in result.unverified_references] == [
|
||||
("computations/margin.md", "attester"),
|
||||
("computations/margin.md", "executor"),
|
||||
]
|
||||
|
||||
|
||||
def test_a_concept_carrying_neither_pointer_is_not_reported(tmp_path: Path) -> None:
|
||||
gate = StubImportGate()
|
||||
place(tmp_path / "source", "users.md", CONCEPT)
|
||||
|
||||
result, _ = run(tmp_path, gate)
|
||||
|
||||
assert result.unverified_references == ()
|
||||
|
||||
|
||||
def test_the_report_changes_neither_the_verdict_nor_the_bytes(tmp_path: Path) -> None:
|
||||
"""Advisory, and only advisory. The concept merges, and it merges verbatim:
|
||||
Door C's one invariant is that it never rewrites a sender's bytes, and a
|
||||
report that moved a concept out of `merged` would be the refusal the
|
||||
operator did not choose."""
|
||||
document = (
|
||||
"---\ntype: Attested Computation\nruntime: bigquery\n"
|
||||
"executor: { resource: skills/run-on-bq.md }\n---\n\n# Computation\n"
|
||||
)
|
||||
gate = StubImportGate()
|
||||
place(tmp_path / "source", "computations/margin.md", document)
|
||||
|
||||
result, bundle = run(tmp_path, gate)
|
||||
|
||||
assert [entry.concept_path for entry in result.merged] == ["computations/margin.md"]
|
||||
assert result.merged[0].path.read_text(encoding="utf-8") == document
|
||||
assert result.unverified_references != ()
|
||||
|
||||
|
||||
def test_a_refused_concept_is_never_reported(tmp_path: Path) -> None:
|
||||
"""Nothing was written, so there is no imported pointer to surface. A report
|
||||
on a refused concept would tell an operator to check a file that does not
|
||||
exist."""
|
||||
gate = StubImportGate(by_marker={"Attested Computation": "fail_secure"})
|
||||
place(
|
||||
tmp_path / "source",
|
||||
"computations/margin.md",
|
||||
"---\ntype: Attested Computation\nruntime: bigquery\n"
|
||||
"executor: { resource: skills/run-on-bq.md }\n---\n\n# Computation\n",
|
||||
)
|
||||
|
||||
result, _ = run(tmp_path, gate)
|
||||
|
||||
assert result.merged == ()
|
||||
assert result.unverified_references == ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue