sourcecode 1.32.3__tar.gz → 1.32.5__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.
- {sourcecode-1.32.3 → sourcecode-1.32.5}/PKG-INFO +1 -187
- {sourcecode-1.32.3 → sourcecode-1.32.5}/pyproject.toml +14 -2
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/__init__.py +1 -1
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/cache.py +119 -10
- sourcecode-1.32.5/src/sourcecode/cache.tmp_new +772 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/cli.py +129 -37
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/ris.py +7 -2
- sourcecode-1.32.3/.agents/skills/source-command-gsd-join-discord/SKILL.md +0 -24
- sourcecode-1.32.3/.agents/skills/source-command-gsd-review-backlog/SKILL.md +0 -63
- sourcecode-1.32.3/.agents/skills/source-command-gsd-workstreams/SKILL.md +0 -72
- sourcecode-1.32.3/.continue-here.md +0 -106
- sourcecode-1.32.3/.sourcecode-cache/snapshot-3b5997a-fa5c742c.json +0 -261
- sourcecode-1.32.3/AUDIT_REAL_REPOS.md +0 -539
- sourcecode-1.32.3/AUDIT_v1.31.23.md +0 -660
- sourcecode-1.32.3/docs/PRODUCT_AUDIT.md +0 -170
- sourcecode-1.32.3/docs/PRODUCT_TIERS.md +0 -112
- sourcecode-1.32.3/docs/USER_GUIDE.md +0 -371
- sourcecode-1.32.3/docs/privacy.md +0 -182
- sourcecode-1.32.3/docs/schema.md +0 -894
- sourcecode-1.32.3/run_cli.py +0 -4
- sourcecode-1.32.3/tests/__init__.py +0 -0
- sourcecode-1.32.3/tests/conftest.py +0 -14
- sourcecode-1.32.3/tests/fixtures/coverage.xml +0 -15
- sourcecode-1.32.3/tests/fixtures/fastapi_app/pyproject.toml +0 -4
- sourcecode-1.32.3/tests/fixtures/fastapi_app/src/main.py +0 -3
- sourcecode-1.32.3/tests/fixtures/go_service/cmd/api/main.go +0 -3
- sourcecode-1.32.3/tests/fixtures/go_service/go.mod +0 -3
- sourcecode-1.32.3/tests/fixtures/jacoco.xml +0 -14
- sourcecode-1.32.3/tests/fixtures/latin1_sample.java +0 -8
- sourcecode-1.32.3/tests/fixtures/latin1_sample_iso.java +0 -2
- sourcecode-1.32.3/tests/fixtures/lcov.info +0 -16
- sourcecode-1.32.3/tests/fixtures/nextjs_app/app/page.tsx +0 -3
- sourcecode-1.32.3/tests/fixtures/nextjs_app/package.json +0 -8
- sourcecode-1.32.3/tests/fixtures/nextjs_app/pnpm-lock.yaml +0 -1
- sourcecode-1.32.3/tests/fixtures/pnpm_monorepo/apps/web/app/page.tsx +0 -3
- sourcecode-1.32.3/tests/fixtures/pnpm_monorepo/apps/web/package.json +0 -8
- sourcecode-1.32.3/tests/fixtures/pnpm_monorepo/packages/api/main.py +0 -3
- sourcecode-1.32.3/tests/fixtures/pnpm_monorepo/packages/api/pyproject.toml +0 -4
- sourcecode-1.32.3/tests/fixtures/pnpm_monorepo/pnpm-workspace.yaml +0 -3
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/pom.xml +0 -33
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/application/service/FindAusenteService.java +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/domain/entities/Ausente.java +0 -5
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/infrastructure/rest/AusenteRestController.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/application/service/FindAutocoberturasService.java +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/domain/entities/Autocoberturas.java +0 -5
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/infrastructure/rest/AutocoberturasRestController.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/application/service/FindCalendarioTrabajadorService.java +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/domain/entities/CalendarioTrabajador.java +0 -5
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/infrastructure/rest/CalendarioTrabajadorRestController.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/application/service/FindDepartamentoService.java +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/domain/entities/Departamento.java +0 -5
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/infrastructure/rest/DepartamentoRestController.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/application/service/FindEmpleadoService.java +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/domain/entities/Empleado.java +0 -5
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/infrastructure/rest/EmpleadoRestController.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/DemoApplication.java +0 -11
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/config/FilterConfig.java +0 -17
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/domain/Health.java +0 -11
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/mapper/HealthMapper.java +0 -10
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/repository/HealthRepository.java +0 -8
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/service/HealthService.java +0 -12
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/web/HealthRestController.java +0 -15
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/web/NominaRestController.java +0 -16
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/resources/application-dev.yml +0 -4
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/resources/application.yml +0 -20
- sourcecode-1.32.3/tests/fixtures/spring_boot_minimal/src/main/resources/mapper/HealthMapper.xml +0 -8
- sourcecode-1.32.3/tests/test_architecture_analyzer.py +0 -168
- sourcecode-1.32.3/tests/test_architecture_summary.py +0 -82
- sourcecode-1.32.3/tests/test_ast_extractor.py +0 -278
- sourcecode-1.32.3/tests/test_audit_fixes.py +0 -840
- sourcecode-1.32.3/tests/test_audit_sas_v2.py +0 -506
- sourcecode-1.32.3/tests/test_block1_reliability.py +0 -474
- sourcecode-1.32.3/tests/test_block2_coverage.py +0 -450
- sourcecode-1.32.3/tests/test_block5_quality.py +0 -300
- sourcecode-1.32.3/tests/test_broadleaf_fixes.py +0 -433
- sourcecode-1.32.3/tests/test_bug_fixes_v1302.py +0 -419
- sourcecode-1.32.3/tests/test_bug_fixes_v13115.py +0 -316
- sourcecode-1.32.3/tests/test_bug_fixes_v1312.py +0 -239
- sourcecode-1.32.3/tests/test_bug_fixes_v13122.py +0 -421
- sourcecode-1.32.3/tests/test_bug_fixes_v1313.py +0 -350
- sourcecode-1.32.3/tests/test_bug_fixes_v13130.py +0 -449
- sourcecode-1.32.3/tests/test_bug_fixes_v1321.py +0 -369
- sourcecode-1.32.3/tests/test_bug_fixes_v16.py +0 -332
- sourcecode-1.32.3/tests/test_bug_fixes_v2.py +0 -293
- sourcecode-1.32.3/tests/test_cache.py +0 -668
- sourcecode-1.32.3/tests/test_canonical_ir.py +0 -893
- sourcecode-1.32.3/tests/test_classifier.py +0 -126
- sourcecode-1.32.3/tests/test_cli.py +0 -98
- sourcecode-1.32.3/tests/test_code_notes_analyzer.py +0 -137
- sourcecode-1.32.3/tests/test_context_scorer.py +0 -449
- sourcecode-1.32.3/tests/test_contract_pipeline.py +0 -263
- sourcecode-1.32.3/tests/test_coverage_parser.py +0 -183
- sourcecode-1.32.3/tests/test_cross_consistency.py +0 -365
- sourcecode-1.32.3/tests/test_dependency_analyzer_node_python.py +0 -111
- sourcecode-1.32.3/tests/test_dependency_analyzer_polyglot.py +0 -217
- sourcecode-1.32.3/tests/test_dependency_schema.py +0 -54
- sourcecode-1.32.3/tests/test_detector_dotnet.py +0 -482
- sourcecode-1.32.3/tests/test_detector_go_rust_java.py +0 -88
- sourcecode-1.32.3/tests/test_detector_nodejs.py +0 -100
- sourcecode-1.32.3/tests/test_detector_php_ruby_dart.py +0 -63
- sourcecode-1.32.3/tests/test_detector_python.py +0 -94
- sourcecode-1.32.3/tests/test_detector_universal_managed.py +0 -111
- sourcecode-1.32.3/tests/test_detector_universal_systems.py +0 -63
- sourcecode-1.32.3/tests/test_detectors_base.py +0 -165
- sourcecode-1.32.3/tests/test_doc_analyzer_jsdom.py +0 -217
- sourcecode-1.32.3/tests/test_doc_analyzer_python.py +0 -360
- sourcecode-1.32.3/tests/test_encoding_regression.py +0 -138
- sourcecode-1.32.3/tests/test_enterprise_benchmarks.py +0 -1727
- sourcecode-1.32.3/tests/test_graph_analyzer_polyglot.py +0 -105
- sourcecode-1.32.3/tests/test_graph_analyzer_python_node.py +0 -122
- sourcecode-1.32.3/tests/test_graph_schema.py +0 -87
- sourcecode-1.32.3/tests/test_hybrid_inference.py +0 -367
- sourcecode-1.32.3/tests/test_integration.py +0 -111
- sourcecode-1.32.3/tests/test_integration_dependencies.py +0 -90
- sourcecode-1.32.3/tests/test_integration_detection.py +0 -78
- sourcecode-1.32.3/tests/test_integration_docs.py +0 -284
- sourcecode-1.32.3/tests/test_integration_graph_modules.py +0 -121
- sourcecode-1.32.3/tests/test_integration_lqn.py +0 -231
- sourcecode-1.32.3/tests/test_integration_metrics.py +0 -120
- sourcecode-1.32.3/tests/test_integration_multistack.py +0 -65
- sourcecode-1.32.3/tests/test_integration_semantics.py +0 -186
- sourcecode-1.32.3/tests/test_integration_universal.py +0 -58
- sourcecode-1.32.3/tests/test_java_spring_integration.py +0 -318
- sourcecode-1.32.3/tests/test_mcp_nudge.py +0 -153
- sourcecode-1.32.3/tests/test_mcp_runner.py +0 -65
- sourcecode-1.32.3/tests/test_mcp_serve.py +0 -39
- sourcecode-1.32.3/tests/test_mcp_tools.py +0 -380
- sourcecode-1.32.3/tests/test_metrics_analyzer.py +0 -457
- sourcecode-1.32.3/tests/test_output_ux.py +0 -235
- sourcecode-1.32.3/tests/test_packaging.py +0 -47
- sourcecode-1.32.3/tests/test_phase1_improvements.py +0 -412
- sourcecode-1.32.3/tests/test_pipeline_integrity.py +0 -453
- sourcecode-1.32.3/tests/test_real_projects.py +0 -69
- sourcecode-1.32.3/tests/test_redactor.py +0 -103
- sourcecode-1.32.3/tests/test_repository_ir.py +0 -2228
- sourcecode-1.32.3/tests/test_scanner.py +0 -159
- sourcecode-1.32.3/tests/test_schema.py +0 -326
- sourcecode-1.32.3/tests/test_schema_normalization.py +0 -245
- sourcecode-1.32.3/tests/test_scoring_calibration.py +0 -574
- sourcecode-1.32.3/tests/test_semantic_analyzer_node.py +0 -494
- sourcecode-1.32.3/tests/test_semantic_analyzer_python.py +0 -303
- sourcecode-1.32.3/tests/test_semantic_import_resolution.py +0 -356
- sourcecode-1.32.3/tests/test_semantic_schema.py +0 -130
- sourcecode-1.32.3/tests/test_signal_hierarchy.py +0 -534
- sourcecode-1.32.3/tests/test_summarizer.py +0 -190
- sourcecode-1.32.3/tests/test_surface_honesty.py +0 -339
- sourcecode-1.32.3/tests/test_task_differentiation.py +0 -82
- sourcecode-1.32.3/tests/test_telemetry.py +0 -335
- sourcecode-1.32.3/tests/test_v131_improvements.py +0 -477
- sourcecode-1.32.3/tests/test_v1_10_regressions.py +0 -835
- sourcecode-1.32.3/tests/test_workspace_analyzer.py +0 -47
- {sourcecode-1.32.3 → sourcecode-1.32.5}/.github/workflows/build-windows.yml +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/.gitignore +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/.ruff.toml +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/CHANGELOG.md +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/CONTRIBUTING.md +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/LICENSE +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/README.md +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/SECURITY.md +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/raw +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/adaptive_scanner.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/architecture_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/architecture_summary.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/ast_extractor.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/canonical_ir.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/classifier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/code_notes_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/confidence_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/context_scorer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/context_summarizer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/contract_model.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/contract_pipeline.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/coverage_parser.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/dependency_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/__init__.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/base.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/csproj_parser.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/dart.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/dotnet.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/elixir.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/go.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/heuristic.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/hybrid.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/java.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/jvm_ext.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/nodejs.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/parsers.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/php.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/project.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/python.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/ruby.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/rust.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/systems.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/terraform.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/detectors/tooling.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/doc_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/entrypoint_classifier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/env_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/file_classifier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/flow_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/git_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/graph_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/license.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/__init__.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/onboarding/__init__.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/onboarding/applier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/onboarding/backup.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/onboarding/detector.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/onboarding/planner.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/runner.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp/server.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/mcp_nudge.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/metrics_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/output_budget.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/path_filters.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/pr_comment_renderer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/prepare_context.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/progress.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/ranking_engine.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/redactor.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/relevance_scorer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/repo_classifier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/repository_ir.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/runtime_classifier.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/scanner.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/schema.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/semantic_analyzer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/serializer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/summarizer.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/__init__.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/config.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/consent.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/events.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/filters.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/telemetry/transport.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/tree_utils.py +0 -0
- {sourcecode-1.32.3 → sourcecode-1.32.5}/src/sourcecode/workspace.py +0 -0
|
@@ -1,193 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourcecode
|
|
3
|
-
Version: 1.32.
|
|
3
|
+
Version: 1.32.5
|
|
4
4
|
Summary: Deterministic codebase context for AI coding agents
|
|
5
|
-
License: Apache License
|
|
6
|
-
Version 2.0, January 2004
|
|
7
|
-
http://www.apache.org/licenses/
|
|
8
|
-
|
|
9
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
-
|
|
11
|
-
1. Definitions.
|
|
12
|
-
|
|
13
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
-
|
|
16
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
-
the copyright owner that is granting the License.
|
|
18
|
-
|
|
19
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
-
other entities that control, are controlled by, or are under common
|
|
21
|
-
control with that entity. For the purposes of this definition,
|
|
22
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
-
direction or management of such entity, whether by contract or
|
|
24
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
-
|
|
27
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
-
exercising permissions granted by this License.
|
|
29
|
-
|
|
30
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
-
including but not limited to software source code, documentation
|
|
32
|
-
source, and configuration files.
|
|
33
|
-
|
|
34
|
-
"Object" form shall mean any form resulting from mechanical
|
|
35
|
-
transformation or translation of a Source form, including but
|
|
36
|
-
not limited to compiled object code, generated documentation,
|
|
37
|
-
and conversions to other formats.
|
|
38
|
-
|
|
39
|
-
"Work" shall mean the work of authorship made available under
|
|
40
|
-
the License, as indicated by a copyright notice that is included in
|
|
41
|
-
or attached to the work (an example is provided in the Appendix below).
|
|
42
|
-
|
|
43
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
44
|
-
form, that is based on (or derived from) the Work and for which the
|
|
45
|
-
editorial revisions, annotations, elaborations, or other transformations
|
|
46
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
47
|
-
of this License, Derivative Works shall not include works that remain
|
|
48
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
49
|
-
the Work and Derivative Works thereof.
|
|
50
|
-
|
|
51
|
-
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
52
|
-
in the Work by the copyright owner or by an individual or Legal Entity
|
|
53
|
-
authorized to submit on behalf of the copyright owner. For the purposes
|
|
54
|
-
of this definition, "submit" means any form of electronic, verbal, or
|
|
55
|
-
written communication sent to the Licensor or its representatives,
|
|
56
|
-
including but not limited to communication on electronic mailing lists,
|
|
57
|
-
source code control systems, and issue tracking systems that are managed
|
|
58
|
-
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
59
|
-
improving the Work, but excluding communication that is conspicuously
|
|
60
|
-
marked or designated in writing by the copyright owner as "Not a
|
|
61
|
-
Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
64
|
-
whom a Contribution has been received by the Licensor and included
|
|
65
|
-
within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by the combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a cross-claim
|
|
84
|
-
or counterclaim in a lawsuit) alleging that the Work or any Contributor
|
|
85
|
-
Contribution constitutes direct or contributory patent infringement,
|
|
86
|
-
then any patent rights granted to You under this License for that Work
|
|
87
|
-
shall terminate as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
-
Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, You must include a readable copy of the
|
|
108
|
-
attribution notices contained within such NOTICE file, in
|
|
109
|
-
at least one of the following places: within a NOTICE text
|
|
110
|
-
file distributed as part of the Derivative Works; within
|
|
111
|
-
the Source form or documentation, if provided along with the
|
|
112
|
-
Derivative Works; or, within a display generated by the
|
|
113
|
-
Derivative Works, if and wherever such third-party notices
|
|
114
|
-
normally appear. The contents of the NOTICE file are for
|
|
115
|
-
informational purposes only and do not modify the License.
|
|
116
|
-
You may add Your own attribution notices within Derivative
|
|
117
|
-
Works that You distribute, alongside or in addition to the
|
|
118
|
-
NOTICE text from the Work, provided that such additional
|
|
119
|
-
attribution notices cannot be construed as modifying the License.
|
|
120
|
-
|
|
121
|
-
You may add Your own license statement for Your modifications and
|
|
122
|
-
may provide additional grant of rights to use, copy, modify, merge,
|
|
123
|
-
publish, distribute, sublicense, and/or sell copies of the
|
|
124
|
-
Derivative Works, as separate terms and conditions for their use,
|
|
125
|
-
reproduction, and distribution, or alongside or as supplement to
|
|
126
|
-
any license terms for such Derivative Works as a whole, provided
|
|
127
|
-
Your use, reproduction, and distribution of the Work otherwise
|
|
128
|
-
complies with the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or reproducing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or exemplary damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or all other
|
|
162
|
-
commercial damages or losses), even if such Contributor has been
|
|
163
|
-
advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
166
|
-
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
167
|
-
for, acceptance of support, warranty, indemnity, or other liability
|
|
168
|
-
obligations and/or rights consistent with this License. However, in
|
|
169
|
-
accepting such obligations, You may offer such obligations only on
|
|
170
|
-
Your own behalf and on Your sole responsibility, not on behalf of
|
|
171
|
-
any other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
-
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
-
or claims asserted against, such Contributor by reason of your
|
|
174
|
-
accepting any warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
Copyright 2024 sourcecode contributors
|
|
179
|
-
|
|
180
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
-
you may not use this file except in compliance with the License.
|
|
182
|
-
You may obtain a copy of the License at
|
|
183
|
-
|
|
184
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
-
|
|
186
|
-
Unless required by applicable law or agreed to in writing, software
|
|
187
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
-
See the License for the specific language governing permissions and
|
|
190
|
-
limitations under the License.
|
|
191
5
|
License-File: LICENSE
|
|
192
6
|
Keywords: agents,ai,codebase,context,developer-tools,llm
|
|
193
7
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -4,11 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sourcecode"
|
|
7
|
-
version = "1.32.
|
|
7
|
+
version = "1.32.5"
|
|
8
8
|
description = "Deterministic codebase context for AI coding agents"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
|
-
license =
|
|
11
|
+
license-expression = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
12
13
|
keywords = ["ai", "llm", "agents", "context", "codebase", "developer-tools"]
|
|
13
14
|
classifiers = [
|
|
14
15
|
"Development Status :: 4 - Beta",
|
|
@@ -55,6 +56,17 @@ mcp = [
|
|
|
55
56
|
module = ["tree_sitter", "tree_sitter_typescript", "tree_sitter_javascript"]
|
|
56
57
|
ignore_missing_imports = true
|
|
57
58
|
|
|
59
|
+
[tool.hatch.build.targets.sdist]
|
|
60
|
+
exclude = [
|
|
61
|
+
"tests/",
|
|
62
|
+
"docs/",
|
|
63
|
+
"/AUDIT*.md",
|
|
64
|
+
"/.agents",
|
|
65
|
+
"/.continue-here.md",
|
|
66
|
+
"/.sourcecode-cache",
|
|
67
|
+
"/run_cli.py",
|
|
68
|
+
]
|
|
69
|
+
|
|
58
70
|
[tool.hatch.build.targets.wheel]
|
|
59
71
|
packages = ["src/sourcecode"]
|
|
60
72
|
|
|
@@ -72,6 +72,11 @@ SCHEMA_VERSION: str = "2"
|
|
|
72
72
|
#: Bump to invalidate all L1 core caches (independent of snapshot version).
|
|
73
73
|
CORE_SCHEMA_VERSION: str = "1"
|
|
74
74
|
|
|
75
|
+
#: Bump when analysis logic or output schema changes — NOT on every package release.
|
|
76
|
+
#: This is the stable part of the L1 core cache key. Package version bumps (patch,
|
|
77
|
+
#: minor) must NOT bump this value unless the cached data format actually changed.
|
|
78
|
+
ANALYZER_CACHE_VERSION: str = "1"
|
|
79
|
+
|
|
75
80
|
#: Fields eligible for CAS deduplication (applied to top-level JSON dict keys).
|
|
76
81
|
_CAS_FIELDS: frozenset[str] = frozenset([
|
|
77
82
|
"file_paths",
|
|
@@ -92,6 +97,8 @@ _CAS_FIELDS: frozenset[str] = frozenset([
|
|
|
92
97
|
_CAS_THRESHOLD: int = 4096
|
|
93
98
|
|
|
94
99
|
_DEFAULT_KEEP_COMMITS: int = 5
|
|
100
|
+
_DEFAULT_MAX_CORES: int = 20
|
|
101
|
+
_DEFAULT_MAX_SIZE_MB: int = 50
|
|
95
102
|
|
|
96
103
|
# Matches "snapshot-<hex_commit>-<hex_flags>.json.gz"
|
|
97
104
|
_SNAPSHOT_RE = re.compile(r"^snapshot-([0-9a-f]+)-[0-9a-f]+\.json\.gz$")
|
|
@@ -124,6 +131,58 @@ def cache_dir(repo_root: Path) -> Path:
|
|
|
124
131
|
return base / repo_id(repo_root)
|
|
125
132
|
|
|
126
133
|
|
|
134
|
+
# ---------------------------------------------------------------------------
|
|
135
|
+
# Public API — observability
|
|
136
|
+
# ---------------------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
def status(repo_root: Path) -> dict[str, Any]:
|
|
139
|
+
"""Return a stats dict describing the current cache state for *repo_root*.
|
|
140
|
+
|
|
141
|
+
Keys: ``cache_dir``, ``cores``, ``snapshots``, ``views``, ``cas_blobs``,
|
|
142
|
+
``total_size_bytes``, ``total_size_mb``.
|
|
143
|
+
"""
|
|
144
|
+
cache_d = cache_dir(repo_root)
|
|
145
|
+
if not cache_d.exists():
|
|
146
|
+
return {
|
|
147
|
+
"cache_dir": str(cache_d),
|
|
148
|
+
"cores": 0, "snapshots": 0, "views": 0, "cas_blobs": 0,
|
|
149
|
+
"total_size_bytes": 0, "total_size_mb": 0.0,
|
|
150
|
+
}
|
|
151
|
+
cores = list(cache_d.glob("core-*.json.gz"))
|
|
152
|
+
snapshots = list(cache_d.glob("snapshot-*.json.gz"))
|
|
153
|
+
views = list(cache_d.glob("view-*.json.gz"))
|
|
154
|
+
cas_blobs = list((_cas_dir(cache_d)).glob("*.gz")) if _cas_dir(cache_d).exists() else []
|
|
155
|
+
all_files = cores + snapshots + views + cas_blobs
|
|
156
|
+
total_bytes = sum(f.stat().st_size for f in all_files if f.exists())
|
|
157
|
+
return {
|
|
158
|
+
"cache_dir": str(cache_d),
|
|
159
|
+
"cores": len(cores),
|
|
160
|
+
"snapshots": len(snapshots),
|
|
161
|
+
"views": len(views),
|
|
162
|
+
"cas_blobs": len(cas_blobs),
|
|
163
|
+
"total_size_bytes": total_bytes,
|
|
164
|
+
"total_size_mb": round(total_bytes / (1024 * 1024), 2),
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def clear(repo_root: Path) -> int:
|
|
169
|
+
"""Delete all cache files for *repo_root*. Returns the number of files removed."""
|
|
170
|
+
cache_d = cache_dir(repo_root)
|
|
171
|
+
if not cache_d.exists():
|
|
172
|
+
return 0
|
|
173
|
+
removed = 0
|
|
174
|
+
for pattern in ("core-*.json.gz", "snapshot-*.json.gz", "view-*.json.gz"):
|
|
175
|
+
for f in cache_d.glob(pattern):
|
|
176
|
+
_safe_unlink(f)
|
|
177
|
+
removed += 1
|
|
178
|
+
cas_d = _cas_dir(cache_d)
|
|
179
|
+
if cas_d.exists():
|
|
180
|
+
for f in cas_d.glob("*.gz"):
|
|
181
|
+
_safe_unlink(f)
|
|
182
|
+
removed += 1
|
|
183
|
+
return removed
|
|
184
|
+
|
|
185
|
+
|
|
127
186
|
# ---------------------------------------------------------------------------
|
|
128
187
|
# Public API — read / write
|
|
129
188
|
# ---------------------------------------------------------------------------
|
|
@@ -193,7 +252,7 @@ def write(
|
|
|
193
252
|
try:
|
|
194
253
|
cache_d.mkdir(parents=True, exist_ok=True)
|
|
195
254
|
payload = _build_envelope(cache_key, content, fmt, layers or {}, cache_d)
|
|
196
|
-
dest
|
|
255
|
+
_atomic_write(dest, payload)
|
|
197
256
|
except Exception:
|
|
198
257
|
return # non-fatal
|
|
199
258
|
|
|
@@ -275,7 +334,7 @@ def write_core(repo_root: Path, core_key: str, core_data: dict[str, Any]) -> str
|
|
|
275
334
|
json.dumps(envelope, ensure_ascii=False).encode("utf-8"),
|
|
276
335
|
compresslevel=6,
|
|
277
336
|
)
|
|
278
|
-
dest
|
|
337
|
+
_atomic_write(dest, payload)
|
|
279
338
|
except Exception:
|
|
280
339
|
pass
|
|
281
340
|
|
|
@@ -327,7 +386,7 @@ def write_view(
|
|
|
327
386
|
try:
|
|
328
387
|
cache_d.mkdir(parents=True, exist_ok=True)
|
|
329
388
|
payload = _build_envelope(view_key, content, fmt, layers or {}, cache_d)
|
|
330
|
-
dest
|
|
389
|
+
_atomic_write(dest, payload)
|
|
331
390
|
except Exception:
|
|
332
391
|
pass
|
|
333
392
|
|
|
@@ -457,7 +516,7 @@ def _cas_store_blob(cache_d: Path, serialised: str) -> str:
|
|
|
457
516
|
path = _cas_path(cache_d, blob_hash)
|
|
458
517
|
if not path.exists():
|
|
459
518
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
460
|
-
path
|
|
519
|
+
_atomic_write(path, gzip.compress(raw, compresslevel=6))
|
|
461
520
|
return blob_hash
|
|
462
521
|
|
|
463
522
|
|
|
@@ -529,12 +588,16 @@ def _cas_restore(
|
|
|
529
588
|
def _gc(cache_d: Path) -> None:
|
|
530
589
|
"""Evict old snapshots/cores/views and sweep orphaned CAS blobs.
|
|
531
590
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
591
|
+
Three eviction passes (all non-fatal):
|
|
592
|
+
1. Commit-based: keep only last SOURCECODE_CACHE_KEEP_COMMITS distinct SHAs.
|
|
593
|
+
2. Core-count: keep at most SOURCECODE_CACHE_MAX_CORES core files (LRU).
|
|
594
|
+
3. Size-based: if total cache exceeds SOURCECODE_CACHE_MAX_SIZE_MB, evict
|
|
595
|
+
oldest core+snapshot files until under budget.
|
|
596
|
+
Views and CAS blobs are swept after each pass.
|
|
536
597
|
"""
|
|
537
598
|
keep = int(os.environ.get("SOURCECODE_CACHE_KEEP_COMMITS", _DEFAULT_KEEP_COMMITS))
|
|
599
|
+
max_cores = int(os.environ.get("SOURCECODE_CACHE_MAX_CORES", _DEFAULT_MAX_CORES))
|
|
600
|
+
max_size_bytes = int(os.environ.get("SOURCECODE_CACHE_MAX_SIZE_MB", _DEFAULT_MAX_SIZE_MB)) * 1024 * 1024
|
|
538
601
|
|
|
539
602
|
try:
|
|
540
603
|
all_snapshots = list(cache_d.glob("snapshot-*.json.gz"))
|
|
@@ -544,7 +607,7 @@ def _gc(cache_d: Path) -> None:
|
|
|
544
607
|
if not all_snapshots and not all_cores and not all_views:
|
|
545
608
|
return
|
|
546
609
|
|
|
547
|
-
#
|
|
610
|
+
# ── Pass 1: commit-based eviction ──────────────────────────────────
|
|
548
611
|
groups: dict[str, list[Path]] = {}
|
|
549
612
|
for f in all_snapshots:
|
|
550
613
|
m = _SNAPSHOT_RE.match(f.name)
|
|
@@ -558,7 +621,6 @@ def _gc(cache_d: Path) -> None:
|
|
|
558
621
|
surviving: list[Path]
|
|
559
622
|
|
|
560
623
|
if keep <= 0 or len(groups) <= keep:
|
|
561
|
-
# No eviction needed — but still sweep views + CAS
|
|
562
624
|
surviving = all_snapshots + all_cores
|
|
563
625
|
else:
|
|
564
626
|
def _newest_mtime(commit: str) -> float:
|
|
@@ -573,7 +635,37 @@ def _gc(cache_d: Path) -> None:
|
|
|
573
635
|
for f in groups[commit]:
|
|
574
636
|
_safe_unlink(f)
|
|
575
637
|
|
|
638
|
+
# ── Pass 2: per-repo core count cap ────────────────────────────────
|
|
639
|
+
if max_cores > 0:
|
|
640
|
+
surviving_cores = [p for p in surviving if p.name.startswith("core-") and p.exists()]
|
|
641
|
+
if len(surviving_cores) > max_cores:
|
|
642
|
+
surviving_cores.sort(key=lambda p: p.stat().st_mtime, reverse=True)
|
|
643
|
+
for evict in surviving_cores[max_cores:]:
|
|
644
|
+
_safe_unlink(evict)
|
|
645
|
+
surviving = [p for p in surviving if p != evict]
|
|
646
|
+
|
|
647
|
+
# ── Pass 3: total size cap ──────────────────────────────────────────
|
|
648
|
+
if max_size_bytes > 0:
|
|
649
|
+
size_candidates = [p for p in surviving if p.exists()]
|
|
650
|
+
# Include CAS blobs in the size budget calculation
|
|
651
|
+
cas_d_sz = _cas_dir(cache_d)
|
|
652
|
+
cas_files = list(cas_d_sz.glob("*.gz")) if cas_d_sz.exists() else []
|
|
653
|
+
total = sum(p.stat().st_size for p in size_candidates if not p.name.startswith("view-"))
|
|
654
|
+
total += sum(p.stat().st_size for p in cas_files if p.exists())
|
|
655
|
+
if total > max_size_bytes:
|
|
656
|
+
# Sort oldest-first; evict core+snapshot files until under budget
|
|
657
|
+
size_candidates.sort(key=lambda p: p.stat().st_mtime)
|
|
658
|
+
for evict in size_candidates:
|
|
659
|
+
if evict.name.startswith("view-"):
|
|
660
|
+
continue
|
|
661
|
+
total -= evict.stat().st_size if evict.exists() else 0
|
|
662
|
+
_safe_unlink(evict)
|
|
663
|
+
surviving = [p for p in surviving if p != evict]
|
|
664
|
+
if total <= max_size_bytes:
|
|
665
|
+
break
|
|
666
|
+
|
|
576
667
|
# Prune view files whose core hash is no longer in the surviving set
|
|
668
|
+
all_views = list(cache_d.glob("view-*.json.gz"))
|
|
577
669
|
_gc_views(cache_d, surviving, all_views)
|
|
578
670
|
|
|
579
671
|
# Sweep orphaned CAS blobs (surviving snapshots + view files may ref them)
|
|
@@ -648,6 +740,23 @@ def _gc_cas(cache_d: Path, surviving_snapshots: list[Path]) -> None:
|
|
|
648
740
|
# Utilities
|
|
649
741
|
# ---------------------------------------------------------------------------
|
|
650
742
|
|
|
743
|
+
def _atomic_write(dest: Path, data: bytes) -> None:
|
|
744
|
+
"""Write *data* to *dest* atomically via a sibling .tmp file + rename.
|
|
745
|
+
|
|
746
|
+
On POSIX, ``Path.replace()`` is a single ``rename(2)`` syscall — the
|
|
747
|
+
destination either has the old content or the new content, never a partial
|
|
748
|
+
write. The .tmp suffix keeps the partial file out of glob patterns used
|
|
749
|
+
by the cache reader and GC.
|
|
750
|
+
"""
|
|
751
|
+
tmp = dest.with_suffix(".tmp")
|
|
752
|
+
try:
|
|
753
|
+
tmp.write_bytes(data)
|
|
754
|
+
tmp.replace(dest)
|
|
755
|
+
except Exception:
|
|
756
|
+
_safe_unlink(tmp)
|
|
757
|
+
raise
|
|
758
|
+
|
|
759
|
+
|
|
651
760
|
def _safe_unlink(path: Path) -> None:
|
|
652
761
|
try:
|
|
653
762
|
path.unlink(missing_ok=True)
|