Repository navigation
build: use FOCA 0.18.0 from PyPI - #11
Conversation
FOCA 0.18.0, with the plugin engine and its test kit, is on PyPI. Remove the Git source of FOCA, require foca>=0.18.0,<0.19 in the example plugin and the meta distribution, and re-lock. CI tests FOCA 0.18.0 and dev; Dependabot updates FOCA again. The template's tests use FOCA's test kit (contract checks, harness), so new plugins inherit them. Docs updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Template tests build a new task per use instead of sharing a mutable dict. The Codecov upload follows a coverage flag of the matrix entry instead of a hard-coded FOCA version. Comments and docs say how contract checks run, that both CI entries replace the locked FOCA, and which sample inputs plugins should pass; a stale note on the Git source of FOCA is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The template's tests build their candidate backends per use, like their tasks, so that hooks that change their input in place can't make comparisons pass. Rewrap a comment in release.yml; say in the CI matrix comment which entry reports coverage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis PR completes the FOCA 0.18.0 migration: dependencies now resolve from PyPI with explicit compatibility bounds, CI tests both the lowest supported release and FOCA dev, and the example plugin/template adopt FOCA's contract-testing kit with corresponding documentation and maintenance guidance. Sequence diagram for plugin contract testingsequenceDiagram
participant Tests
participant Contract as FOCA Contract Checks
participant Harness as PluginHarness
participant Plugin
Tests->>Contract: check_plugin_contract
Contract->>Plugin: validate metadata and settings
Tests->>Harness: build plugin test inputs
Harness->>Plugin: invoke hooks through engine
Plugin-->>Harness: hook results
Harness-->>Tests: contract and harness assertions
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #11 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 29 29
Branches 3 3
=========================================
Hits 29 29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="plugins/generic/example/noop/tests/test_noop.py" line_range="160" />
<code_context>
ctx = make_context()
plugin.on_request(request, ctx)
- assert request == make_inbound()
+ assert request == make_inbound(make_task())
assert ctx.annotations == {"label": "gateway-1"}
</code_context>
<issue_to_address>
**Fixed samples allow hard-coded outputs**
When the hooks overwrite requests with the fixed task or return fixed `a`/`b` backends regardless of their inputs, `test_on_request_keeps_request` compares only the fixed `{"name": "task"}` payload, and the route, harness, and pipeline assertions compare only backends `a` and `b`. A regression that replaces every request and candidate list with those constants therefore passes these checks.
Use input payloads and backends with values distinct from the expected constants, then assert the hooks preserve those supplied values.
Also at `plugins/generic/example/noop/tests/test_noop.py:173`, `plugins/generic/example/noop/tests/test_noop.py:214`, `plugins/generic/example/noop/tests/test_noop.py:230-231`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: plugins/generic/example/noop/tests/test_noop.py:160
Tests that check that the template's hooks keep their input pass values of their own (a task name, backend identifiers), so that a hook returning the builders' defaults can't pass them. The template's comment on namespace packages no longer names its own subgroup, which copies kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
FOCA 0.18.0, with the plugin engine and its test kit, is on PyPI. This PR resolves the
TODO(FOCA 0.18.0)items of the scaffold (MAINTAINERS.md, step 5):tool.uv.sources) and re-locks;uv.locknow has foca 0.18.0 from PyPI, with hashes.foca>=0.18.0,<0.19.dev(early warning for plugin API changes). Only the 0.18.0 entry with Python 3.13 uploads coverage, chosen by acoverage: trueflag on itsincludeentry.check_plugin_contract,PluginHarness, the builders). Plugins created withscripts/new_plugin.pyinherit the contract test. Tasks and backends are built per use, so hooks that change their input in place can't make comparisons pass.docs/writing-plugins.md(test kinds, contract-check inputs, compatibility),docs/contributing.md,MAINTAINERS.md(step 5 now covers new FOCA minor versions) and the example's README.The M2 (#7) and M3 (#8) plugins build on this branch.
Closes #6
Verification
Local, on the final tree:
uv lock --check: pass;uv sync --locked: foca 0.18.0.pre-commit run --all-files(ruff, mypy, semgrep, ast-grep and its rule tests, gitleaks, actionlint, package conventions): all 15 hooks pass.uv sync --locked --package ... --group dev, then FOCAdevfrom Git; Python 3.11): 15 tests pass, 100% coverage.pytest tests(scripts and docs hooks): 74 pass, 100% coverage.uv build --all-packagesandpython -m scripts.checks dist dist: pass.mkdocs build --strict: pass.CI (run 40561276557): all checks pass:
CI passed, Changes, Lint, Docs, Test scripts, CodeQL, and Test for the example plugin on Python 3.11, 3.13 and 3.15 × FOCA 0.18.0 anddev.Review: adversarial and quality reviewers, two rounds. Round 1 had two medium findings (a misleading CI comment about the contract checks, and a shared mutable task in the template tests) and several lows: a hard-coded FOCA version in the Codecov condition, stale or inaccurate comments and docs. All fixed. Round 2 found only lows, all fixed (backends built per use, comment wrapping and wording).
Declined review findings
check_plugin_contract): the template carries the test and the docs require it; a check of test contents would be brittle. Can follow if plugins from outside contributors start skipping it.ruff formatfixes them, as the docs' checks run it.🤖 Generated with Claude Code
Summary by Sourcery
Use the released FOCA 0.18.0 plugin API across the workspace, CI, and example plugin template.
Enhancements:
Build:
CI:
Tests: