@bitfab/sdk 0.70.0 → 0.72.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 +32 -3
- package/dist/{http-DcEhqOUu.js → http-7rcRBbK-.js} +4 -3
- package/dist/http-7rcRBbK-.js.map +1 -0
- package/dist/{http-C6NC-zwf.cjs → http-C07Y93Ss.cjs} +4 -3
- package/dist/http-C07Y93Ss.cjs.map +1 -0
- package/dist/{index-C9WPpeEU.d.cts → index-DaZqdSDK.d.cts} +22 -8
- package/dist/{index-C9WPpeEU.d.ts → index-DaZqdSDK.d.ts} +22 -8
- 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-jPTSRgL9.js → registryCommand-BQcyBmhN.js} +12 -4
- package/dist/registryCommand-BQcyBmhN.js.map +1 -0
- package/dist/replayCli.js +1 -1
- package/dist/seedCli.js +1 -1
- package/dist/{src-D-21-G6z.js → src-B9m0zAy1.js} +36 -15
- package/dist/src-B9m0zAy1.js.map +1 -0
- package/dist/{src-Cwzg-mER.cjs → src-DRC6OVjp.cjs} +36 -15
- package/dist/src-DRC6OVjp.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/http-C6NC-zwf.cjs.map +0 -1
- package/dist/http-DcEhqOUu.js.map +0 -1
- package/dist/registryCommand-jPTSRgL9.js.map +0 -1
- package/dist/src-Cwzg-mER.cjs.map +0 -1
- package/dist/src-D-21-G6z.js.map +0 -1
package/cloudReplay.py
CHANGED
|
@@ -149,7 +149,10 @@ RENAMED_FLAGS = {
|
|
|
149
149
|
SEED_FLAGS = ("--seed", "--cases", "--from-trace", "--run")
|
|
150
150
|
PATH_FLAGS = ("--registry", "--params", "--code-change-file")
|
|
151
151
|
CODE_CHANGE_FLAG = "--code-change"
|
|
152
|
-
|
|
152
|
+
CODE_CHANGE_BASE_FLAG = "--code-change-base"
|
|
153
|
+
BRANCH_CODE_CHANGES = ("last-branch", "default-branch", "ref")
|
|
154
|
+
GIT_CODE_CHANGES = ("working-tree", *BRANCH_CODE_CHANGES)
|
|
155
|
+
DESCRIBED_REF = re.compile(r"[^\x00-\x1f\x7f]{1,200}")
|
|
153
156
|
CHECKOUT_DEPTH = 2
|
|
154
157
|
CODE_CHANGE_PATH_ENV = "BITFAB_CODE_CHANGE_PATH"
|
|
155
158
|
CODE_CHANGE_MAX_FILES = 60
|
|
@@ -220,7 +223,9 @@ Options added by --cloud:
|
|
|
220
223
|
checkout of the repository, with GitHub access that can
|
|
221
224
|
read it and run Actions (a job token needs contents: read
|
|
222
225
|
and actions: write, passed as GH_TOKEN), and a workflow on
|
|
223
|
-
BRANCH that declares a request input.
|
|
226
|
+
BRANCH that declares a request input. With no snapshot
|
|
227
|
+
there is nothing to diff against, so it takes
|
|
228
|
+
--code-change skip or manual, as does a dispatched run.
|
|
224
229
|
|
|
225
230
|
A workflow can also dispatch bitfab-replay.yml itself on any branch other than a
|
|
226
231
|
bitfab-replay/ snapshot branch, passing the replay as JSON in the request input:
|
|
@@ -1029,8 +1034,30 @@ def default_branch_point(root):
|
|
|
1029
1034
|
return {"sha": sha, "ref": default} if sha else None
|
|
1030
1035
|
|
|
1031
1036
|
|
|
1037
|
+
def chosen_base_point(root, chosen):
|
|
1038
|
+
if not chosen or chosen.startswith("-"):
|
|
1039
|
+
return None
|
|
1040
|
+
for ref in (chosen, f"origin/{chosen}"):
|
|
1041
|
+
if quiet_git(root, "rev-parse", "--verify", "-q", f"{ref}^{{commit}}"):
|
|
1042
|
+
sha = quiet_git(root, "merge-base", "HEAD", ref)
|
|
1043
|
+
return {"sha": sha, "ref": chosen} if sha else None
|
|
1044
|
+
raise ValueError(
|
|
1045
|
+
f"{CODE_CHANGE_BASE_FLAG} {chosen} names no branch or commit in this repository; pass a branch name or a commit SHA, and fetch it first if it only exists on the remote"
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
def refuse_git_code_change(replay, where):
|
|
1050
|
+
kind = flag_value(replay, CODE_CHANGE_FLAG)
|
|
1051
|
+
if kind in GIT_CODE_CHANGES:
|
|
1052
|
+
raise ValueError(
|
|
1053
|
+
f"{where} as it is on GitHub, with no snapshot of a checkout, so --code-change {kind} has nothing to compare against there; pass --code-change skip, or --code-change manual with --code-change-file, or start it with bitfab-replay --cloud and no --cloud-ref, which resolves {kind} from your checkout before upload"
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1056
|
+
|
|
1032
1057
|
def code_change_base(root, replay):
|
|
1033
1058
|
kind = flag_value(replay, CODE_CHANGE_FLAG)
|
|
1059
|
+
if kind == "ref":
|
|
1060
|
+
return chosen_base_point(root, flag_value(replay, CODE_CHANGE_BASE_FLAG))
|
|
1034
1061
|
if kind == "last-branch":
|
|
1035
1062
|
return branch_point(root)
|
|
1036
1063
|
if kind == "default-branch":
|
|
@@ -1839,6 +1866,7 @@ def submit_as_is(root, repo, workflow, parsed, path):
|
|
|
1839
1866
|
branch = parsed["cloud"]["--cloud-ref"]
|
|
1840
1867
|
request, _ = replay_request(root, parsed)
|
|
1841
1868
|
check_arguments(parsed["replay"])
|
|
1869
|
+
refuse_git_code_change(parsed["replay"], f"--cloud-ref replays {branch}")
|
|
1842
1870
|
sha = branch_head(repo, branch)
|
|
1843
1871
|
if "--cloud-preview" in parsed["switches"]:
|
|
1844
1872
|
return {
|
|
@@ -2089,6 +2117,7 @@ def dispatched_request():
|
|
|
2089
2117
|
raise ValueError("The request id does not match the execution_id input")
|
|
2090
2118
|
args = request.get("args")
|
|
2091
2119
|
validate_arguments(args)
|
|
2120
|
+
refuse_git_code_change(args, f"A dispatched replay runs {branch}")
|
|
2092
2121
|
if request.get("check") is True and "--dry-run" not in args:
|
|
2093
2122
|
args = [*args, "--dry-run"]
|
|
2094
2123
|
normalized = {
|
|
@@ -2227,7 +2256,7 @@ def branch_code_change(root, base, commit, request):
|
|
|
2227
2256
|
isinstance(sha, str)
|
|
2228
2257
|
and SHA.fullmatch(sha)
|
|
2229
2258
|
and isinstance(ref, str)
|
|
2230
|
-
and
|
|
2259
|
+
and DESCRIBED_REF.fullmatch(ref)
|
|
2231
2260
|
and (
|
|
2232
2261
|
sha == base
|
|
2233
2262
|
or quiet_git(root, "rev-parse", "--verify", "-q", f"{commit}^2") == sha
|
|
@@ -5,7 +5,7 @@ import { ExportResultCode } from "@opentelemetry/core";
|
|
|
5
5
|
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
6
6
|
import { AlwaysOnSampler, BatchSpanProcessor, TracerProvider } from "@opentelemetry/sdk-trace";
|
|
7
7
|
//#region src/version.generated.ts
|
|
8
|
-
const __version__ = "0.
|
|
8
|
+
const __version__ = "0.72.0";
|
|
9
9
|
const __packageName__ = "@bitfab/sdk";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/traceCompletion.ts
|
|
@@ -1983,7 +1983,7 @@ var HttpClient = class {
|
|
|
1983
1983
|
const endpoint = `/api/sdk/traces/${encodeURIComponent(traceId)}`;
|
|
1984
1984
|
await this.request(endpoint, payload, { method: "PATCH" });
|
|
1985
1985
|
}
|
|
1986
|
-
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata, dryRun, experimentGroupName, invocation) {
|
|
1986
|
+
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata, dryRun, experimentGroupName, invocation, codeChangeType) {
|
|
1987
1987
|
const payload = { traceFunctionKey };
|
|
1988
1988
|
if (experimentalSelectiveReplay !== void 0) payload.experimentalSelectiveReplay = experimentalSelectiveReplay;
|
|
1989
1989
|
if (limit !== void 0) payload.limit = limit;
|
|
@@ -1991,6 +1991,7 @@ var HttpClient = class {
|
|
|
1991
1991
|
if (name !== void 0) payload.name = name;
|
|
1992
1992
|
if (notes !== void 0) payload.notes = notes;
|
|
1993
1993
|
if (metadata !== void 0) payload.metadata = metadata;
|
|
1994
|
+
if (codeChangeType !== void 0) payload.codeChangeType = codeChangeType;
|
|
1994
1995
|
if (codeChangeDescription !== void 0) payload.codeChangeDescription = codeChangeDescription;
|
|
1995
1996
|
if (codeChangeFiles !== void 0) payload.codeChangeFiles = codeChangeFiles;
|
|
1996
1997
|
if (includeDbBranchLease) {
|
|
@@ -2163,4 +2164,4 @@ function experimentIdWireFields(experimentId) {
|
|
|
2163
2164
|
//#endregion
|
|
2164
2165
|
export { BitfabError as C, __version__ as E, gitRunner as S, readEnv as T, MAX_SPAN_CARRIER_BYTES as _, http_exports as a, replayContextReady as b, recordCallerTraceMetadata as c, DECLARED_NODE_FIELD as d, ROOT_TRACE_FUNCTION_KEY_FIELD as f, MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES as g, makeSpanOrigin as h, flushTraces as i, retireTraceMetadata as l, isFrameworkInstrumentation as m, SPAN_TYPES as n, unrefTimer as o, SimulationPlan as p, experimentIdWireFields as r, callerTraceMetadata as s, HttpClient as t, CONTENT_OFF_KEY as u, byteLength as v, MixedTracingError as w, runWithReplayContext as x, getReplayContext as y };
|
|
2165
2166
|
|
|
2166
|
-
//# sourceMappingURL=http-
|
|
2167
|
+
//# sourceMappingURL=http-7rcRBbK-.js.map
|