Skip to content

doctrine: wire CI and fix existing violations#110

Merged
absoludity merged 5 commits into
masterfrom
doctrine-test-5
Mar 19, 2026
Merged

doctrine: wire CI and fix existing violations#110
absoludity merged 5 commits into
masterfrom
doctrine-test-5

Conversation

@absoludity

@absoludity absoludity commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

Follows #109 (which was part of a series adding the initial doctrine tests).

The doctrine tests have no CI coverage until this PR — they exist but nothing runs them automatically. This adds a dedicated job so violations are caught before merge.

Four use cases in the existing codebase pre-date the doctrine rules and were never updated to conform. Without fixing them the CI job would fail immediately on first run, defeating the purpose of adding it.

The initial doctrine tests only check for the existence of Request/Response classes and an execute() method — they don't verify that execute() actually uses them. This meant a Response class could be present but never returned, and the tests would still pass. Two new tests enforce the full contract: execute() must declare the matching Request as its parameter and the matching Response as its return type.

With the signature checks in place, the scanner's blind spot became visible: the contrib directory was listed in RESERVED_WORDS (correctly — no package should be named contrib), but the scanner used that list to skip directories entirely rather than just to exclude them from being bounded contexts themselves. This meant contrib/polling was never scanned, so PollDataUseCase was invisible to the doctrine tests. The fix lets reserved-word directories still be treated as nested solution containers.

@absoludity absoludity merged commit 7ba693b into master Mar 19, 2026
6 checks passed
@absoludity absoludity deleted the doctrine-test-5 branch March 19, 2026 22:21
Comment on lines +54 to +65
name: Doctrine
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Doctrine tests
run: PYTHONPATH=src pytest src/julee/core/doctrine/

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 3 months ago

To fix this, explicitly restrict the GITHUB_TOKEN permissions in the workflow. The jobs only check out code and run Python tooling, so they only need read access to repository contents. The cleanest fix without changing behavior is to add a single permissions block at the workflow root (top level, alongside name and on). This will apply to all jobs (lint, unit, doctrine) unless overridden locally.

Concretely:

  • Edit .github/workflows/python.yml.
  • Insert:
permissions:
  contents: read

between the name: Python and the on: block (e.g., after line 1 or 2).
No imports or other definitions are required, and no steps or jobs need adjustment. This both documents and enforces least-privilege read-only access for the workflow.

Suggested changeset 1
.github/workflows/python.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -1,5 +1,8 @@
 name: Python
 
+permissions:
+  contents: read
+
 on:
   pull_request:
     paths:
EOF
@@ -1,5 +1,8 @@
name: Python

permissions:
contents: read

on:
pull_request:
paths:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants