Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/scripts/test_execution_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,31 @@ def status_text() -> str:


class ExecutionStatusTests(unittest.TestCase):
def test_status_is_scoped_to_internal_closeout(self) -> None:
def test_status_is_scoped_to_internal_continuation(self) -> None:
text = status_text()

self.assertIn(
"Status: Pre-alpha / internal Milestone C artifact-validation closeout.",
"Status: Pre-alpha / internal transition from Milestone C artifact-validation "
"closeout to Milestone D source-only contract work.",
text,
)
self.assertIn("docs/milestone-d-verify-citations-contract.md", text)
self.assertNotIn("Status: Pre-alpha / Milestone B entry.", text)

def test_internal_check_command_is_documented(self) -> None:
text = status_text()

self.assertIn("make milestone-b-internal-checks", text)
self.assertIn("make milestone-c-internal-checks", text)
self.assertIn("make milestone-d-verify-citations-contract", text)
self.assertIn("CI has a static guard for that target's command wiring", text)

def test_public_posture_boundary_remains_explicit(self) -> None:
text = status_text()

self.assertIn(
'Public language stays at "pre-alpha / internal Milestone C artifact-validation closeout"',
'Public language stays at "source-only pre-alpha / internal Milestone C closeout '
'and Milestone D contract continuation"',
text,
)
self.assertIn("claim audit approves specific wording", text)
Expand Down
126 changes: 126 additions & 0 deletions .github/scripts/test_milestone_d_verify_citations_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/usr/bin/env python3
#
# Copyright 2026 The Ethos maintainers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from __future__ import annotations

import re
import unittest
from pathlib import Path

from makefile_guard import makefile_text, target_block


ROOT = Path(__file__).resolve().parents[2]
CONTRACT = ROOT / "docs/milestone-d-verify-citations-contract.md"
ROADMAP = ROOT / "docs/roadmap.md"
EXECUTION_STATUS = ROOT / "docs/execution-status.md"
SCHEMAS_README = ROOT / "schemas/README.md"


def contract_text() -> str:
return CONTRACT.read_text(encoding="utf-8")


def normalized_contract_text() -> str:
return re.sub(r"\s+", " ", contract_text())


class MilestoneDVerifyCitationsContractTests(unittest.TestCase):
def test_target_is_declared_phony(self) -> None:
text = makefile_text()

self.assertIn(".PHONY:", text)
self.assertIn("milestone-d-verify-citations-contract", text)

def test_target_composes_contract_gates(self) -> None:
block = target_block("milestone-d-verify-citations-contract")

required = [
"cargo test --locked -p ethos-cli --test verify",
"$(PYTHON) schemas/validate_examples.py",
"$(PYTHON) .github/scripts/test_execution_status.py",
"$(PYTHON) .github/scripts/test_roadmap_status.py",
"$(PYTHON) .github/scripts/test_milestone_d_verify_citations_contract.py",
"git diff --check",
]
for command in required:
self.assertIn(command, block)

def test_target_stays_contract_scoped(self) -> None:
block = target_block("milestone-d-verify-citations-contract")

for out_of_scope in [
"verify-alpha",
"rag-chunk-alpha",
"security-report-alpha",
"verify-rendered-crops",
"compare-rendered-crops",
"layout-evaluator-alpha",
"python-surface-test",
"release-",
"third-party-license-manifest",
]:
self.assertNotIn(out_of_scope, block)

def test_contract_is_linked_from_status_docs(self) -> None:
for path in [ROADMAP, EXECUTION_STATUS, SCHEMAS_README]:
text = path.read_text(encoding="utf-8")
self.assertIn("milestone-d-verify-citations-contract.md", text, path)

def test_contract_defines_existing_carrier_not_new_surface(self) -> None:
text = normalized_contract_text()

self.assertIn("source-only pre-alpha contract work", text)
self.assertIn("The current executable carrier remains `ethos verify`", text)
self.assertIn("does not create a new public command, binding, or hosted surface", text)
self.assertIn(
"`verify_citations` names the contract between citation input, grounding source, "
"verification config, and verification report",
text,
)

def test_contract_pins_v1_supported_and_blocked_scope(self) -> None:
text = normalized_contract_text()

for kind in ["`quote`", "`value`", "`presence`", "`table_cell`"]:
self.assertIn(kind, text)
self.assertIn("`region` and `other` remain explicit unsupported non-v1 inputs", text)

for blocker in [
"a new `verify_citations` CLI alias",
"Python, Node, MCP, or hosted API surfaces",
"crop API implementation",
"sandbox/subprocess backend expansion",
"semantic or arithmetic verification",
]:
self.assertIn(blocker, text)

def test_contract_names_fixture_backed_validation(self) -> None:
text = normalized_contract_text()

self.assertIn("`schemas/examples/citations.example.json`", text)
self.assertIn("`schemas/examples/verification-report.example.json`", text)
self.assertIn("echoes the example claims in input order", text)
self.assertIn("`all_evidence_grounded` is true only under the invariant", text)
self.assertIn(
"`make milestone-d-verify-citations-contract PYTHON=<jsonschema-venv>/bin/python`",
text,
)


if __name__ == "__main__":
unittest.main()
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COMPARE_RENDERED_CROPS_LEFT ?= $(VERIFY_RENDERED_CROPS_OUT)/run1
COMPARE_RENDERED_CROPS_RIGHT ?= $(VERIFY_RENDERED_CROPS_OUT)/run2
LAYOUT_EVALUATOR_OUT ?= $(ROOT)/target/layout-evaluator-alpha

.PHONY: verify-alpha verify-alpha-tree rag-chunk-alpha security-report-alpha verify-rendered-crops compare-rendered-crops layout-evaluator-alpha python-surface-test milestone-b-internal-checks milestone-c-internal-checks release-hygiene release-advisory third-party-license-manifest release-notice-draft
.PHONY: verify-alpha verify-alpha-tree rag-chunk-alpha security-report-alpha milestone-d-verify-citations-contract verify-rendered-crops compare-rendered-crops layout-evaluator-alpha python-surface-test milestone-b-internal-checks milestone-c-internal-checks release-hygiene release-advisory third-party-license-manifest release-notice-draft

$(ETHOS_BIN):
cargo build --locked -p ethos-cli
Expand Down Expand Up @@ -47,6 +47,14 @@ security-report-alpha:
$(PYTHON) .github/scripts/test_security_report_alpha.py
git diff --check

milestone-d-verify-citations-contract:
cargo test --locked -p ethos-cli --test verify
$(PYTHON) schemas/validate_examples.py
$(PYTHON) .github/scripts/test_execution_status.py
$(PYTHON) .github/scripts/test_roadmap_status.py
$(PYTHON) .github/scripts/test_milestone_d_verify_citations_contract.py
git diff --check

verify-rendered-crops: $(ETHOS_BIN)
$(PYTHON) examples/verify/check_rendered_crops.py --repo-root $(ROOT) --ethos-bin $(ETHOS_BIN) --out-dir $(VERIFY_RENDERED_CROPS_OUT)
git diff --check
Expand Down
Loading
Loading