Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80920a7
Additional CSS to support updated submission agreement and license pa…
DavidLFielding Feb 13, 2026
f24f66b
Minor: Removed commented out HTML.
DavidLFielding Feb 13, 2026
0c0b533
Add tests when creating PRs or pushing to develop.
DavidLFielding Feb 24, 2026
b136ec5
Add missing packageprotobuf compiler.
DavidLFielding Feb 24, 2026
985e123
Fix Github action yml.
DavidLFielding Feb 24, 2026
e1c98c9
Fix Github action yml.
DavidLFielding Feb 24, 2026
8eef211
Fix Github action yml.
DavidLFielding Feb 24, 2026
9724946
Fix Github action yml.
DavidLFielding Feb 24, 2026
ac7dbc6
Do not include tests and disabled features in coverage.
DavidLFielding Feb 24, 2026
4c4e9fd
Improve coverage. Removed tests from coverage.
DavidLFielding Feb 26, 2026
95be5c2
Expose make_event for testing purposes.
DavidLFielding Feb 26, 2026
94f0092
Minimal tests for branching.
DavidLFielding Feb 26, 2026
ee056b0
Additional branching tests for event domain.
DavidLFielding Feb 26, 2026
0d8d3f8
Add a test and fix another one.
DavidLFielding Feb 26, 2026
e9e749e
Merge branch 'develop' into SUBMISSION-66
DavidLFielding Feb 26, 2026
2be7ea6
Cleaning up event domain tests.
DavidLFielding Feb 26, 2026
3a771dd
Basic upload tests to help with coverage.
DavidLFielding Feb 26, 2026
0210720
Adjusting coverage related settings.
DavidLFielding Feb 26, 2026
ca819bd
More event domain tests.
DavidLFielding Feb 26, 2026
7a4148c
Omit unused files or those that are being reimplemented.
DavidLFielding Feb 26, 2026
0285d2b
Fix repo name for ruff command
DavidLFielding Feb 26, 2026
3c7553b
Fix repo name for ruff command
DavidLFielding Feb 26, 2026
6cfd4fb
Fix repo name for ruff command
DavidLFielding Feb 26, 2026
bb16dbe
Fix repo name for ruff command
DavidLFielding Feb 26, 2026
d4facae
Ruff fixes. Initial pass with safe fixes. Reviewed.
DavidLFielding Feb 27, 2026
a411eb5
Set Ruff to warn for short term.
DavidLFielding Feb 27, 2026
bd3a949
Set Ruff to warn for short term.
DavidLFielding Feb 27, 2026
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
40 changes: 40 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install protobuf compiler
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Test with pytest
run: |
uv run pytest --ignore=submit_ce/implementations/pubsub/tests \
--cov=submit_ce --cov-report=term-missing --cov-fail-under=80

- name: Ruff lint check
run: |
uv pip install ruff
uv run ruff check --output-format=github submit_ce
continue-on-error: true
5 changes: 1 addition & 4 deletions clitools.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import os
import tempfile
import time
import subprocess
import random
from typing import Optional

import fire

def gen_openapi_json(file:str = "openapi.json"):
"""Generate an openapi.yaml file for the current server code."""
import uvicorn
import requests
port = random.randint(9000, 12000)
command = f"uvicorn submit_ce.api.app:app --host 127.0.0.1 --port {port}".split()
Expand All @@ -34,7 +31,7 @@ def gen_client(gen_spec:bool = True):
"""

if gen_spec:
print(f"* Generating to openapi.json for current code")
print("* Generating to openapi.json for current code")
gen_openapi_json()

command = f"""
Expand Down
78 changes: 77 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,88 @@ dev = [

[tool.coverage.run]
branch = true
relative_files = true
source = ["submit_ce"]
omit = [ "*/tests/*" ]
omit = [
# Ignore tests
"**/tests/**",
"**/test_*.py",
"**/*_test.py",

# Ignore questionable code or code in the process of reimplementation
# Fastly code not currently used
"submit_ce/fastapi/test_*.py",
"submit_ce/fastapi/auth.py",
"submit_ce/fastapi/routes.py",
#
"submit_ce/implementations/compile/common.py",
"submit_ce/implementations/compile/compile_at_gcp.py", # migrate existing tests or eliminate script
"submit_ce/implementations/file_store/gs_file_store.py",
"submit_ce/implementations/file_store/legacy_file_store.py",
"submit_ce/implementations/legacy_implementation/**",
"submit_ce/implementations/pubsub/**", # disabled - omit until feature is enabled
"submit_ce/ui/filters/**", # need rewrite
"submit_ce/ui/compile_sass.py",
"submit_ce/ui/controllers/new/create.py",
"submit_ce/ui/controllers/cross.py", # add later
"submit_ce/ui/controllers/delete.py", # add tests after reimplementation
"submit_ce/ui/controllers/new/process.py",
'submit_ce/ui/controllers/new/review.py', # placeholder
"submit_ce/ui/controllers/new/upload.py", # add tests after reimplementation
"submit_ce/ui/controllers/new/upload_delete.py"

]

[tool.coverage.report]

omit = [
# Ignore tests
"**/tests/**",
"**/test_*.py",
"**/*_test.py",


# Ignore questionable code or code in the process of reimplementation
# Fastly code not currently used
"submit_ce/fastapi/test_*.py",
"submit_ce/fastapi/auth.py",
"submit_ce/fastapi/routes.py",
"submit_ce/implementations/compile/common.py", # migrate existing tests or eliminate script
"submit_ce/implementations/compile/compile_at_gcp.py", # migrate existing tests or eliminate script
"submit_ce/implementations/file_store/legacy_file_store.py", # add tests
"submit_ce/implementations/file_store/gs_file_store.py", # add tests
"submit_ce/implementations/legacy_implementation/**",
"submit_ce/implementations/pubsub/**", # disabled - omit until feature is enabled
"submit_ce/ui/filters/**", # need rewrite
"submit_ce/ui/compile_sass.py",
"submit_ce/ui/controllers/new/create.py",
"submit_ce/ui/controllers/cross.py",
"submit_ce/ui/controllers/delete.py", # add tests after reimplementation
"submit_ce/ui/controllers/new/process.py",
"submit_ce/ui/controllers/new/review.py", # placeholder
"submit_ce/ui/controllers/new/upload.py", # add tests after reimplementation
"submit_ce/ui/controllers/new/upload_delete.py"
]

exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"except ImportError",
]

# Regexes for lines to exclude from consideration
exclude_also = [
# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
]


# Fail threshold (tune after you see the new baseline)
fail_under = 80
skip_covered = true


[tool.pytest.ini_options]
addopts = "-q --maxfail=1 -ra --cov=submit_ce --cov-report=term-missing"
1 change: 0 additions & 1 deletion submit_ce/api/domain/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import Optional, Union, List, Dict, Type, Any

from dataclasses import field
from mypy_extensions import TypedDict

from .agent import User, agent_factory

Expand Down
1 change: 0 additions & 1 deletion submit_ce/api/domain/compilation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Data structs related to compilation."""

import io
from datetime import datetime
from enum import Enum
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions submit_ce/api/domain/event/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

from . import validators
from .base import Event
from .base import event_factory as make_event
from .flag import AddMetadataFlag, AddUserFlag, AddContentFlag, RemoveFlag, \
AddHold, RemoveHold
from .proposal import AddProposal, RejectProposal, AcceptProposal
Expand Down
1 change: 0 additions & 1 deletion submit_ce/api/domain/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import copy
import hashlib
from datetime import datetime
from logging import root
from typing import Optional, Callable, Tuple, Iterable, List, ClassVar, \
Type, Any

Expand Down
1 change: 0 additions & 1 deletion submit_ce/api/domain/event/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from dataclasses import field

from .util import dataclass
from .base import Event
from ..flag import ContentFlag, MetadataFlag, UserFlag
from ..submission import Submission, SubmissionMetadata, Hold, Waiver
Expand Down
5 changes: 1 addition & 4 deletions submit_ce/api/domain/event/proposal.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"""Commands for working with :class:`.Proposal` instances on submissions."""

import copy
from typing import Optional, Iterable
from typing import Optional
from dataclasses import field
from .util import dataclass
import logging

from ..agent import User
from ..submission import Submission
from ..proposal import Proposal
from ..annotation import Comment
Expand Down
2 changes: 0 additions & 2 deletions submit_ce/api/domain/event/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

from typing import Optional, List, ClassVar
from dataclasses import field
from .util import dataclass

from arxiv import taxonomy

from . import validators
from .base import Event
Expand Down
71 changes: 71 additions & 0 deletions submit_ce/api/domain/event/tests/test_branches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Minimal branch-coverage tests for event creation and validation.

from datetime import datetime
from pytz import UTC
import pytest


from submit_ce.api.domain import submission as submod, agent
from submit_ce.api.domain.event import (
make_event, # <- alias to base.event_factory
FinalizeSubmission, # used directly to hit validation error
Announce, # simple project() path
InvalidEvent, # domain exception
)


def _now():
# Keep consistent with existing tests that use pytz.UTC
return datetime.now(UTC)


def _user(u="u1"):
# PublicUser requires: name, user_id, email.
# endorsements defaults to [] if not provided.
return agent.PublicUser(
name="Test User",
user_id=u,
email=f"{u}@example.org",
endorsements=[],
)


def test_create_submission_round_trip():
"""CreateSubmission via factory; apply(None) creates a new Submission."""
creator = _user("alice")
ev = make_event("CreateSubmission", created=_now(), creator=creator)
after = ev.apply(None) # special-case: creation works with submission=None
assert after.creator == creator
assert after.owner == creator
# ID may be None pre-persist; just assert it’s stable/typed if present.
assert after.submission_id is None or isinstance(after.submission_id, int)


def test_finalize_submission_missing_required_fields_raises():
"""FinalizeSubmission should raise when required fields are missing."""
creator = _user("bob")
sub = submod.Submission(creator=creator, owner=creator, created=_now())
ev = FinalizeSubmission(creator=creator, created=_now())
with pytest.raises(InvalidEvent):
ev.apply(sub)


def test_announce_sets_status_and_id():
"""Announce.project sets status to ANNOUNCED and arxiv_id to provided value."""
creator = _user("carol")
# A minimal submission that is not yet announced
sub = submod.Submission(creator=creator, owner=creator, created=_now())
# The versions field is commented out in Submission while Announce appends
# to it. [FIX ME]
sub.versions = []

ev = Announce(creator=creator, created=_now(), arxiv_id="2501.01234")
after = ev.apply(sub)
assert after.status == submod.Submission.ANNOUNCED
assert after.arxiv_id == "2501.01234"


def test_factory_unknown_type_raises_runtime_error():
"""Factory should error with an unknown event type name."""
with pytest.raises(RuntimeError):
make_event("NoSuchEventType", created=_now(), creator=_user("dave"))
Loading
Loading