@bitfab/sdk 0.69.0 → 0.70.0
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.
- package/cloudReplay.py +49 -27
- package/dist/{http-C9icRaA3.cjs → http-C6NC-zwf.cjs} +2 -2
- package/dist/{http-C9icRaA3.cjs.map → http-C6NC-zwf.cjs.map} +1 -1
- package/dist/{http-CzKW7TgN.js → http-DcEhqOUu.js} +2 -2
- package/dist/{http-CzKW7TgN.js.map → http-DcEhqOUu.js.map} +1 -1
- package/dist/{index-D7y_bwZC.d.cts → index-C9WPpeEU.d.cts} +30 -16
- package/dist/{index-D7y_bwZC.d.ts → index-C9WPpeEU.d.ts} +30 -16
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{registryCommand-CWxt6kPp.js → registryCommand-jPTSRgL9.js} +39 -16
- package/dist/registryCommand-jPTSRgL9.js.map +1 -0
- package/dist/replayCli.js +2 -2
- package/dist/replayCli.js.map +1 -1
- package/dist/seedCli.js +1 -1
- package/dist/{src-4VpSvoAt.cjs → src-Cwzg-mER.cjs} +69 -43
- package/dist/src-Cwzg-mER.cjs.map +1 -0
- package/dist/{src-Cn--d1sW.js → src-D-21-G6z.js} +69 -43
- package/dist/src-D-21-G6z.js.map +1 -0
- package/package.json +1 -1
- package/dist/registryCommand-CWxt6kPp.js.map +0 -1
- package/dist/src-4VpSvoAt.cjs.map +0 -1
- package/dist/src-Cn--d1sW.js.map +0 -1
package/cloudReplay.py
CHANGED
|
@@ -147,8 +147,9 @@ RENAMED_FLAGS = {
|
|
|
147
147
|
"--cloud-include": "nothing: new files that git does not ignore are already in the snapshot",
|
|
148
148
|
}
|
|
149
149
|
SEED_FLAGS = ("--seed", "--cases", "--from-trace", "--run")
|
|
150
|
-
PATH_FLAGS = ("--registry", "--params", "--code-change")
|
|
151
|
-
|
|
150
|
+
PATH_FLAGS = ("--registry", "--params", "--code-change-file")
|
|
151
|
+
CODE_CHANGE_FLAG = "--code-change"
|
|
152
|
+
BRANCH_CODE_CHANGES = ("last-branch", "default-branch")
|
|
152
153
|
CHECKOUT_DEPTH = 2
|
|
153
154
|
CODE_CHANGE_PATH_ENV = "BITFAB_CODE_CHANGE_PATH"
|
|
154
155
|
CODE_CHANGE_MAX_FILES = 60
|
|
@@ -1022,6 +1023,21 @@ def branch_point(root):
|
|
|
1022
1023
|
return None
|
|
1023
1024
|
|
|
1024
1025
|
|
|
1026
|
+
def default_branch_point(root):
|
|
1027
|
+
default = default_branch(root)
|
|
1028
|
+
sha = quiet_git(root, "merge-base", "HEAD", default) if default else ""
|
|
1029
|
+
return {"sha": sha, "ref": default} if sha else None
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
def code_change_base(root, replay):
|
|
1033
|
+
kind = flag_value(replay, CODE_CHANGE_FLAG)
|
|
1034
|
+
if kind == "last-branch":
|
|
1035
|
+
return branch_point(root)
|
|
1036
|
+
if kind == "default-branch":
|
|
1037
|
+
return default_branch_point(root)
|
|
1038
|
+
return None
|
|
1039
|
+
|
|
1040
|
+
|
|
1025
1041
|
def replay_artifact(path):
|
|
1026
1042
|
return path == ".bitfab" or path.startswith(".bitfab/")
|
|
1027
1043
|
|
|
@@ -1126,11 +1142,10 @@ def snapshot(
|
|
|
1126
1142
|
}
|
|
1127
1143
|
if preview:
|
|
1128
1144
|
return summary
|
|
1129
|
-
|
|
1145
|
+
branch_base = str((request.get("codeChangeBase") or {}).get("sha", ""))
|
|
1130
1146
|
extra_parent = (
|
|
1131
|
-
["-p",
|
|
1132
|
-
if
|
|
1133
|
-
and SHA.fullmatch(str(code_change_base.get("sha", "")))
|
|
1147
|
+
["-p", branch_base]
|
|
1148
|
+
if SHA.fullmatch(branch_base) and branch_base != head
|
|
1134
1149
|
else []
|
|
1135
1150
|
)
|
|
1136
1151
|
sha = git(
|
|
@@ -1461,9 +1476,9 @@ def submit(root, repo, workflow, parsed, path):
|
|
|
1461
1476
|
branch = current_branch(root)
|
|
1462
1477
|
if branch:
|
|
1463
1478
|
request["branch"] = branch
|
|
1464
|
-
|
|
1465
|
-
if
|
|
1466
|
-
request["codeChangeBase"] =
|
|
1479
|
+
base = code_change_base(root, parsed["replay"])
|
|
1480
|
+
if base:
|
|
1481
|
+
request["codeChangeBase"] = base
|
|
1467
1482
|
check_arguments(parsed["replay"])
|
|
1468
1483
|
allowed = allowed_files(root, parsed)
|
|
1469
1484
|
if "--cloud-preview" in parsed["switches"]:
|
|
@@ -2121,15 +2136,19 @@ def check_out_snapshot_base(root, commit, branch):
|
|
|
2121
2136
|
return base
|
|
2122
2137
|
|
|
2123
2138
|
|
|
2124
|
-
def
|
|
2139
|
+
def flag_value(args, flag):
|
|
2125
2140
|
for index, value in enumerate(args):
|
|
2126
|
-
if value.startswith("
|
|
2141
|
+
if value.startswith(f"{flag}="):
|
|
2127
2142
|
return value.partition("=")[2]
|
|
2128
|
-
if value ==
|
|
2143
|
+
if value == flag and index + 1 < len(args):
|
|
2129
2144
|
return args[index + 1]
|
|
2130
2145
|
return None
|
|
2131
2146
|
|
|
2132
2147
|
|
|
2148
|
+
def replay_name(args):
|
|
2149
|
+
return flag_value(args, "--name")
|
|
2150
|
+
|
|
2151
|
+
|
|
2133
2152
|
def git_blob(root, ref, path):
|
|
2134
2153
|
try:
|
|
2135
2154
|
size = int(git(root, "cat-file", "-s", f"{ref}:{path}"))
|
|
@@ -2209,7 +2228,10 @@ def branch_code_change(root, base, commit, request):
|
|
|
2209
2228
|
and SHA.fullmatch(sha)
|
|
2210
2229
|
and isinstance(ref, str)
|
|
2211
2230
|
and BRANCH_NAME.fullmatch(ref)
|
|
2212
|
-
and
|
|
2231
|
+
and (
|
|
2232
|
+
sha == base
|
|
2233
|
+
or quiet_git(root, "rev-parse", "--verify", "-q", f"{commit}^2") == sha
|
|
2234
|
+
)
|
|
2213
2235
|
):
|
|
2214
2236
|
return None
|
|
2215
2237
|
return snapshot_code_change(
|
|
@@ -2217,6 +2239,17 @@ def branch_code_change(root, base, commit, request):
|
|
|
2217
2239
|
)
|
|
2218
2240
|
|
|
2219
2241
|
|
|
2242
|
+
def runner_code_change(root, base, commit, request):
|
|
2243
|
+
kind = flag_value(request["args"], CODE_CHANGE_FLAG)
|
|
2244
|
+
if kind == "working-tree":
|
|
2245
|
+
change = snapshot_code_change(root, base, commit, replay_name(request["args"]))
|
|
2246
|
+
elif kind in BRANCH_CODE_CHANGES:
|
|
2247
|
+
change = branch_code_change(root, base, commit, request)
|
|
2248
|
+
else:
|
|
2249
|
+
return None
|
|
2250
|
+
return change or {"files": []}
|
|
2251
|
+
|
|
2252
|
+
|
|
2220
2253
|
def write_code_change(change):
|
|
2221
2254
|
handle, path = tempfile.mkstemp(
|
|
2222
2255
|
prefix="bitfab-code-change-",
|
|
@@ -2247,22 +2280,11 @@ def execute():
|
|
|
2247
2280
|
if environment:
|
|
2248
2281
|
workflow_environment_conflicts(root, environment)
|
|
2249
2282
|
print(f"Setting {', '.join(sorted(environment))} from the request", flush=True)
|
|
2250
|
-
|
|
2251
|
-
explicit_change = bool(names & set(CODE_CHANGE_FLAGS))
|
|
2252
|
-
change = (
|
|
2253
|
-
None
|
|
2254
|
-
if explicit_change or base is None
|
|
2255
|
-
else snapshot_code_change(root, base, commit, replay_name(request["args"]))
|
|
2256
|
-
or branch_code_change(root, base, commit, request)
|
|
2257
|
-
)
|
|
2283
|
+
change = None if base is None else runner_code_change(root, base, commit, request)
|
|
2258
2284
|
run_environment = dict(environment)
|
|
2259
|
-
if change:
|
|
2285
|
+
if change is not None:
|
|
2260
2286
|
run_environment[CODE_CHANGE_PATH_ENV] = write_code_change(change)
|
|
2261
|
-
args = [
|
|
2262
|
-
*replay_command(),
|
|
2263
|
-
*request["args"],
|
|
2264
|
-
*([] if explicit_change or change else ["--no-code-change"]),
|
|
2265
|
-
]
|
|
2287
|
+
args = [*replay_command(), *request["args"]]
|
|
2266
2288
|
if dry_run(request["args"]):
|
|
2267
2289
|
run_check_command(directory, environment)
|
|
2268
2290
|
experiment = {}
|
|
@@ -5,7 +5,7 @@ let _opentelemetry_core = require("@opentelemetry/core");
|
|
|
5
5
|
let _opentelemetry_resources = require("@opentelemetry/resources");
|
|
6
6
|
let _opentelemetry_sdk_trace = require("@opentelemetry/sdk-trace");
|
|
7
7
|
//#region src/version.generated.ts
|
|
8
|
-
const __version__ = "0.
|
|
8
|
+
const __version__ = "0.70.0";
|
|
9
9
|
const __packageName__ = "@bitfab/sdk";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/traceCompletion.ts
|
|
@@ -2318,4 +2318,4 @@ Object.defineProperty(exports, "unrefTimer", {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
});
|
|
2320
2320
|
|
|
2321
|
-
//# sourceMappingURL=http-
|
|
2321
|
+
//# sourceMappingURL=http-C6NC-zwf.cjs.map
|