Skip to content

Commit 50b064b

Browse files
Natoandrodestifocoderabbitai[bot]
authored
feat: Artifact removal (#668)
- Add GC: remove artifacts when unreferenced by any deployed typegraph - Improve resource management: use `AsyncDisposable` and `AsyncDisposableStack` - Improve testability (for parallel testing): always read the tmpDir config from the `Typegate` object #### Motivation and context [MET-433](https://linear.app/metatypedev/issue/MET-433/file-removal) #### Migration notes _N/A_ ### Checklist - [x] The change come with new or modified tests - [x] Hard-to-understand functions have explanatory comments - [x] End-user documentation is updated to reflect the change <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced search functionality with the addition of a new search bar. - Introduced new test configurations to improve script execution. - Updated artifact storage documentation to clarify management processes. - Added new extensions to support improved code commenting. - **Bug Fixes** - Removed outdated Deno import mapping settings to streamline development environment setup. - **Documentation** - Expanded documentation on artifact tracking and management, including reference counting and garbage collection mechanisms. - **Refactor** - Implemented interface changes in `QueryEngine` for better async disposal management. - Code restructuring in artifact management for enhanced performance and maintainability. - **Chores** - Adjusted settings and configurations in the development environment to align with current best practices. - **Tests** - Introduced new test cases for artifact upload and management functionalities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Natoandro <[email protected]> Co-authored-by: destifo <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 0cdd241 commit 50b064b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1896
-846
lines changed

.ghjk/deno.lock

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.ghjk/lock.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@
563563
"env": {},
564564
"allowedPortDeps": []
565565
}
566+
},
567+
"test": {
568+
"name": "test",
569+
"dependsOn": [],
570+
"env": {
571+
"installs": [],
572+
"env": {},
573+
"allowedPortDeps": []
574+
}
566575
}
567576
}
568577
}

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"chrischinchilla.vale-vscode",
1414
"hediet.vscode-drawio",
1515
"davidlday.languagetool-linter",
16-
"dtsvet.vscode-wasm"
16+
"dtsvet.vscode-wasm",
17+
"bierner.comment-tagged-templates"
1718
]
1819
}

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"website/.docusaurus": true,
55
"website/node_modules": true
66
},
7-
"deno.importMap": "typegate/import_map.json",
87
"deno.enablePaths": [
98
"typegate",
109
"dev",

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/workflows/artifact_upload_protocol.drawio.svg

Lines changed: 78 additions & 78 deletions
Loading

ghjk.ts

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const allowedPortDeps = [
4343
defaultInst: thinInstallConfig(fat),
4444
})),
4545
];
46-
export const secureConfig = ghjk.secureConfig({ allowedPortDeps });
4746

4847
const inCi = () => !!Deno.env.get("CI");
4948
const inOci = () => !!Deno.env.get("OCI");
@@ -63,7 +62,7 @@ ghjk.install(
6362
crateName: "wasm-tools",
6463
version: WASM_TOOLS_VERSION,
6564
locked: true,
66-
}),
65+
})
6766
);
6867

6968
if (!inOci()) {
@@ -81,7 +80,7 @@ if (!inOci()) {
8180
packageName: "@bytecodealliance/jco",
8281
version: JCO_VERSION,
8382
})[0],
84-
ports.npmi({ packageName: "node-gyp", version: "10.0.1" })[0],
83+
ports.npmi({ packageName: "node-gyp", version: "10.0.1" })[0]
8584
);
8685
}
8786

@@ -90,7 +89,7 @@ if (Deno.build.os == "linux" && !Deno.env.has("NO_MOLD")) {
9089
ports.mold({
9190
version: MOLD_VERSION,
9291
replaceLd: Deno.env.has("CI") || Deno.env.has("OCI"),
93-
}),
92+
})
9493
);
9594
}
9695

@@ -100,20 +99,18 @@ if (!Deno.env.has("NO_PYTHON")) {
10099
ports.pipi({
101100
packageName: "poetry",
102101
version: POETRY_VERSION,
103-
})[0],
102+
})[0]
104103
);
105104
if (!inOci()) {
106-
ghjk.install(
107-
ports.pipi({ packageName: "pre-commit" })[0],
108-
);
105+
ghjk.install(ports.pipi({ packageName: "pre-commit" })[0]);
109106
}
110107
}
111108

112109
if (inDev()) {
113110
ghjk.install(
114111
ports.act({}),
115112
ports.cargobi({ crateName: "whiz", locked: true }),
116-
installs.comp_py[0],
113+
installs.comp_py[0]
117114
);
118115
}
119116

@@ -122,13 +119,12 @@ ghjk.task("clean-deno-lock", {
122119
// jq
123120
],
124121
async fn({ $ }) {
125-
const jqOp1 =
126-
`del(.packages.specifiers["npm:@typegraph/sdk@${METATYPE_VERSION}"])`;
122+
const jqOp1 = `del(.packages.specifiers["npm:@typegraph/sdk@${METATYPE_VERSION}"])`;
127123
const jqOp2 = `del(.packages.npm["@typegraph/sdk@${METATYPE_VERSION}"])`;
128124
const jqOp = `${jqOp1} | ${jqOp2}`;
129125
await Deno.writeTextFile(
130126
"typegate/deno.lock",
131-
await $`jq ${jqOp} typegate/deno.lock`.text(),
127+
await $`jq ${jqOp} typegate/deno.lock`.text()
132128
);
133129
},
134130
});
@@ -138,8 +134,9 @@ ghjk.task("gen-pyrt-bind", {
138134
allowedPortDeps,
139135
async fn({ $ }) {
140136
await $.removeIfExists("./libs/pyrt_wit_wire/wit_wire");
141-
await $`componentize-py -d ../../wit/wit-wire.wit bindings .`
142-
.cwd("./libs/pyrt_wit_wire");
137+
await $`componentize-py -d ../../wit/wit-wire.wit bindings .`.cwd(
138+
"./libs/pyrt_wit_wire"
139+
);
143140
},
144141
});
145142

@@ -172,3 +169,20 @@ ghjk.task("dev", {
172169
await $`deno run --allow-all ${script} ${args}`;
173170
},
174171
});
172+
173+
ghjk.task("test", {
174+
async fn({ $, argv }) {
175+
const script = $.path(projectDir).join("dev/test.ts");
176+
await $`deno run --allow-all ${script} ${argv}`;
177+
},
178+
});
179+
180+
export const secureConfig = ghjk.secureConfig({
181+
allowedPortDeps: [
182+
...ghjk.stdDeps(),
183+
...[installs.python_latest, installs.node].map((fat) => ({
184+
manifest: fat.port,
185+
defaultInst: thinInstallConfig(fat),
186+
})),
187+
],
188+
});

meta-cli/src/cli/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ pub struct NodeArgs {
9696
#[clap(short, long, value_parser = UrlValueParser::new().http())]
9797
pub gate: Option<Url>,
9898

99+
#[clap(short, long)]
100+
pub prefix: Option<String>,
101+
99102
/// Username to use to connect to the typegate (basic auth).
100103
#[clap(long)]
101104
pub username: Option<String>,

meta-cli/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ impl NodeConfig {
8080
if let Some(gate) = &args.gate {
8181
res.url = gate.clone();
8282
}
83+
if let Some(prefix) = &args.prefix {
84+
res.prefix = Some(prefix.clone());
85+
}
8386
res.username = args.username.clone().or(res.username);
8487
res.password = args.password.clone().or(res.password);
8588
res

0 commit comments

Comments
 (0)