Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed-terraphim"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion catalog/terraphim-lsp/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion catalog/terraphim-lsp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed-terraphim-lsp"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion catalog/terraphim-lsp/extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id = "terraphim-lsp"
name = "Terraphim LSP"
version = "0.2.0"
version = "0.2.1"
schema_version = 1
authors = ["Terraphim Team <team@terraphim.ai>"]
description = "Terraphim knowledge-graph hover, synonym code actions, Lab marks and faded ghost text for Markdown, via terraphim-lsp."
Expand Down
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id = "terraphim"
name = "Terraphim"
version = "0.2.0"
version = "0.2.1"
schema_version = 1
authors = ["Terraphim Team <team@terraphim.ai>"]
description = "Terraphim knowledge-graph hover, synonym code actions, Lab marks and faded ghost text for Markdown, via terraphim-lsp."
Expand Down
8 changes: 5 additions & 3 deletions scripts/test_catalog_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ def test_dependency_drift_is_refused(self):
def test_manifest_version_mismatch_is_refused(self):
root = self.fixture()
path = root / catalog_package.PATH / "extension.toml"
path.write_text(
path.read_text().replace('version = "0.2.0"', 'version = "0.3.0"')
)
original = path.read_text()
version = tomllib.loads(original)["version"]
changed = original.replace(f'version = "{version}"', f'version = "{version}-mismatch"')
self.assertNotEqual(original, changed)
path.write_text(changed)
with self.assertRaisesRegex(marketplace.GateError, "versions"):
catalog_package.validate_source(root)

Expand Down
14 changes: 7 additions & 7 deletions scripts/test_catalog_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def test_catalog_archive_is_distinct_and_bound_to_nested_source(self):
report = fixture.qualify()
self.assertEqual(report["extensionId"], "terraphim-lsp")
self.assertEqual(report["extensionPath"], CATALOG)
self.assertEqual(report["archive"]["name"], "terraphim-lsp-0.2.0.tar.gz")
self.assertEqual(report["archive"]["name"], f"terraphim-lsp-{fixture.version}.tar.gz")
fixture.verify()
second = package.package(fixture.root, fixture.wasm, fixture.base / "again",
fixture.tag, extension_path=CATALOG)
self.assertEqual(second.tarball.read_bytes(), fixture.packaged.tarball.read_bytes())
members = package_qualification.inspect_archive(
second.tarball.read_bytes(), "0.2.0", extension_path=CATALOG)
second.tarball.read_bytes(), fixture.version, extension_path=CATALOG)
for name in package.FILES:
self.assertEqual(members[name], (fixture.root / CATALOG / name).read_bytes())
self.assertNotIn("build-receipt.json", members)
Expand All @@ -53,12 +53,12 @@ def test_catalog_stage_archives_actual_checked_module_and_keeps_receipt_separate
fixture = Fixture(self, extension_path=CATALOG)
wasm = package.ROOT / CATALOG / "target/wasm32-wasip2/release/zed_terraphim_lsp.wasm"
output = fixture.base / "catalog-stage"
result = catalog_package.release(package.ROOT, wasm, output, "v0.2.0")
result = catalog_package.release(package.ROOT, wasm, output, fixture.tag)
staged = json.loads((output / "catalog-build-receipt.json").read_bytes())
self.assertEqual(staged["extensionId"], "terraphim-lsp")
self.assertIs(staged["nativeQualified"], False)
members = package_qualification.inspect_archive(result.tarball.read_bytes(),
"0.2.0", CATALOG)
fixture.version, CATALOG)
self.assertEqual(members["extension.wasm"], wasm.read_bytes())
self.assertEqual(set(members), {*package.FILES, "extension.wasm"})
self.assertEqual(staged["files"]["extension.wasm"],
Expand Down Expand Up @@ -163,11 +163,11 @@ def test_native_receipt_checks_source_variant_server_and_required_outputs(self):
changed = {**original, key: value}
with self.subTest(key=key, value=value), self.assertRaises(marketplace.GateError):
marketplace.validate_native_qualification(json.dumps(changed).encode(),
fixture.source, {"version": "0.2.0"}, fixture.proof["publicLsp"], fixture.proof["assets"])
fixture.source, {"version": fixture.version}, fixture.proof["publicLsp"], fixture.proof["assets"])
for malformed in [b"[]", b"null", b"{}"]:
with self.subTest(malformed=malformed), self.assertRaises(marketplace.GateError):
marketplace.validate_native_qualification(malformed, fixture.source,
{"version": "0.2.0"}, fixture.proof["publicLsp"], fixture.proof["assets"])
{"version": fixture.version}, fixture.proof["publicLsp"], fixture.proof["assets"])

def test_native_receipt_bytes_are_frozen_separately_from_ci_module(self):
fixture = Fixture(self, extension_path=CATALOG)
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_catalog_snapshot_freezes_exact_qualified_bytes(self):
with publish_github.qualified_snapshot(fixture.artifacts, fixture.tag,
fixture.source, fixture.root, extension_path=CATALOG) as (_, files):
fixture.packaged.tarball.write_bytes(b"other")
self.assertEqual(files[0].name, "terraphim-lsp-0.2.0.tar.gz")
self.assertEqual(files[0].name, f"terraphim-lsp-{fixture.version}.tar.gz")
self.assertEqual(files[0].read_bytes(), original)


Expand Down
22 changes: 13 additions & 9 deletions scripts/test_package_qualification.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import publish_github


VERSION = package.read_version((package.ROOT / "extension.toml").read_text())


class Fixture:
def __init__(self, case, tag="v0.2.0", extension_path=""):
def __init__(self, case, tag=None, extension_path=""):
temporary = tempfile.TemporaryDirectory()
case.addCleanup(temporary.cleanup)
self.base = Path(temporary.name)
Expand All @@ -38,13 +41,14 @@ def __init__(self, case, tag="v0.2.0", extension_path=""):
self.git("add", ".")
self.commit("fixture baseline")
self.source = self.git("rev-parse", "HEAD")
self.tag = tag
self.version = package.read_version((self.root / extension_path / "extension.toml").read_text())
self.tag = tag or f"v{self.version}"
self.git("tag", self.tag)
self.artifacts = self.base / "artifacts"
(self.artifacts / "public-preflight").mkdir(parents=True)
self.proof = {
"status": "PASS", "source": self.source, "tag": self.tag,
"version": "0.2.0", "extensionId": "terraphim-lsp" if extension_path else "terraphim",
"version": self.version, "extensionId": "terraphim-lsp" if extension_path else "terraphim",
"extensionPath": extension_path, "catalog": bool(extension_path),
"repository": "example/zed-terraphim",
}
Expand All @@ -53,7 +57,7 @@ def __init__(self, case, tag="v0.2.0", extension_path=""):
native = {
"schema": 1, "status": "PASS", "scope": "stock-zed-source",
"qualifiedCommit": self.source, "extensionId": "terraphim-lsp",
"extensionPath": extension_path, "version": "0.2.0",
"extensionPath": extension_path, "version": self.version,
"sourceInstallWasm": {"sha256": "1" * 64, "bytes": 562871},
"server": {"releaseTag": "terraphim_lsp-v1.22.0-rc.7",
"sha256": "2" * 64, "bytes": 13000000},
Expand All @@ -68,7 +72,7 @@ def __init__(self, case, tag="v0.2.0", extension_path=""):
self.proof["assets"] = [{"sha256": native["server"]["sha256"], "bytes": native["server"]["bytes"]}]
self.proof["nativeQualification"] = marketplace.native_evidence_record(
self.native_data, self.proof["qualificationUrl"], self.proof["repository"],
self.source, {"version": "0.2.0"}, self.proof["publicLsp"], self.proof["assets"])
self.source, {"version": self.version}, self.proof["publicLsp"], self.proof["assets"])
self.preflight = self.artifacts / "public-preflight/preflight.json"
self.preflight.write_text(json.dumps(self.proof))
self.wasm = self.base / "ci-built.wasm"
Expand Down Expand Up @@ -101,15 +105,15 @@ def refresh_checksum(self):
self.packaged.sums.write_text(f"{digest} {self.packaged.tarball.name}\n")

def repack(self, name, data):
staged = self.packaged.tarball.parent / "terraphim-zed-0.2.0"
staged = self.packaged.tarball.parent / f"terraphim-zed-{self.version}"
(staged / name).write_bytes(data)
package.write_tarball(staged, self.packaged.tarball)
self.refresh_checksum()


class PackageQualification(unittest.TestCase):
def test_exact_ci_wasm_source_and_both_tags_are_bound(self):
for tag in ["v0.2.0", "v0.2.0-rc.1"]:
for tag in [f"v{VERSION}", f"v{VERSION}-rc.1"]:
with self.subTest(tag=tag):
fixture = Fixture(self, tag)
result = fixture.qualify()
Expand Down Expand Up @@ -184,8 +188,8 @@ def test_head_and_local_tag_must_still_match_receipt(self):
fixture.verify()

def test_preflight_identity_and_exact_bytes_must_match(self):
for key, value in [("source", "a" * 40), ("tag", "v0.2.0-rc.1"),
("version", "0.2.1"), ("extensionId", "another-id")]:
for key, value in [("source", "a" * 40), ("tag", f"v{VERSION}-rc.1"),
("version", f"{VERSION}-rc.1"), ("extensionId", "another-id")]:
with self.subTest(key=key):
fixture = Fixture(self)
fixture.qualify()
Expand Down
Loading