loremfile 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {loremfile-0.3.1 → loremfile-0.3.2}/PKG-INFO +1 -1
  2. {loremfile-0.3.1 → loremfile-0.3.2}/pyproject.toml +1 -1
  3. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile.egg-info/PKG-INFO +1 -1
  4. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/__init__.py +1 -1
  5. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/tools.json +6 -6
  6. {loremfile-0.3.1 → loremfile-0.3.2}/tests/test_mcp.py +62 -0
  7. {loremfile-0.3.1 → loremfile-0.3.2}/README.md +0 -0
  8. {loremfile-0.3.1 → loremfile-0.3.2}/setup.cfg +0 -0
  9. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile.egg-info/SOURCES.txt +0 -0
  10. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile.egg-info/dependency_links.txt +0 -0
  11. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile.egg-info/entry_points.txt +0 -0
  12. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile.egg-info/top_level.txt +0 -0
  13. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/__main__.py +0 -0
  14. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/api.py +0 -0
  15. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/cli.py +0 -0
  16. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/mcp.py +0 -0
  17. {loremfile-0.3.1 → loremfile-0.3.2}/src/loremfile_client/pytest_plugin.py +0 -0
  18. {loremfile-0.3.1 → loremfile-0.3.2}/tests/test_commands.py +0 -0
  19. {loremfile-0.3.1 → loremfile-0.3.2}/tests/test_only_loremfile_dev.py +0 -0
  20. {loremfile-0.3.1 → loremfile-0.3.2}/tests/test_packaging.py +0 -0
  21. {loremfile-0.3.1 → loremfile-0.3.2}/tests/test_pytest_plugin.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loremfile
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Download CC0 sample files from loremfile.dev and verify every byte
5
5
  Author: the loremfile.dev contributors
6
6
  License-Expression: MIT
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
11
11
 
12
12
  [project]
13
13
  name = "loremfile"
14
- version = "0.3.1"
14
+ version = "0.3.2"
15
15
  description = "Download CC0 sample files from loremfile.dev and verify every byte"
16
16
  readme = "README.md"
17
17
  # A range, and a policy: the floor is the oldest CPython still receiving security fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loremfile
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Download CC0 sample files from loremfile.dev and verify every byte
5
5
  Author: the loremfile.dev contributors
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """A small client for loremfile.dev: download CC0 sample files and verify every byte."""
2
2
 
3
- __version__ = "0.3.1"
3
+ __version__ = "0.3.2"
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "name": "list_fixtures",
4
4
  "title": "List loremfile.dev fixtures",
5
- "description": "One page of the published sample files, filtered by format, tag and size. Each comes with its URL and a description of what it is for. `total` counts every match and `next_offset` fetches the next page; it is null on the last.",
5
+ "description": "One page of the published sample files, filtered by format, tag and size. Reads the published manifest over the network. Each comes with its URL and a description of what it is for. `total` counts every match and `next_offset` fetches the next page; it is null on the last.",
6
6
  "inputSchema": {
7
7
  "type": "object",
8
8
  "properties": {
@@ -135,13 +135,13 @@
135
135
  "readOnlyHint": true,
136
136
  "destructiveHint": false,
137
137
  "idempotentHint": true,
138
- "openWorldHint": false
138
+ "openWorldHint": true
139
139
  }
140
140
  },
141
141
  {
142
142
  "name": "describe_fixture",
143
143
  "title": "Describe one loremfile.dev fixture",
144
- "description": "The published manifest entry for one fixture: its URL, MIME type, size, SHA-256, tags, description and measured properties. Metadata only; fetch the URL for the file.",
144
+ "description": "The published manifest entry for one fixture: its URL, MIME type, size, SHA-256, tags, description and measured properties. Reads the published manifest over the network. Metadata only; fetch the URL for the file.",
145
145
  "inputSchema": {
146
146
  "type": "object",
147
147
  "properties": {
@@ -226,13 +226,13 @@
226
226
  "readOnlyHint": true,
227
227
  "destructiveHint": false,
228
228
  "idempotentHint": true,
229
- "openWorldHint": false
229
+ "openWorldHint": true
230
230
  }
231
231
  },
232
232
  {
233
233
  "name": "verify_file",
234
234
  "title": "Verify a local copy of a loremfile.dev fixture",
235
- "description": "Hash a file on this machine and compare it with the published SHA-256 and size of a fixture. `status` is ok, changed or missing. The file is read only to hash it.",
235
+ "description": "Hash a file on this machine and compare it with the published SHA-256 and size of a fixture. Reads the published manifest over the network. `status` is ok, changed or missing. The file is read only to hash it.",
236
236
  "inputSchema": {
237
237
  "type": "object",
238
238
  "properties": {
@@ -301,7 +301,7 @@
301
301
  "readOnlyHint": true,
302
302
  "destructiveHint": false,
303
303
  "idempotentHint": true,
304
- "openWorldHint": false
304
+ "openWorldHint": true
305
305
  }
306
306
  }
307
307
  ]
@@ -10,6 +10,7 @@ import os
10
10
  import re
11
11
  import subprocess
12
12
  import sys
13
+ import urllib.error
13
14
  from collections.abc import Iterator
14
15
  from pathlib import Path
15
16
  from typing import Any
@@ -176,6 +177,67 @@ def test_the_paging_bounds_the_schema_advertises_are_the_ones_enforced() -> None
176
177
  assert (limit["default"], limit["maximum"]) == (mcp.DEFAULT_LIMIT, mcp.MAX_LIMIT)
177
178
 
178
179
 
180
+ def assert_manifest_annotations(
181
+ tools: list[dict[str, Any]], monkeypatch: pytest.MonkeyPatch
182
+ ) -> None:
183
+ """Follow the default api.manifest loader to its transport without sending a request.
184
+
185
+ Deliberately strict: every tool ``tools/list`` advertises must attempt the manifest
186
+ fetch. A tool that genuinely needs no network fails here, and that is the point.
187
+ Declaring one closed-world is then a decision taken on purpose, in this guard, and
188
+ not a default.
189
+ """
190
+ requests = []
191
+
192
+ def block(request, **_kwargs):
193
+ requests.append(request.full_url)
194
+ raise urllib.error.URLError("manifest network probe")
195
+
196
+ with monkeypatch.context() as patch:
197
+ patch.delenv(api.OVERRIDE, raising=False)
198
+ patch.setattr(api.urllib.request, "urlopen", block)
199
+ for tool in tools:
200
+ requests.clear()
201
+ # A fresh server defeats the cache. Dispatch loads before validating args.
202
+ reply = mcp.Server().handle(
203
+ {
204
+ "jsonrpc": "2.0",
205
+ "id": 1,
206
+ "method": "tools/call",
207
+ "params": {"name": tool["name"], "arguments": {}, "_meta": META},
208
+ }
209
+ )
210
+ assert requests == [f"{api.BASE_URL}manifest.json"], tool["name"]
211
+ assert reply["result"]["isError"] is True, tool["name"]
212
+ assert "manifest network probe" in reply["result"]["content"][0]["text"]
213
+ assert tool["annotations"]["openWorldHint"] is True, (
214
+ f"{tool['name']}: manifest network access requires openWorldHint: true"
215
+ )
216
+
217
+
218
+ def test_manifest_fetching_tool_handlers_declare_an_open_world(
219
+ monkeypatch: pytest.MonkeyPatch,
220
+ ) -> None:
221
+ """An annotation is a published claim about behaviour, and a scanner will check it."""
222
+ reply = mcp.Server().handle(
223
+ {"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {"_meta": META}}
224
+ )
225
+ tools = reply["result"]["tools"]
226
+ assert any(tool["name"] == "verify_file" for tool in tools), (
227
+ "control: discovery finds verify_file"
228
+ )
229
+ assert_manifest_annotations(tools, monkeypatch)
230
+
231
+
232
+ def test_the_manifest_annotation_guard_rejects_each_closed_world_declaration(
233
+ monkeypatch: pytest.MonkeyPatch,
234
+ ) -> None:
235
+ for tool in mcp.TOOLS:
236
+ closed = {**tool, "annotations": {**tool["annotations"], "openWorldHint": False}}
237
+ with pytest.raises(AssertionError, match="manifest network access requires openWorldHint"):
238
+ assert_manifest_annotations([closed], monkeypatch)
239
+
240
+
179
241
  # --- versions and malformed requests: each guard, watched firing ------------------------
180
242
 
181
243
 
File without changes
File without changes