feat: project repository keys across public clients
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
|
||||
const summary = {
|
||||
working_directory_id: "workdir-1",
|
||||
repository_id: "main",
|
||||
repository_key: "main",
|
||||
materializer_kind: "runtime_git_cache",
|
||||
status: "active",
|
||||
occupied_by: {
|
||||
@@ -60,7 +60,7 @@ Deno.test("Workdir REST validation rejects stale response JSON", () => {
|
||||
Deno.test("Workdir REST validation enforces create operation fields", () => {
|
||||
const request = validateWorkingDirectoryCreateRequest({
|
||||
runtime_id: "arcadia",
|
||||
repository_id: "main",
|
||||
repository_key: "main",
|
||||
selector: "develop",
|
||||
operation_id: "operation-1",
|
||||
});
|
||||
@@ -71,7 +71,7 @@ Deno.test("Workdir REST validation enforces create operation fields", () => {
|
||||
for (
|
||||
const invalid of [
|
||||
{ runtime_id: "arcadia", operation_id: "operation-1" },
|
||||
{ repository_id: "main", operation_key: "operation-1" },
|
||||
{ repository_key: "main", operation_key: "operation-1" },
|
||||
]
|
||||
) {
|
||||
let rejected = false;
|
||||
|
||||
@@ -58,8 +58,7 @@ Deno.test("workspace catalog enriches each visible workspace without dropping si
|
||||
return Promise.resolve(Response.json({
|
||||
workspace_id: "w-a",
|
||||
items: [{
|
||||
id: "main",
|
||||
display_name: "Main",
|
||||
repository_key: "main",
|
||||
kind: "git",
|
||||
provider: "git",
|
||||
source: { kind: "local_path", uri: "/srv/alpha" },
|
||||
@@ -78,7 +77,7 @@ Deno.test("workspace catalog enriches each visible workspace without dropping si
|
||||
|
||||
const items = await loadWorkspaceCatalog(fetcher as typeof fetch);
|
||||
assertEquals(items.length, 2);
|
||||
assertEquals(items[0].repositories[0].id, "main");
|
||||
assertEquals(items[0].repositories[0].repository_key, "main");
|
||||
assertEquals(items[1].repositories, []);
|
||||
assertEquals(typeof items[1].repository_error, "string");
|
||||
});
|
||||
@@ -89,8 +88,8 @@ Deno.test("workspace creation preserves caller-owned operation key across retry"
|
||||
operation_key: "web-create-1",
|
||||
display_name: "Alpha",
|
||||
repository: {
|
||||
repository_key: "main",
|
||||
uri: "/srv/alpha",
|
||||
display_name: "Main",
|
||||
default_ref: "develop",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -22,8 +22,7 @@ function assertThrows(operation: () => unknown, expected: string): void {
|
||||
const repositoryList = {
|
||||
workspace_id: "w-a",
|
||||
items: [{
|
||||
id: "main",
|
||||
display_name: "Main",
|
||||
repository_key: "main",
|
||||
kind: "git",
|
||||
provider: "git",
|
||||
source: { kind: "local_path", uri: "/srv/alpha" },
|
||||
@@ -38,8 +37,8 @@ const repositoryList = {
|
||||
|
||||
Deno.test("generated repository wrapper validates current Backend JSON", () => {
|
||||
const parsed = parseRepositoryListResponse(repositoryList);
|
||||
if (parsed.items[0]?.id !== "main") {
|
||||
throw new Error("repository id was not preserved");
|
||||
if (parsed.items[0]?.repository_key !== "main") {
|
||||
throw new Error("repository key was not preserved");
|
||||
}
|
||||
if (parsed.items[0]?.source.kind !== "local_path") {
|
||||
throw new Error("repository source kind was not preserved");
|
||||
@@ -49,11 +48,11 @@ Deno.test("generated repository wrapper validates current Backend JSON", () => {
|
||||
Deno.test("stale repository aliases fail closed at the JSON boundary", () => {
|
||||
const stale = structuredClone(repositoryList) as Record<string, unknown>;
|
||||
const items = stale.items as Array<Record<string, unknown>>;
|
||||
items[0].repository_id = items[0].id;
|
||||
delete items[0].id;
|
||||
items[0].id = items[0].repository_key;
|
||||
delete items[0].repository_key;
|
||||
assertThrows(
|
||||
() => parseRepositoryListResponse(stale),
|
||||
".repository_id is not part",
|
||||
".id is not part",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -129,7 +128,7 @@ Deno.test("Repository settings consume the validated shared wire shape", async (
|
||||
for (
|
||||
const token of [
|
||||
"parseRepositoryListResponse",
|
||||
"repository.id",
|
||||
"repository.repository_key",
|
||||
"repository.observed_status",
|
||||
"sourceLabel(repository.source.kind)",
|
||||
"supportsRepositoryAccess(repository.source.kind)",
|
||||
@@ -141,8 +140,8 @@ Deno.test("Repository settings consume the validated shared wire shape", async (
|
||||
}
|
||||
for (
|
||||
const staleToken of [
|
||||
"repository.repository_id",
|
||||
"repository.observed.status",
|
||||
"repository.id",
|
||||
"repository.display_name",
|
||||
"repository.source.kind === 'remote_git'",
|
||||
]
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user