code-analysis-client 1.6.99__tar.gz → 1.6.101__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 (25) hide show
  1. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/PKG-INFO +1 -1
  2. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/file_session.py +19 -7
  3. code_analysis_client-1.6.101/code_analysis_client/version.txt +1 -0
  4. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client.egg-info/PKG-INFO +1 -1
  5. code_analysis_client-1.6.99/code_analysis_client/version.txt +0 -1
  6. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/README.md +0 -0
  7. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/__init__.py +0 -0
  8. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/client.py +0 -0
  9. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/commands_proxy.py +0 -0
  10. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/config.py +0 -0
  11. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/exceptions.py +0 -0
  12. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/py.typed +0 -0
  13. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/queue_wait.py +0 -0
  14. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/responses.py +0 -0
  15. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/schema_disk_cache.py +0 -0
  16. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/server_api.py +0 -0
  17. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/server_schema.py +0 -0
  18. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/universal_file.py +0 -0
  19. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client/validation.py +0 -0
  20. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client.egg-info/SOURCES.txt +0 -0
  21. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client.egg-info/dependency_links.txt +0 -0
  22. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client.egg-info/requires.txt +0 -0
  23. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/code_analysis_client.egg-info/top_level.txt +0 -0
  24. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/pyproject.toml +0 -0
  25. {code_analysis_client-1.6.99 → code_analysis_client-1.6.101}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client
3
- Version: 1.6.99
3
+ Version: 1.6.101
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -25,6 +25,7 @@ email: vasilyvz@gmail.com
25
25
 
26
26
  from __future__ import annotations
27
27
 
28
+ import tempfile
28
29
  from pathlib import Path
29
30
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
30
31
 
@@ -505,18 +506,29 @@ class FileSessionClient:
505
506
  filename: str,
506
507
  compression: str = "identity",
507
508
  ) -> Any:
508
- """Upload raw bytes through the adapter buffer; returns upload receipt."""
509
- dest = Path(filename)
510
- dest.write_bytes(payload)
511
- try:
509
+ """Upload raw bytes through the adapter buffer; returns upload receipt.
510
+
511
+ ``filename`` is a NAME reported to the server, never a path this client
512
+ may write to. Bug c3fafbd4: this method used to stage the payload at
513
+ ``Path(filename)`` -- relative, therefore inside the CALLER's working
514
+ directory -- and delete it in a ``finally``, so uploading a file named
515
+ ``pyproject.toml`` overwrote and then deleted the caller's own
516
+ ``pyproject.toml``. The live pipeline, which runs from the repository
517
+ root and seeds fixtures with exactly those names, destroyed developer
518
+ files on every sweep while reporting success. The payload is now staged
519
+ in a private temporary directory that is removed with its contents; the
520
+ caller's cwd is never read from or written to.
521
+ """
522
+ with tempfile.TemporaryDirectory(prefix="ca_upload_") as staging_dir:
523
+ # Keep the basename so the transport still sees the intended name;
524
+ # any directory component in `filename` is not a path to honour here.
525
+ dest = Path(staging_dir) / (Path(filename).name or "upload.bin")
526
+ dest.write_bytes(payload)
512
527
  return await self._client.rpc.upload_file(
513
528
  str(dest),
514
529
  filename=filename,
515
530
  compression=compression,
516
531
  )
517
- finally:
518
- if dest.is_file():
519
- dest.unlink(missing_ok=True)
520
532
 
521
533
  async def _commit_upload(
522
534
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client
3
- Version: 1.6.99
3
+ Version: 1.6.101
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10