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
4 changes: 3 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ALEPHTAV_ROOT_DIR: /tmp/alephtav-ci
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -28,4 +30,4 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: audit-reports
path: reports/
path: /tmp/alephtav-ci/reports/
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 25
env:
ALEPHTAV_ROOT_DIR: /tmp/alephtav-ci
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ALEPHTAV_ROOT_DIR: /tmp/alephtav-ci
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
5 changes: 3 additions & 2 deletions app/services/foundation_contract_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import json
import unicodedata
from pathlib import Path
from pathlib import Path, PureWindowsPath
from typing import Any

from jsonschema import Draft202012Validator, RefResolver # type: ignore[import-untyped]
Expand All @@ -23,7 +23,8 @@ def validate_contract(schema_name: str, payload: Any) -> None:
def workspace_path(value: str) -> Path:
root = get_settings().root_dir.resolve()
relative = Path(value)
if relative.is_absolute() or ".." in relative.parts or "\\" in value:
is_drive_path = bool(PureWindowsPath(value).drive)
if relative.is_absolute() or is_drive_path or ".." in relative.parts or "\\" in value:
raise ValueError("Package paths must be portable relative workspace paths")
result = (root / relative).resolve()
if not result.is_relative_to(root) or result == root:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
{ name = "AlphaOmega Contributors" }
]
dependencies = [
"fastapi>=0.115.0",
"fastapi>=0.115.0,<0.137",
"uvicorn[standard]>=0.30.0",
"typer>=0.12.3",
"pydantic>=2.8.0",
Expand Down
35 changes: 8 additions & 27 deletions scripts/generate_research_portfolio_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4426,12 +4426,7 @@ def build_dashboard() -> dict[str, Any]:
f"{oshb_exception['sequence_only_exception_verse_count']} sequence-only "
"exceptions. "
+ (
f"All {
oshb_exception.get(
'review_row_count',
oshb_exception['sample_row_count'],
)
} "
f"All {oshb_exception.get('review_row_count', oshb_exception['sample_row_count'])} "
"review rows are exported, but reviewer signoff is still absent."
if int(oshb_exception["unexported_exception_row_count"]) == 0
else (
Expand Down Expand Up @@ -8241,19 +8236,15 @@ def render_html(dashboard: dict[str, Any]) -> str:
"OSHB exceptions",
fmt_int(headline["oshb_exception_review_mismatch_verse_count"]),
(
f'{fmt_int(headline[
"oshb_exception_review_token_count_exception_verse_count"
])} '
f'{fmt_int(headline["oshb_exception_review_token_count_exception_verse_count"])} '
"token-count exceptions."
),
),
(
"OSHB review rows",
fmt_int(headline["oshb_exception_review_review_row_count"]),
(
f'{fmt_int(headline[
"oshb_exception_review_unexported_exception_row_count"
])} '
f'{fmt_int(headline["oshb_exception_review_unexported_exception_row_count"])} '
"rows remain unexported."
),
),
Expand All @@ -8277,29 +8268,23 @@ def render_html(dashboard: dict[str, Any]) -> str:
"OSHB rule-routing",
f'{headline["oshb_mapping_rule_simulation_candidate_rule_reduction_pct"]:.2f}%',
(
f'{fmt_int(headline[
"oshb_mapping_rule_simulation_rule_candidate_after_review_count"
])} '
f'{fmt_int(headline["oshb_mapping_rule_simulation_rule_candidate_after_review_count"])} '
"high-confidence rows; candidate only."
),
),
(
"OSHB residual",
fmt_int(headline["oshb_mapping_rule_simulation_manual_residual_row_count"]),
(
f'{fmt_int(headline[
"oshb_mapping_rule_simulation_targeted_rule_review_count"
])} '
f'{fmt_int(headline["oshb_mapping_rule_simulation_targeted_rule_review_count"])} '
"targeted-rule review rows."
),
),
(
"Morph unlock units",
fmt_int(headline["morph_unlock_unlockable_units"]),
(
f'{headline[
"morph_unlock_projected_review_ready_score_pct"
]:.2f}% '
f'{headline["morph_unlock_projected_review_ready_score_pct"]:.2f}% '
"projected review-ready lane score."
),
),
Expand Down Expand Up @@ -8556,9 +8541,7 @@ def render_html(dashboard: dict[str, Any]) -> str:
(
f'{fmt_int(headline["local_bakeoff_contextual_attempt_count"])} '
"contextual attempts; "
f'{fmt_int(headline[
"local_bakeoff_contextual_source_anchor_issues"
])} '
f'{fmt_int(headline["local_bakeoff_contextual_source_anchor_issues"])} '
"anchor issues."
),
),
Expand Down Expand Up @@ -11923,9 +11906,7 @@ def render_html(dashboard: dict[str, Any]) -> str:
"Unlockable units",
fmt_int(headline["morph_unlock_unlockable_units"]),
(
f'{headline[
"morph_unlock_projected_review_ready_score_pct"
]:.2f}% '
f'{headline["morph_unlock_projected_review_ready_score_pct"]:.2f}% '
"projected review-ready lane score."
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,7 @@ def build_gate_rows(
"evidence": (
(
"OSHB exception workbook exports "
f"{
exception_summary.get(
'review_row_count',
exception_summary.get('sample_row_count', 0),
)
} "
f"{exception_summary.get('review_row_count', exception_summary.get('sample_row_count', 0))} "
"review rows for "
f"{exception_summary.get('mismatch_verse_count', 0)} remaining "
"exception verses; "
Expand Down
15 changes: 1 addition & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@
os.environ["ALEPHTAV_ROOT_DIR"] = str(TEST_ROOT)


def _link_or_copy(source: Path, target: Path) -> None:
if target.exists() or target.is_symlink():
return
target.parent.mkdir(parents=True, exist_ok=True)
try:
target.symlink_to(source, target_is_directory=source.is_dir())
except OSError:
if source.is_dir():
shutil.copytree(source, target)
else:
shutil.copy2(source, target)


def _copy_tree(source: Path, target: Path) -> None:
if target.is_symlink() or target.is_file():
target.unlink()
Expand All @@ -45,7 +32,7 @@ def _copy_tree(source: Path, target: Path) -> None:


TEST_ROOT.mkdir(parents=True, exist_ok=True)
_link_or_copy(ROOT / "schemas", TEST_ROOT / "schemas")
_copy_tree(ROOT / "schemas", TEST_ROOT / "schemas")

from tests.support import bootstrap_fixture_repo # noqa: E402

Expand Down
2 changes: 1 addition & 1 deletion tests/golden/test_composer_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
FIXTURES_DIR = Path(__file__).resolve().parent / "fixtures"
COMPOSER_FIXTURE = FIXTURES_DIR / "composer_quality.json"
COMPOSER_SOURCE = Path(__file__).resolve().parents[2] / "app/ui/src/lib/composerSynthesis.ts"
pytestmark = pytest.mark.no_seeded_repo
pytestmark = [pytest.mark.no_seeded_repo, pytest.mark.usefixtures("fixture_sources")]


def _load_fixture() -> dict[str, object]:
Expand Down
6 changes: 5 additions & 1 deletion tests/golden/test_composer_quality_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
write_audit_reports,
)

pytestmark = [pytest.mark.no_seeded_repo, pytest.mark.corpus_audit]
pytestmark = [
pytest.mark.no_seeded_repo,
pytest.mark.corpus_audit,
pytest.mark.usefixtures("fixture_sources"),
]


def test_full_psalter_composer_audit_writes_report(tmp_path_factory) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_greek_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_without_owner_approval_the_released_message_is_unchanged(staged, tmp_pa


def test_package_changed_after_approval_shows_no_text(staged):
unit_file = next((staged / "psalms").rglob("*.json"))
unit_file = next((staged / "psalms" / "ps001").rglob("*.json"))
unit_file.write_bytes(unit_file.read_bytes().replace("ἀνὴρ".encode(), "ἀνήρ".encode()))
result = sources.greek_evidence("ps001")
assert result["available"] is False
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_versification.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ def _table() -> dict:
return json.loads((ROOT / "content" / "versification.json").read_text(encoding="utf-8"))


@pytest.fixture
def committed_table(monkeypatch: pytest.MonkeyPatch) -> None:
from app.core import versification

# This module runs unseeded, so the workspace has no table of its own.
monkeypatch.setattr(versification, "_table", lambda: _table()["psalms"])


def test_table_covers_the_whole_psalter() -> None:
psalms = _table()["psalms"]

Expand Down Expand Up @@ -118,6 +126,7 @@ def test_a_psalm_without_a_superscription_displays_its_masoretic_reference() ->
assert versification.display_reference("ps001", "Psalm 1:6", 6) == "Psalm 1:6"


@pytest.mark.usefixtures("committed_table")
def test_superscription_verses_are_labelled_rather_than_misnumbered() -> None:
from app.core import versification

Expand All @@ -127,6 +136,7 @@ def test_superscription_verses_are_labelled_rather_than_misnumbered() -> None:
assert versification.display_reference("ps051", "Psalm 51:2", 2) == "Psalm 51 (heading)"


@pytest.mark.usefixtures("committed_table")
def test_verses_after_a_superscription_shift_to_english_numbering() -> None:
from app.core import versification

Expand All @@ -139,6 +149,7 @@ def test_verses_after_a_superscription_shift_to_english_numbering() -> None:
assert versification.display_reference("ps003", "Psalm 3:2", 2) == "Psalm 3:1"


@pytest.mark.usefixtures("committed_table")
def test_canonical_numbering_reports_the_greek_divergence() -> None:
from app.core import versification

Expand Down
Loading