arxo-codegen 0.4.0__py3-none-any.whl
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.
- arxo_codegen/__init__.py +5 -0
- arxo_codegen/__main__.py +7 -0
- arxo_codegen/active-outcomes.json +6837 -0
- arxo_codegen/check.py +158 -0
- arxo_codegen/check_active_canaries.py +262 -0
- arxo_codegen/check_api.py +76 -0
- arxo_codegen/check_conformance.py +414 -0
- arxo_codegen/check_matrix.py +131 -0
- arxo_codegen/check_packages.py +281 -0
- arxo_codegen/check_semantic_probes.py +293 -0
- arxo_codegen/check_xlsx.py +320 -0
- arxo_codegen/consumer_runner.py +316 -0
- arxo_codegen/core_support.py +203 -0
- arxo_codegen/coverage.py +341 -0
- arxo_codegen/deliver.py +180 -0
- arxo_codegen/examples/xlsx/pricing.lawir.json +409 -0
- arxo_codegen/examples/xlsx/pricing.xlsx.json +52 -0
- arxo_codegen/excel_plan.py +602 -0
- arxo_codegen/harness/verify/ci/gates/backends/check_backends.py +1248 -0
- arxo_codegen/harness/verify/ci/gates/backends/l1_fixtures.py +463 -0
- arxo_codegen/inert-nodes.json +62 -0
- arxo_codegen/inert.py +91 -0
- arxo_codegen/inputs.py +59 -0
- arxo_codegen/package.py +565 -0
- arxo_codegen/plan.py +4053 -0
- arxo_codegen/recertify_registry.py +100 -0
- arxo_codegen/runtime-cert.json +5259 -0
- arxo_codegen/runtime_cert.py +233 -0
- arxo_codegen/survey.py +272 -0
- arxo_codegen/target_runner.py +101 -0
- arxo_codegen/targets/bsl/cert.bsl +113 -0
- arxo_codegen/targets/bsl/emit.py +356 -0
- arxo_codegen/targets/bsl/json.bsl +243 -0
- arxo_codegen/targets/bsl/runner.bsl +210 -0
- arxo_codegen/targets/bsl/runtime.bsl +858 -0
- arxo_codegen/targets/cs/Cert.cs +90 -0
- arxo_codegen/targets/cs/Runner.cs +154 -0
- arxo_codegen/targets/cs/Runtime.cs +243 -0
- arxo_codegen/targets/cs/emit.py +223 -0
- arxo_codegen/targets/dart/cert.dart +99 -0
- arxo_codegen/targets/dart/emit.py +206 -0
- arxo_codegen/targets/dart/json.dart +166 -0
- arxo_codegen/targets/dart/runner.dart +154 -0
- arxo_codegen/targets/dart/runtime.dart +293 -0
- arxo_codegen/targets/erl/cert.erl +64 -0
- arxo_codegen/targets/erl/emit.py +216 -0
- arxo_codegen/targets/erl/rt.erl +238 -0
- arxo_codegen/targets/erl/runner.erl +130 -0
- arxo_codegen/targets/ex/cert.exs +62 -0
- arxo_codegen/targets/ex/emit.py +204 -0
- arxo_codegen/targets/ex/runner.exs +124 -0
- arxo_codegen/targets/ex/runtime.ex +227 -0
- arxo_codegen/targets/go/apiBase.go +483 -0
- arxo_codegen/targets/go/apicheck.go +97 -0
- arxo_codegen/targets/go/cert.go +218 -0
- arxo_codegen/targets/go/emit.py +1806 -0
- arxo_codegen/targets/go/evaluate.go +1826 -0
- arxo_codegen/targets/go/runner.go +38 -0
- arxo_codegen/targets/go/runtime.go +2612 -0
- arxo_codegen/targets/java/Cert.java +91 -0
- arxo_codegen/targets/java/Json.java +148 -0
- arxo_codegen/targets/java/Runner.java +151 -0
- arxo_codegen/targets/java/Runtime.java +243 -0
- arxo_codegen/targets/java/emit.py +198 -0
- arxo_codegen/targets/kt/Cert.kt +67 -0
- arxo_codegen/targets/kt/Json.kt +103 -0
- arxo_codegen/targets/kt/Runner.kt +126 -0
- arxo_codegen/targets/kt/Runtime.kt +196 -0
- arxo_codegen/targets/kt/emit.py +195 -0
- arxo_codegen/targets/lua/cert.lua +82 -0
- arxo_codegen/targets/lua/emit.py +250 -0
- arxo_codegen/targets/lua/json.lua +133 -0
- arxo_codegen/targets/lua/runner.lua +167 -0
- arxo_codegen/targets/lua/runtime.lua +541 -0
- arxo_codegen/targets/php/cert.php +84 -0
- arxo_codegen/targets/php/emit.py +229 -0
- arxo_codegen/targets/php/json.php +144 -0
- arxo_codegen/targets/php/runner.php +189 -0
- arxo_codegen/targets/php/runtime.php +660 -0
- arxo_codegen/targets/py/api_base.py +334 -0
- arxo_codegen/targets/py/apicheck.py +51 -0
- arxo_codegen/targets/py/cert.py +140 -0
- arxo_codegen/targets/py/emit.py +1140 -0
- arxo_codegen/targets/py/evaluate.py +980 -0
- arxo_codegen/targets/py/runner.py +38 -0
- arxo_codegen/targets/py/runtime.py +1634 -0
- arxo_codegen/targets/rb/cert.rb +73 -0
- arxo_codegen/targets/rb/emit.py +203 -0
- arxo_codegen/targets/rb/runner.rb +130 -0
- arxo_codegen/targets/rb/runtime.rb +255 -0
- arxo_codegen/targets/rs/Cargo.lock +142 -0
- arxo_codegen/targets/rs/Cargo.toml +16 -0
- arxo_codegen/targets/rs/cert.rs +106 -0
- arxo_codegen/targets/rs/emit.py +233 -0
- arxo_codegen/targets/rs/prefetch.rs +1 -0
- arxo_codegen/targets/rs/runner.rs +181 -0
- arxo_codegen/targets/rs/runtime.rs +448 -0
- arxo_codegen/targets/scala/Cert.scala +77 -0
- arxo_codegen/targets/scala/Json.scala +140 -0
- arxo_codegen/targets/scala/Runner.scala +121 -0
- arxo_codegen/targets/scala/Runtime.scala +269 -0
- arxo_codegen/targets/scala/emit.py +193 -0
- arxo_codegen/targets/swift/cert.swift +105 -0
- arxo_codegen/targets/swift/emit.py +231 -0
- arxo_codegen/targets/swift/json.swift +208 -0
- arxo_codegen/targets/swift/runner.swift +133 -0
- arxo_codegen/targets/swift/runtime.swift +528 -0
- arxo_codegen/targets/ts/apiBase.ts +250 -0
- arxo_codegen/targets/ts/apicheck.ts +37 -0
- arxo_codegen/targets/ts/cert.ts +96 -0
- arxo_codegen/targets/ts/emit.py +1214 -0
- arxo_codegen/targets/ts/evaluate.ts +894 -0
- arxo_codegen/targets/ts/package-lock.json +45 -0
- arxo_codegen/targets/ts/package.json +9 -0
- arxo_codegen/targets/ts/runner.ts +31 -0
- arxo_codegen/targets/ts/runtime.ts +1369 -0
- arxo_codegen/targets/xlsx/README.ru.md +176 -0
- arxo_codegen/targets/xlsx/emit.py +198 -0
- arxo_codegen/temporal.py +59 -0
- arxo_codegen/test_alias_types.py +171 -0
- arxo_codegen/test_api_contract.py +89 -0
- arxo_codegen/test_calendar_policy.py +48 -0
- arxo_codegen/test_check.py +49 -0
- arxo_codegen/test_check_active_canaries.py +96 -0
- arxo_codegen/test_check_conformance.py +132 -0
- arxo_codegen/test_check_semantic_probes.py +85 -0
- arxo_codegen/test_check_xlsx.py +52 -0
- arxo_codegen/test_consumer_runner.py +175 -0
- arxo_codegen/test_core_support.py +80 -0
- arxo_codegen/test_e0212_decision_time.py +63 -0
- arxo_codegen/test_head_aggregate.py +71 -0
- arxo_codegen/test_inert.py +143 -0
- arxo_codegen/test_instant_types.py +113 -0
- arxo_codegen/test_key_conflict_scope.py +92 -0
- arxo_codegen/test_key_conflict_targets.py +17 -0
- arxo_codegen/test_package_layout.py +163 -0
- arxo_codegen/test_plan_language_version.py +44 -0
- arxo_codegen/test_positions_refusal.py +43 -0
- arxo_codegen/test_recertify_registry.py +77 -0
- arxo_codegen/test_ruby_target.py +41 -0
- arxo_codegen/test_runtime_cert.py +83 -0
- arxo_codegen/test_secondary_key_conflict_scope.py +17 -0
- arxo_codegen/test_stage_r.py +108 -0
- arxo_codegen/test_standalone_inputs.py +71 -0
- arxo_codegen/test_support.py +150 -0
- arxo_codegen/test_survey_inputs.py +115 -0
- arxo_codegen-0.4.0.dist-info/LICENSE +202 -0
- arxo_codegen-0.4.0.dist-info/METADATA +1673 -0
- arxo_codegen-0.4.0.dist-info/RECORD +152 -0
- arxo_codegen-0.4.0.dist-info/WHEEL +5 -0
- arxo_codegen-0.4.0.dist-info/entry_points.txt +13 -0
- arxo_codegen-0.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""Stage R boundaries are structural, never selected by a vector's name."""
|
|
2
|
+
import copy
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
import tempfile
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
import deliver
|
|
12
|
+
import plan
|
|
13
|
+
|
|
14
|
+
STD = "urn:law:std#"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def program(nodes=()):
|
|
18
|
+
return {"semanticVersion": "0.2.11", "schemaVersion": "law.core.ir/0.7", "nodes": list(nodes)}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class StageRPlanningTests(unittest.TestCase):
|
|
22
|
+
def test_admission_has_its_own_plan_version_and_includes_world_nodes(self):
|
|
23
|
+
root = program([{"kind": "source_work", "id": "urn:root#work"}])
|
|
24
|
+
p = plan.build_plan(root)
|
|
25
|
+
self.assertEqual(p["planVersion"], "law-backend-plan/0.20")
|
|
26
|
+
self.assertIn("admission:current", p["capabilities"])
|
|
27
|
+
self.assertEqual(p["admission"]["reservedAssertionIds"], ["urn:root#work"])
|
|
28
|
+
|
|
29
|
+
def test_norms_refuse_for_every_query_including_plain_truth(self):
|
|
30
|
+
ir = program([{"kind": "norm_template", "id": "urn:test#duty"}])
|
|
31
|
+
for entry in (plan.build_plan, plan.survey_plan, plan.Builder):
|
|
32
|
+
with self.subTest(entry=entry.__name__), self.assertRaisesRegex(plan.Refused, "NORM_RANKS_UNAVAILABLE"):
|
|
33
|
+
entry(ir)
|
|
34
|
+
|
|
35
|
+
def test_hand_built_norm_plans_cannot_reach_retired_emitters(self):
|
|
36
|
+
for lang in ("py", "ts", "go"):
|
|
37
|
+
with self.subTest(lang=lang), self.assertRaisesRegex(ValueError, "NORM_RANKS_UNAVAILABLE"):
|
|
38
|
+
deliver.emitter(lang).check_plan({"planVersion": "law-backend-plan/0.10", "norms": []})
|
|
39
|
+
|
|
40
|
+
def test_invalid_typed_bounds_refuse_before_planning(self):
|
|
41
|
+
for node, suffix in [
|
|
42
|
+
({"kind": "rule", "effective": {"start": "2026-02-30"}}, "/effective/start"),
|
|
43
|
+
({"kind": "assertion", "valid": {"end": "2026-01-01T12:00:00"}}, "/valid/end"),
|
|
44
|
+
({"kind": "rule", "governs": [{"start": "2026-01-01T00:00:00+00:99"}]}, "/governs/0/start"),
|
|
45
|
+
({"kind": "source_edition", "lifecycle": [{"extent": "0000-01-01"}]}, "/lifecycle/0/extent"),
|
|
46
|
+
]:
|
|
47
|
+
with self.subTest(node=node), self.assertRaisesRegex(plan.Refused, "TEMPORAL_BOUND_INVALID") as exc:
|
|
48
|
+
plan.build_plan(program([node]))
|
|
49
|
+
self.assertIn("/nodes/0" + suffix, str(exc.exception))
|
|
50
|
+
|
|
51
|
+
def test_temporal_looking_metadata_is_not_a_typed_bound(self):
|
|
52
|
+
from temporal import validate_ir
|
|
53
|
+
validate_ir(program([{"kind": "source_work", "payload": {"valid": {"start": "bad"}}}]), plan.Refused)
|
|
54
|
+
|
|
55
|
+
def test_go_factory_does_not_read_closure_names_inside_json_as_dependencies(self):
|
|
56
|
+
source = ('package main\n'
|
|
57
|
+
'var BACKCHAIN = planJSON("{\\"status\\": \\"established\\"}").([]interface{})\n'
|
|
58
|
+
'func status() string { return "ok" }\n')
|
|
59
|
+
generated = deliver.emitter("go")._factory(source, {})
|
|
60
|
+
self.assertIn('var BACKCHAIN = planJSON(', generated)
|
|
61
|
+
|
|
62
|
+
def test_valid_arbitrary_fraction_and_infinity_are_admitted(self):
|
|
63
|
+
from temporal import validate_ir
|
|
64
|
+
validate_ir(program([{"kind": "rule", "effective": {
|
|
65
|
+
"start": "0001-01-01T00:00:00.123456789123456789+23:59", "end": "infinity"}}]), plan.Refused)
|
|
66
|
+
with self.assertRaisesRegex(plan.Refused, "TEMPORAL_BOUND_INVALID"):
|
|
67
|
+
validate_ir(program([{"kind": "rule", "effective": {"start": "infinity"}}]), plan.Refused)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@unittest.skipUnless(os.environ.get("LAW_CODEGEN_TEST_CORE_KIT"), "requires current core kit")
|
|
71
|
+
class StageRRunnerTests(unittest.TestCase):
|
|
72
|
+
def test_primary_runners_enforce_admission_and_positions_before_computation(self):
|
|
73
|
+
# One small emitted model per target, then several independent requests.
|
|
74
|
+
import core_support
|
|
75
|
+
core_support.configure_core_kit(Path(os.environ["LAW_CODEGEN_TEST_CORE_KIT"]))
|
|
76
|
+
ir = program([{"kind": "source_work", "id": "urn:test#work"}])
|
|
77
|
+
pl = plan.build_plan(ir)
|
|
78
|
+
cases = [
|
|
79
|
+
({}, {"kind": "positions"}, "POSITIONS_UNAVAILABLE"),
|
|
80
|
+
({"assertions": [{"id": "urn:test#work"}]}, {"kind": "truth"}, "LDC-E1382"),
|
|
81
|
+
({"assertions": [{"valid": {"start": "2026-02-30"}}]}, {"kind": "truth"}, "TEMPORAL_BOUND_INVALID"),
|
|
82
|
+
({"assertions": [{"literal": {"kind": "literal", "args": [
|
|
83
|
+
{"kind": "value", "type": {"name": STD + "Number"}, "value": "3/2"}]}}]},
|
|
84
|
+
{"kind": "truth"}, "NUMBER_UNAVAILABLE"),
|
|
85
|
+
]
|
|
86
|
+
with tempfile.TemporaryDirectory(prefix="stage-r-runners-") as raw:
|
|
87
|
+
root = Path(raw)
|
|
88
|
+
for lang in ("py", "ts", "go"):
|
|
89
|
+
em = deliver.emitter(lang)
|
|
90
|
+
project = root / lang
|
|
91
|
+
deliver.emit_project(pl, lang, project)
|
|
92
|
+
step = em.build(str(project))
|
|
93
|
+
if step:
|
|
94
|
+
command, cwd = step
|
|
95
|
+
subprocess.run(command, cwd=cwd, check=True, capture_output=True, text=True)
|
|
96
|
+
for case, query, code in cases:
|
|
97
|
+
with self.subTest(lang=lang, code=code):
|
|
98
|
+
c, q = root / "case.json", root / "query.json"
|
|
99
|
+
c.write_text(json.dumps(case)); q.write_text(json.dumps(query))
|
|
100
|
+
command, cwd = em.run(str(project), "runner")
|
|
101
|
+
result = subprocess.run(command + [str(c), str(q)], cwd=cwd,
|
|
102
|
+
capture_output=True, text=True, timeout=15)
|
|
103
|
+
self.assertEqual(result.returncode, 3, result.stderr)
|
|
104
|
+
self.assertTrue(json.loads(result.stdout)["refused"].startswith(code), result.stdout)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if __name__ == "__main__":
|
|
108
|
+
unittest.main()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Regression checks for explicit standalone input boundaries."""
|
|
2
|
+
import hashlib
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
import unittest
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
10
|
+
import inputs
|
|
11
|
+
import plan
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class StandaloneInputsTests(unittest.TestCase):
|
|
15
|
+
def test_world_indexes_do_not_leak_between_roots(self):
|
|
16
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
17
|
+
roots = [Path(tmp) / name for name in ("a", "b")]
|
|
18
|
+
for root in roots:
|
|
19
|
+
directory = root / "corpus" / "clir"
|
|
20
|
+
directory.mkdir(parents=True)
|
|
21
|
+
(directory / "p.lawir.json").write_text(json.dumps({"package": {"name": root.name}}))
|
|
22
|
+
self.assertEqual({"a"}, set(plan.world_index(roots[0])))
|
|
23
|
+
self.assertEqual({"b"}, set(plan.world_index(roots[1])))
|
|
24
|
+
|
|
25
|
+
def test_duplicate_dependencies_are_not_silently_selected(self):
|
|
26
|
+
doc = {"package": {"name": "dep"}}
|
|
27
|
+
with self.assertRaisesRegex(plan.Refused, "неоднозначная"):
|
|
28
|
+
plan.resolve_world({"imports": []}, {}, [doc, doc])
|
|
29
|
+
|
|
30
|
+
def test_resources_are_verified_and_confined(self):
|
|
31
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
32
|
+
root = Path(tmp)
|
|
33
|
+
data = b'{"calendar": true}'
|
|
34
|
+
(root / "calendar.json").write_bytes(data)
|
|
35
|
+
manifest = root / "resources.json"
|
|
36
|
+
entry = {"path": "calendar.json", "sha256": "sha256:" + hashlib.sha256(data).hexdigest()}
|
|
37
|
+
manifest.write_text(json.dumps({"artifact:calendar": entry}))
|
|
38
|
+
self.assertEqual({"artifact:calendar": data}, inputs.load_resources(manifest))
|
|
39
|
+
(root / "calendar.json").write_bytes(b"changed")
|
|
40
|
+
with self.assertRaisesRegex(plan.Refused, "хэш"):
|
|
41
|
+
inputs.load_resources(manifest)
|
|
42
|
+
entry["path"] = "../outside"
|
|
43
|
+
manifest.write_text(json.dumps({"artifact:calendar": entry}))
|
|
44
|
+
with self.assertRaisesRegex(plan.Refused, "вне комплекта"):
|
|
45
|
+
inputs.load_resources(manifest)
|
|
46
|
+
|
|
47
|
+
def test_corpus_resources_read_only_explicit_root(self):
|
|
48
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
49
|
+
root = Path(temp)
|
|
50
|
+
(root / "calendar.json").write_bytes(b"fixture")
|
|
51
|
+
node = {"kind": "calendar_snapshot", "resourceUri": "artifact:calendar.json"}
|
|
52
|
+
self.assertEqual({"artifact:calendar.json": b"fixture"},
|
|
53
|
+
inputs.corpus_resources([{"nodes": [node]}], root))
|
|
54
|
+
node["resourceUri"] = "artifact:../outside"
|
|
55
|
+
with self.assertRaisesRegex(plan.Refused, "escapes"):
|
|
56
|
+
inputs.corpus_resources([{"nodes": [node]}], root)
|
|
57
|
+
|
|
58
|
+
def test_explicit_empty_resources_do_not_fall_back_to_checkout(self):
|
|
59
|
+
# The URI names a file that exists in this checkout. Explicit resource
|
|
60
|
+
# maps must still report it missing rather than read ambient bytes.
|
|
61
|
+
builder = object.__new__(plan.Builder)
|
|
62
|
+
builder.ir = {"semanticVersion": "0.2.11", "nodes": [{"kind": "calendar_snapshot",
|
|
63
|
+
"id": "calendar", "resourceUri": "artifact:engines/backends/plan.py"}]}
|
|
64
|
+
builder.resources = {}
|
|
65
|
+
builder.repository_resources = False
|
|
66
|
+
env = builder._calendar_env()
|
|
67
|
+
self.assertIn("MISSING_CALENDAR", json.dumps(env))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
unittest.main()
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""Portable data roots for backend tests.
|
|
2
|
+
|
|
3
|
+
When exported deliveries are supplied, tests validate and copy those immutable
|
|
4
|
+
inputs instead of reaching into a law-dsl checkout. The tracked-source path
|
|
5
|
+
remains available for backend development until the standalone cutover.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import hashlib
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
import shutil
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
HERE = Path(__file__).resolve().parent
|
|
18
|
+
MONOREPO_ROOT = HERE.parents[1]
|
|
19
|
+
FIXTURES_ENV = "LAW_CODEGEN_TEST_FIXTURES"
|
|
20
|
+
CORE_KIT_ENV = "LAW_CODEGEN_TEST_CORE_KIT"
|
|
21
|
+
XLSX_ENV = "LAW_CODEGEN_TEST_XLSX"
|
|
22
|
+
CANARIES_ENV = "LAW_CODEGEN_TEST_CANARIES"
|
|
23
|
+
SEMANTIC_ENV = "LAW_CODEGEN_TEST_SEMANTIC"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _external(name: str) -> Path | None:
|
|
27
|
+
value = os.environ.get(name)
|
|
28
|
+
return Path(value).resolve() if value else None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def fixture_root() -> Path:
|
|
32
|
+
root = _external(FIXTURES_ENV)
|
|
33
|
+
if root is None:
|
|
34
|
+
return MONOREPO_ROOT
|
|
35
|
+
manifest_path = root / "manifest.json"
|
|
36
|
+
try:
|
|
37
|
+
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
|
38
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
39
|
+
raise RuntimeError(f"{FIXTURES_ENV}: fixture manifest unreadable") from exc
|
|
40
|
+
if manifest.get("format") != "law.codegen-fixtures/0.1":
|
|
41
|
+
raise RuntimeError(f"{FIXTURES_ENV}: unsupported fixture format")
|
|
42
|
+
listed = set()
|
|
43
|
+
for row in manifest.get("files") or []:
|
|
44
|
+
relative = row.get("path")
|
|
45
|
+
if not isinstance(relative, str) or not relative or Path(relative).is_absolute() or ".." in Path(relative).parts:
|
|
46
|
+
raise RuntimeError(f"{FIXTURES_ENV}: invalid fixture path")
|
|
47
|
+
path = root / relative
|
|
48
|
+
data = path.read_bytes()
|
|
49
|
+
if relative in listed or path.is_symlink() or row.get("bytes") != len(data) or row.get("sha256") != "sha256:" + hashlib.sha256(data).hexdigest():
|
|
50
|
+
raise RuntimeError(f"{FIXTURES_ENV}: invalid fixture inventory")
|
|
51
|
+
listed.add(relative)
|
|
52
|
+
required = {"runtime/runtime-cert.json", "data/backends-vectors.json"}
|
|
53
|
+
if not required <= listed:
|
|
54
|
+
raise RuntimeError(f"{FIXTURES_ENV}: incomplete fixture kit")
|
|
55
|
+
actual = {path.relative_to(root).as_posix() for path in root.rglob("*") if path.is_file()}
|
|
56
|
+
if actual != listed | {"manifest.json"}:
|
|
57
|
+
raise RuntimeError(f"{FIXTURES_ENV}: fixture inventory differs from files")
|
|
58
|
+
return root
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def vector(relative: str) -> Path:
|
|
62
|
+
root = fixture_root()
|
|
63
|
+
path = (root / "vectors" / relative) if _external(FIXTURES_ENV) else (root / "verify/vectors" / relative)
|
|
64
|
+
if not path.is_dir():
|
|
65
|
+
raise RuntimeError(f"test vector is absent: {relative}")
|
|
66
|
+
return path
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def materialize_core_kit(destination: Path, *, source_commit: str) -> dict:
|
|
70
|
+
"""Create a test kit at *destination*, validating an exported source first."""
|
|
71
|
+
sys.path.insert(0, str(HERE))
|
|
72
|
+
import core_support
|
|
73
|
+
exported = _external(CORE_KIT_ENV)
|
|
74
|
+
if exported is not None:
|
|
75
|
+
source_manifest = core_support.validate_core_kit(exported)
|
|
76
|
+
shutil.copytree(exported, destination)
|
|
77
|
+
copied_manifest = core_support.validate_core_kit(destination)
|
|
78
|
+
if copied_manifest != source_manifest:
|
|
79
|
+
raise RuntimeError("copied core kit differs from validated export")
|
|
80
|
+
return copied_manifest
|
|
81
|
+
registry = MONOREPO_ROOT / "apps/registry"
|
|
82
|
+
if not registry.is_dir():
|
|
83
|
+
raise RuntimeError(f"{CORE_KIT_ENV} is required outside the monorepo")
|
|
84
|
+
sys.path.insert(0, str(registry))
|
|
85
|
+
import codegen_core_pack
|
|
86
|
+
codegen_core_pack.pack(destination, source_commit=source_commit)
|
|
87
|
+
return codegen_core_pack.validate(destination)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def materialize_xlsx(destination: Path) -> Path:
|
|
91
|
+
"""Copy a structurally validated XLSX delivery, or publish one in-tree."""
|
|
92
|
+
source = _external(XLSX_ENV)
|
|
93
|
+
sys.path.insert(0, str(HERE))
|
|
94
|
+
import check_xlsx
|
|
95
|
+
if source is not None:
|
|
96
|
+
_manifest, expected = check_xlsx.load(source)
|
|
97
|
+
check_xlsx.structural(source, expected)
|
|
98
|
+
shutil.copytree(source, destination)
|
|
99
|
+
_manifest, copied = check_xlsx.load(destination)
|
|
100
|
+
check_xlsx.structural(destination, copied)
|
|
101
|
+
return destination
|
|
102
|
+
tools = MONOREPO_ROOT / "verify/ci/tools"
|
|
103
|
+
if not tools.is_dir():
|
|
104
|
+
raise RuntimeError(f"{XLSX_ENV} is required outside the monorepo")
|
|
105
|
+
sys.path.insert(0, str(tools))
|
|
106
|
+
import export_codegen_xlsx
|
|
107
|
+
export_codegen_xlsx.export(destination)
|
|
108
|
+
return destination
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def materialize_canaries(destination: Path) -> Path:
|
|
112
|
+
"""Copy a provenance-validated canary delivery, or publish one in-tree."""
|
|
113
|
+
source = _external(CANARIES_ENV)
|
|
114
|
+
sys.path.insert(0, str(HERE))
|
|
115
|
+
import check_active_canaries
|
|
116
|
+
if source is not None:
|
|
117
|
+
check_active_canaries.load(source)
|
|
118
|
+
shutil.copytree(source, destination)
|
|
119
|
+
check_active_canaries.load(destination)
|
|
120
|
+
return destination
|
|
121
|
+
tools = MONOREPO_ROOT / "verify/ci/tools"
|
|
122
|
+
if not tools.is_dir():
|
|
123
|
+
raise RuntimeError(f"{CANARIES_ENV} is required outside the monorepo")
|
|
124
|
+
sys.path.insert(0, str(tools))
|
|
125
|
+
import export_codegen_active_canaries
|
|
126
|
+
export_codegen_active_canaries.export(destination)
|
|
127
|
+
return destination
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def materialize_semantic_probes(destination: Path) -> Path:
|
|
131
|
+
"""Copy a hash-validated semantic-probe delivery, or publish it in-tree."""
|
|
132
|
+
source = _external(SEMANTIC_ENV)
|
|
133
|
+
sys.path.insert(0, str(HERE))
|
|
134
|
+
import check_semantic_probes
|
|
135
|
+
if source is not None:
|
|
136
|
+
check_semantic_probes.load(source)
|
|
137
|
+
shutil.copytree(source, destination)
|
|
138
|
+
check_semantic_probes.load(destination)
|
|
139
|
+
return destination
|
|
140
|
+
tools = MONOREPO_ROOT / "verify/ci/tools"
|
|
141
|
+
if not tools.is_dir():
|
|
142
|
+
raise RuntimeError(f"{SEMANTIC_ENV} is required outside the monorepo")
|
|
143
|
+
sys.path.insert(0, str(tools))
|
|
144
|
+
import export_codegen_semantic_probes
|
|
145
|
+
export_codegen_semantic_probes.export(destination)
|
|
146
|
+
return destination
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def uses_exported_inputs() -> bool:
|
|
150
|
+
return _external(FIXTURES_ENV) is not None or _external(CORE_KIT_ENV) is not None
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""Bounded regression tests for the standalone survey CLI."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import contextlib
|
|
5
|
+
import io
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
8
|
+
import tempfile
|
|
9
|
+
import unittest
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
14
|
+
import survey
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def document(name: str, imports: list[str] | None = None) -> dict:
|
|
18
|
+
return {
|
|
19
|
+
"semanticVersion": "0.2.11", "schemaVersion": "law.core.ir/0.7",
|
|
20
|
+
"package": {"name": name, "namespace": f"urn:test:{name}", "version": "0.1"},
|
|
21
|
+
"imports": [{"package": {"name": dependency}} for dependency in imports or []],
|
|
22
|
+
"nodes": [],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SurveyInputsTests(unittest.TestCase):
|
|
27
|
+
def run_survey(self, args: list[str]) -> tuple[int, str, str]:
|
|
28
|
+
stdout, stderr = io.StringIO(), io.StringIO()
|
|
29
|
+
with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
|
|
30
|
+
try:
|
|
31
|
+
result = survey.main(args)
|
|
32
|
+
except SystemExit as error:
|
|
33
|
+
result = int(error.code)
|
|
34
|
+
return result, stdout.getvalue(), stderr.getvalue()
|
|
35
|
+
|
|
36
|
+
def write(self, root: Path, name: str, doc: dict) -> Path:
|
|
37
|
+
path = root / name
|
|
38
|
+
path.write_text(json.dumps(doc), encoding="utf-8")
|
|
39
|
+
return path
|
|
40
|
+
|
|
41
|
+
def test_explicit_dependencies_form_each_root_world(self):
|
|
42
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
43
|
+
root = Path(temporary)
|
|
44
|
+
first = self.write(root, "first.lawir.json", document("first", ["dep-a"]))
|
|
45
|
+
second = self.write(root, "second.lawir.json", document("second", ["dep-b"]))
|
|
46
|
+
dep_a = self.write(root, "dep-a.lawir.json", document("dep-a"))
|
|
47
|
+
dep_b = self.write(root, "dep-b.lawir.json", document("dep-b"))
|
|
48
|
+
code, output, errors = self.run_survey([
|
|
49
|
+
str(first), str(second), "--dep", str(dep_a), "--dep", str(dep_b),
|
|
50
|
+
])
|
|
51
|
+
self.assertEqual(0, code, errors)
|
|
52
|
+
self.assertIn("принят: first (first.lawir.json)", output)
|
|
53
|
+
self.assertIn("принят: second (second.lawir.json)", output)
|
|
54
|
+
|
|
55
|
+
def test_missing_dependency_is_a_named_refusal_without_discovery(self):
|
|
56
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
57
|
+
root = Path(temporary)
|
|
58
|
+
program = self.write(root, "program.lawir.json", document("program", ["missing"]))
|
|
59
|
+
code, output, errors = self.run_survey([str(program), "--package", "program"])
|
|
60
|
+
self.assertEqual(0, code, errors)
|
|
61
|
+
self.assertIn("импорт без снимка CLIR в мире: missing", output)
|
|
62
|
+
|
|
63
|
+
def test_input_directory_is_bounded_and_report_uses_relative_name(self):
|
|
64
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
65
|
+
root = Path(temporary)
|
|
66
|
+
inputs = root / "inputs"
|
|
67
|
+
nested = inputs / "nested"
|
|
68
|
+
nested.mkdir(parents=True)
|
|
69
|
+
self.write(inputs, "one.lawir.json", document("one"))
|
|
70
|
+
self.write(nested, "two.lawir.json", document("two"))
|
|
71
|
+
report = root / "report.md"
|
|
72
|
+
code, output, errors = self.run_survey(["--input-dir", str(inputs), "--report", str(report)])
|
|
73
|
+
self.assertEqual(0, code, errors)
|
|
74
|
+
self.assertIn("принят: one (one.lawir.json)", output)
|
|
75
|
+
self.assertIn("принят: two (nested/two.lawir.json)", output)
|
|
76
|
+
self.assertIn("`one` (one.lawir.json)", report.read_text(encoding="utf-8"))
|
|
77
|
+
|
|
78
|
+
def test_input_directory_forms_a_bounded_dependency_bundle(self):
|
|
79
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
80
|
+
root = Path(temporary) / "inputs"
|
|
81
|
+
root.mkdir()
|
|
82
|
+
self.write(root, "a.lawir.json", document("a", ["b"]))
|
|
83
|
+
self.write(root, "b.lawir.json", document("b"))
|
|
84
|
+
code, output, errors = self.run_survey(["--input-dir", str(root)])
|
|
85
|
+
self.assertEqual(0, code, errors)
|
|
86
|
+
self.assertIn("принят: a (a.lawir.json)", output)
|
|
87
|
+
self.assertIn("принят: b (b.lawir.json)", output)
|
|
88
|
+
|
|
89
|
+
def test_duplicate_named_inputs_are_rejected_before_planning(self):
|
|
90
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
91
|
+
root = Path(temporary)
|
|
92
|
+
self.write(root, "first.lawir.json", document("same"))
|
|
93
|
+
self.write(root, "second.lawir.json", document("same"))
|
|
94
|
+
code, _output, errors = self.run_survey(["--input-dir", str(root)])
|
|
95
|
+
self.assertEqual(2, code)
|
|
96
|
+
self.assertIn("неоднозначный CLIR пакета same", errors)
|
|
97
|
+
|
|
98
|
+
def test_no_input_is_an_argument_error(self):
|
|
99
|
+
code, _output, errors = self.run_survey([])
|
|
100
|
+
self.assertEqual(2, code)
|
|
101
|
+
self.assertIn("укажите CLIR-файлы", errors)
|
|
102
|
+
|
|
103
|
+
def test_explicit_corpus_root_preserves_legacy_discovery(self):
|
|
104
|
+
with tempfile.TemporaryDirectory() as temporary:
|
|
105
|
+
root = Path(temporary)
|
|
106
|
+
clir = root / "corpus" / "clir"
|
|
107
|
+
clir.mkdir(parents=True)
|
|
108
|
+
self.write(clir, "legacy.lawir.json", document("legacy"))
|
|
109
|
+
code, output, errors = self.run_survey(["--corpus-root", str(root)])
|
|
110
|
+
self.assertEqual(0, code, errors)
|
|
111
|
+
self.assertIn("принят: legacy (corpus/clir/legacy.lawir.json)", output)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
unittest.main()
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated 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 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
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|