fix: preserve CLI diagnostics and verified navigation in the reader (#17)

This commit is contained in:
cflmy committed 2026-11-29 08:48:43 +08:00
1 parent a10163b0b0
commit bb4649905e
14 files changed
+162 -68

No files matched your search

+15 -9
View File
@@ -731,6 +731,7 @@
setRunStatus("运行未启动(" + result.status + "):" + reason);
if (result.status === 409 && result.data && result.data.code === "view.observation_stale") {
placeRunPanel("");
functionRuns.forEach(function (previous) { previous.sourceStale = true; });
setApplicability(selection.panel, "文稿或依赖已变化。请刷新后重新确认,旧结果属于历史。");
}
toast("运行未启动:" + reason);
@@ -830,7 +831,7 @@
if (!previous || runBusy) return;
activeRun = previous;
clearRunOutput();
placeRunPanel(previous.functionId);
placeRunPanel(previous.sourceStale ? "" : previous.functionId);
updateRunView(previous.terminalEvent, true);
}
@@ -842,7 +843,9 @@
}
reader.dataset.runState = data.state;
var partial = data.state === "succeeded" && data.result && data.result.output_complete === false;
setRunStatus((historical ? "历史运行:" : "状态:") + (partial ? "已结束,观察或输出不完整" : stateLabel(data.state)) +
var rejected = data.result && data.result.core_run_status === "rejected";
var label = rejected ? "运行前拒绝" : partial ? "已结束,观察或输出不完整" : stateLabel(data.state);
setRunStatus((historical ? "历史运行:" : "状态:") + label +
(data.at ? " · " + data.at : ""));
if (!isTerminalState(data.state)) {
setRunBusy(true);
@@ -856,6 +859,7 @@
if (exportButton) exportButton.hidden = !activeRun.exportData;
if (data.result && data.result.stale) {
placeRunPanel("");
functionRuns.forEach(function (previous) { previous.sourceStale = true; });
setApplicability(functionPanel(activeRun.functionId), "文稿或依赖已变化,当前结果无法绑定。请刷新后重新确认。");
} else if (activeRun.functionId && !historical) {
functionRuns.delete(activeRun.functionId);
@@ -877,11 +881,11 @@
if (data.observation_summary) {
var traceTitle = $("#mq-run-observation-title");
if (traceTitle && data.observation_summary.status === "verified") traceTitle.textContent = "已验证的 Observation v1 事件";
renderTrace(data.observation_summary);
renderTrace(data.observation_summary, historical);
}
else if (data.result && data.result.observation_status) renderTraceStatus(data.result.observation_status);
renderRunAudit(data);
if (!historical) toast(partial ? "运行已结束,观察或输出不完整" : data.state === "succeeded" ? "运行完成" : "运行" + stateLabel(data.state));
if (!historical) toast(data.state === "succeeded" && !partial ? "运行完成" : label);
}
function renderRunAudit(data) {
@@ -1039,6 +1043,7 @@
if (!markup) return false;
var htmlTags = new Set("div span small p details summary ol li dl dt dd table thead tr th tbody td pre code".split(" "));
var mathTags = new Set("math mrow mi mo mn mtext mfrac msqrt mroot msub msup msubsup munder mover munderover mtable mtr mtd mspace mpadded mstyle menclose mphantom mmultiscripts mprescripts none".split(" "));
var mathAttributes = new Set("display mathvariant mathsize mathcolor displaystyle scriptlevel stretchy symmetric movablelimits form fence separator lspace rspace minsize maxsize accent accentunder linethickness width height depth columnalign rowalign rowspacing columnspacing notation".split(" "));
var mathNS = "http://www.w3.org/1998/Math/MathML";
var root = new DOMParser().parseFromString(markup, "application/xml").documentElement;
if (root.namespaceURI !== null || root.localName !== "div" || root.getAttribute("class") !== "mq-result-value") return false;
@@ -1050,8 +1055,7 @@
if (!(isMath ? mathTags.has(name) : node.namespaceURI === null && htmlTags.has(name))) return null;
var result = isMath ? document.createElementNS(mathNS, name) : document.createElement(name);
Array.from(node.attributes).forEach(function (attr) {
var safeMathAttribute = isMath && attr.namespaceURI === null &&
!/^(on|href$|src$|style$)/i.test(attr.name);
var safeMathAttribute = isMath && attr.namespaceURI === null && mathAttributes.has(attr.name);
var safeHtmlAttribute = !isMath && (
(attr.name === "class" && /^mq-[a-z-]+$/.test(attr.value)) ||
(attr.name === "open" && name === "details") ||
@@ -1137,13 +1141,15 @@
if (!status || status === "verified") return;
var summary = $("#mq-run-summary");
if (!summary) return;
var message = status === "invalid"
var message = status === "rejected"
? "CLI 在开始运行前拒绝了本次调用,未建立源码观察绑定。"
: status === "invalid"
? "Observation 与本次 Analysis 不匹配或格式无效:不绘制执行标注,也不声称观察到完整过程。"
: "本次运行没有可用的 Observation v1(unavailable):只展示 CLI 返回值与输出。";
appendLine(summary, "p", "mq-run-warning", message);
}
function renderTrace(trace) {
function renderTrace(trace, historical) {
var summary = $("#mq-run-summary");
var wrap = $("#mq-run-observation-wrap");
var list = $("#mq-run-events");
@@ -1174,7 +1180,7 @@
if (entryEvents.length > 200) {
appendLine(list, "li", "mq-colophon", "仅显示前 200 条(共 " + entryEvents.length + " 条)。");
}
if (!trace.stale) {
if (!trace.stale && !historical) {
var bySource = {};
$$("[data-source-id]").forEach(function (element) {
bySource[element.dataset.sourceId] = element;
+1 -1
View File
@@ -21,7 +21,7 @@ $$
- [x] 记录样本
- [ ] 审查结果
[误差说明](docs/explanation.mq.md#误差-1) · [本页公式](#计算均值)
[误差说明](docs/explanation.mq.md#误差-2) · [本页公式](#计算均值)
# @exec 计算
+1 -1
View File
@@ -406,7 +406,7 @@ else
fi
gate_run G10_export "static export zero-execution + single renderer contract" \
"env MARQDO_BIN=\"$MARQDO_BIN\" ./scripts/test-export.sh && cargo test --locked --test contract"
"env MARQDO_BIN=\"$MARQDO_BIN\" ./scripts/test-export.sh && env VIEW_BIN=\"$bundle/bin/marqdo-view\" python3 scripts/test-complete-reader.py && cargo test --locked --test contract"
# Running inside CI does not attest a finished workflow: the browser stage
# may still fail. Only a finished remote pipeline on these exact source bytes
+1
View File
@@ -86,6 +86,7 @@ run_suite examples/control-flow
run_suite examples/function-params.mq.md
run_suite examples/circle-area.mq.md
run_suite tests/fixtures/security-project
VIEW_BIN="$repo_root/target/release/marqdo-view" node tests/browser/complete-reader.browser.cjs
core_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
if [[ "$core_before" != "$core_after" ]]; then
+5 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""HTTP and ZIP acceptance against the frozen rc.4 release binary.
"""HTTP and ZIP acceptance against the frozen release binary.
The View consumes Observation v1 (`--output jsonl` / `--observation-file`);
there is no trace file or legacy JSON run envelope.
@@ -78,7 +78,7 @@ def verify_zip(payload, destination, expected_digest):
assert not any(name.endswith(".js") for name in names)
html = archive.read("index.html").decode()
assert "<math" in html and "<script" not in html and 'data-action="call-function"' not in html
assert "本次执行快照" in html and "Int(4)" in html and "参数未包含" in html
assert "本次执行快照" in html and "<code>4</code>" in html and "参数未包含" in html
assert html.count('class="mq-snapshot"') == 1
other = archive.read("pages/docs/explanation.mq.md.html").decode()
assert 'class="mq-snapshot"' not in other and '<script' not in other
@@ -268,16 +268,16 @@ def check(root):
assert json.loads(archive.read("manifest.json"))["execution"]["status"] == "failed"
text_id, text = observe(submit("write_markup", "markup"))
assert text["state"] == "succeeded" and text["result"]["observation_status"] == "unavailable", text
assert text["state"] == "succeeded" and text["result"]["observation_status"] == "verified", text
assert text["result"]["stdout"] == attack_text.decode()
text_zip, _ = post(browser, base, "/api/exports", token, {**selection, "run_id": text_id})
with zipfile.ZipFile(io.BytesIO(text_zip)) as archive:
html = archive.read("index.html").decode()
assert "<script>" not in html and "&lt;script&gt;bad()" in html
assert json.loads(archive.read("manifest.json"))["execution"]["observation_status"] == "unavailable"
assert json.loads(archive.read("manifest.json"))["execution"]["observation_status"] == "verified"
first, headers = post(browser, base, "/api/exports", token, selection)
verify_zip(first, None, headers["X-Marqdo-Manifest-SHA256"])
print("active/cancelled export denied, verified failure gated, stdout escaped, missing Observation separate")
print("active/cancelled export denied, verified failure gated, stdout escaped, Live uses its verified stream alone")
print("selected IDs remain isolated, tampering detected, oversized request denied, failed and aborted packages cleaned")
calls = count.read_text().splitlines()
assert calls == ["call"] * 4, calls
+41 -19
View File
@@ -280,7 +280,7 @@ impl ExecutionController {
// concurrent submissions cannot both pass the single-job gate.
let static_doc = self.service.static_document(&validated.document)?;
if static_doc.analysis_digest != validated.analysis_digest {
return Err(ViewError::RunInvalid {
return Err(ViewError::ObservationStale {
detail: "页面携带的 analysis_digest 与当前源码的 check --emit 不一致(页面已过期);请刷新后重试"
.to_string(),
});
@@ -468,14 +468,6 @@ impl ExecutionController {
hooks,
)?;
// Exit code 2 is the frozen CLI rejecting the explicit argument/option
// combination before the run started (for example
// `strict.unsupported_grant`). View never strips a flag and retries.
classify_exit_code(
outcome.exit_code.unwrap_or(-1),
&outcome.stderr.text_lossy(),
)?;
Ok(CoreRun {
process: outcome,
decoder: receive_decoder.try_recv().ok(),
@@ -553,8 +545,26 @@ impl ExecutionController {
let stale = sha256_hex(&current_source) != static_doc.source_sha256;
let process_stderr = outcome.stderr.text_lossy();
let exit_code = outcome.exit_code.unwrap_or(-1);
let binding = decoder.finish(exit_code, &process_stderr, stale).and_then(|projection| {
if projection.source_verified && projection.mode.as_deref() != Some(plan.mode.as_str()) {
let decoded = decoder.finish(exit_code, &process_stderr, stale);
let decoded = match decoded {
Err(err @ ViewError::ObservationInvalid { .. }) if exit_code == 2 => {
// Preserve a valid CLI rejection when the stream contains one.
// Only an option failure without a usable terminal needs the
// process-status diagnostic. There is no retry.
Err(classify_exit_code(exit_code, &process_stderr)
.err()
.unwrap_or(err))
}
decoded => decoded,
};
let binding = decoded.and_then(|projection| {
if projection.is_success() && exit_code != 0 {
return Err(ViewError::ObservationInvalid {
detail: "Observation success disagrees with the CLI exit status".into(),
});
}
if projection.source_verified && projection.mode.as_deref() != Some(plan.mode.as_str())
{
return Err(ViewError::ObservationInvalid {
detail: "Observation run mode disagrees with the confirmed request".into(),
});
@@ -563,16 +573,23 @@ impl ExecutionController {
&& !projection.matches_target(&static_doc.verified.projection, &plan.function_id)
{
return Err(ViewError::ObservationStale {
detail: "Observation target or producer disagrees with the confirmed function".into(),
detail: "Observation target or producer disagrees with the confirmed function"
.into(),
});
}
if projection.is_success()
&& !self.service.static_document(&plan.document).is_ok_and(|current|
current.analysis_digest == static_doc.analysis_digest
&& current.media_digests == static_doc.media_digests)
&& !self
.service
.static_document(&plan.document)
.is_ok_and(|current| {
current.analysis_digest == static_doc.analysis_digest
&& current.media_digests == static_doc.media_digests
})
{
return Err(ViewError::ObservationStale {
detail: "document, dependencies or media changed before the result could be bound".into(),
detail:
"document, dependencies or media changed before the result could be bound"
.into(),
});
}
Ok(projection)
@@ -967,7 +984,9 @@ fn terminal_state_for(state: RunDisplayState) -> RunState {
/// Observation binding status exposed to the browser. A failed *run* can still
/// have a fully verified observation stream; truncation is called out first.
fn observation_status_for(projection: &RunProjection) -> &'static str {
if projection.truncated.is_some() {
if projection.run_status == "rejected" {
"rejected"
} else if projection.truncated.is_some() {
"truncated"
} else {
match projection.state {
@@ -997,7 +1016,9 @@ fn terminal_from_projection(
&projection,
observation_status,
);
let summary = observation_v1::summary_json(&projection, &static_doc.verified.projection, false);
let summary = projection
.source_verified
.then(|| observation_v1::summary_json(&projection, &static_doc.verified.projection, false));
let (error_code, error_message) = match state {
RunState::Failed => (
Some(
@@ -1022,7 +1043,7 @@ fn terminal_from_projection(
TerminalOutcome {
state,
result,
observation_summary: Some(summary),
observation_summary: summary,
observation: Some(projection),
error_code,
error_message,
@@ -1074,6 +1095,7 @@ fn observation_result(
_ => serde_json::Value::Null,
};
result["core_run_id"] = serde_json::json!(projection.run_id);
result["core_run_status"] = serde_json::json!(projection.run_status);
result["core_version"] = serde_json::json!(projection.producer_version);
result["started_unix_ms"] = serde_json::json!(projection.started_unix_ms);
result["capture_level"] = serde_json::json!(projection.capture_level);
+11 -16
View File
@@ -1356,7 +1356,15 @@ impl ObservationDecoder {
}
fn normalized_event(event: &ObservedEvent, raw: &RawEvent) -> Value {
let mut value = raw.payload.clone();
let mut value = match event.kind {
ObservedKind::RunCompleted => {
json!({"status": raw.payload["status"], "value_type": raw.payload["value_type"]})
}
ObservedKind::RunFailed | ObservedKind::RunRejected => json!({
"status": raw.payload["status"], "error_code": raw.payload["error"]["code"],
}),
_ => raw.payload.clone(),
};
if let Some(object) = value.as_object_mut() {
object.insert(
"kind".to_string(),
@@ -1450,21 +1458,8 @@ fn validate_error_location(error: &serde_json::Map<String, Value>) -> Result<(),
if let Some(span) = error.get("span") {
parse_span_value(span)?;
}
if error.keys().any(|key| {
!matches!(
key.as_str(),
"code"
| "message"
| "module_id"
| "span"
| "relative_path"
| "line"
| "column"
| "hint"
)
}) {
return Err("Observation error carries an unknown field".to_string());
}
// Observation 1 permits additional diagnostic fields, including frames
// and origin. The View only projects the facts it validates and displays.
Ok(())
}
+14 -1
View File
@@ -69,11 +69,24 @@ pub fn build(input: BuildInput<'_>) -> PresentationModel {
.map(|projection| projection.warnings.clone())
.unwrap_or_default();
let outline = semantic.as_ref().map(build_outline).unwrap_or_default();
let verified_headings = semantic
.as_ref()
.into_iter()
.flat_map(|projection| {
projection.anchors.iter().filter_map(|anchor| {
let heading = projection.unit(&anchor.unit_id)?.heading_span?;
Some((heading, super::links::content_anchor(&anchor.anchor)))
})
})
.collect();
PresentationModel {
version: PRESENTATION_VERSION,
title: document.title(),
heading_slugs: super::links::heading_slugs(&document.blocks),
heading_slugs: super::links::heading_slugs_with_verified(
&document.blocks,
verified_headings,
),
media: Default::default(),
document,
semantic,
+20 -7
View File
@@ -43,9 +43,18 @@ pub fn relative_url(current: &SafeRelativePath, url: &str) -> Option<SafeRelativ
}
pub fn heading_slugs(blocks: &[DocBlock]) -> HashMap<SourceSpan, String> {
let mut slugs = HashMap::new();
let mut used = HashSet::new();
heading_slugs_with_verified(blocks, HashMap::new())
}
pub(crate) fn heading_slugs_with_verified(
blocks: &[DocBlock],
mut slugs: HashMap<SourceSpan, String>,
) -> HashMap<SourceSpan, String> {
let mut used: HashSet<_> = slugs.values().cloned().collect();
visit_headings(blocks, &mut |span, content| {
if slugs.contains_key(&span) {
return;
}
let label = content.iter().map(Inline::plain_text).collect::<String>();
let label = ["@exec", "@knowledge"]
.into_iter()
@@ -70,11 +79,7 @@ pub fn heading_slugs(blocks: &[DocBlock]) -> HashMap<SourceSpan, String> {
})
.collect();
let base = if base.is_empty() { "section" } else { &base };
let base = if base.starts_with("mq-") {
format!("section-{base}")
} else {
base.to_string()
};
let base = content_anchor(base);
let mut slug = base.clone();
let mut suffix = 1;
while !used.insert(slug.clone()) {
@@ -86,6 +91,14 @@ pub fn heading_slugs(blocks: &[DocBlock]) -> HashMap<SourceSpan, String> {
slugs
}
pub(crate) fn content_anchor(name: &str) -> String {
if name.starts_with("mq-") {
format!("section-{name}")
} else {
name.to_string()
}
}
fn visit_headings(blocks: &[DocBlock], visit: &mut impl FnMut(SourceSpan, &[Inline])) {
for block in blocks {
match block {
+3 -1
View File
@@ -1379,7 +1379,9 @@ fn render_inline(
if let Some(fragment) = &reference.fragment {
if !fragment.is_empty() {
href.push('#');
href.push_str(&percent_encode_path(fragment));
href.push_str(&percent_encode_path(
&super::links::content_anchor(fragment),
));
}
}
href
+1
View File
@@ -539,6 +539,7 @@ fn status_for(err: &ViewError) -> StatusCode {
"view.run_invalid" | "view.no_entry_function" | "view.export_invalid" => StatusCode(400),
"view.run_busy"
| "view.run_conflict"
| "view.observation_stale"
| "view.export_unavailable"
| "view.export_source_changed" => StatusCode(409),
"view.run_not_found" => StatusCode(404),
+41 -7
View File
@@ -25,7 +25,7 @@ core, calls = ${JSON.stringify(core)}, ${JSON.stringify(runCount)}
args = sys.argv[1:]
if args[0] not in ('run','call'):
os.execv(core, [core, *args])
assert '--event-stream' in args and '--json' not in args
assert args[args.index('--output') + 1] == 'jsonl' and '--observation-file' in args and '--json' not in args
with open(calls, 'a') as f: f.write(args[0]+'\\n')
if 'write_output' not in args:
os.execv(core, [core, *args])
@@ -80,7 +80,7 @@ async function verifyOffline(browser, url) {
await imagesLoaded(page, 1);
assert.equal(await page.locator("math mfrac").count(), 1);
assert.equal(await page.locator("script, [data-action=run], [data-action=call-function]").count(), 0);
assert.match(await page.locator(".mq-snapshot pre[aria-label=返回值]").innerText(), /4\.0|Float\(4\)/);
assert.equal(await page.locator(".mq-snapshot .mq-result-value code").innerText(), "4.0");
assert.equal(await page.locator(".mq-snapshot [aria-label=stdout]").count(), 0);
await screenshot(page, "offline-snapshot.png");
await page.locator(".mq-snapshot").scrollIntoViewIfNeeded();
@@ -90,7 +90,7 @@ async function verifyOffline(browser, url) {
await page.emulateMedia({ media: "screen" });
await page.getByRole("link", { name: "误差说明", exact: true }).click();
await imagesLoaded(page, 3);
assert.equal(decodeURIComponent(new URL(page.url()).hash), "#误差-1");
assert.equal(decodeURIComponent(new URL(page.url()).hash), "#误差-2");
assert.equal(await page.locator(":target").textContent(), "误差");
assert.equal(await page.locator(".mq-snapshot").count(), 0);
assert.ok(requests.every(request => request.startsWith("file:") || request.startsWith("data:")), requests);
@@ -121,19 +121,22 @@ async function verifyOffline(browser, url) {
await page.getByRole("link", { name: "误差说明", exact: true }).click();
await imagesLoaded(page, 3);
assert.equal(await page.locator(":target").textContent(), "误差");
assert.equal(decodeURIComponent(new URL(page.url()).hash), "#误差-1");
await page.getByRole("link", { name: "返回计算均值", exact: true }).click();
assert.equal(decodeURIComponent(new URL(page.url()).hash), "#误差-2");
const backlink = page.getByRole("link", { name: /^返回计算均值/ });
assert.equal(await backlink.getAttribute("data-reference-state"), "not_loaded");
await backlink.click();
assert.match(await page.locator(":target").innerText(), /计算均值/);
assert.equal(fs.existsSync(runCount), false);
await page.locator("h2[id=计算均值] [data-action=call-function]").click();
await page.locator("[data-param-name=a]").fill("3");
assert.equal(fs.existsSync(runCount), false);
await page.locator(".mq-function-interaction:visible [data-action=prepare-function]").click();
await page.locator("[data-action=run-confirm]").click();
const result = page.locator(".mq-result-slot #mq-run-panel");
await result.locator("[data-action=export-result]").waitFor();
assert.equal(await result.getAttribute("data-run-state"), "succeeded");
assert.match(await result.locator("#mq-run-summary").innerText(), /Float\(4\.0\)/);
assert.equal(await result.locator("#mq-run-summary .mq-result-value code").innerText(), "4.0");
assert.equal(fs.readFileSync(runCount, "utf8"), "call\n");
await result.scrollIntoViewIfNeeded();
await screenshot(page, "live-result.png");
@@ -157,12 +160,43 @@ async function verifyOffline(browser, url) {
execFileSync("python3", ["-m", "zipfile", "-e", zip, extracted]);
await page.locator("h2[id=write_output] [data-action=call-function]").click();
await page.locator('.mq-function-interaction[data-function-for$=".write_output"] [data-action=prepare-function]').click();
await page.locator("[data-action=run-confirm]").click();
await page.locator("#mq-run-stdout").waitFor();
assert.equal(await result.getAttribute("data-run-state"), "running");
assert.equal((await page.locator("#mq-run-stdout").innerText()).trim(), "4");
await page.locator("[data-action=export-result]").waitFor();
assert.equal(fs.readFileSync(runCount, "utf8"), "call\ncall\n");
// The same public interface with a different implementation invalidates
// the old confirmation. Only a new explicit call may render a new result.
const average = page.locator('h2[id=计算均值] [data-action=call-function]');
const averageForm = page.locator('.mq-function-interaction[data-function-for$=".计算均值"]');
const entry = path.join(project, "index.mq.md");
const oldAnalysis = await page.locator("body").getAttribute("data-analysis-digest");
await average.click();
await averageForm.locator("[data-param-name=a]").fill("3");
await averageForm.locator("[data-action=prepare-function]").click();
const original = fs.readFileSync(entry, "utf8");
const replacement = original.replace("return (a + b) / 2", "return (a + b) * 0.5");
assert.notEqual(replacement, original);
fs.writeFileSync(entry, replacement);
await page.locator("[data-action=run-confirm]").click();
await page.locator("#mq-run-status", { hasText: "运行未启动(409)" }).waitFor();
assert.equal(fs.readFileSync(runCount, "utf8"), "call\ncall\n");
assert.equal(await result.count(), 0);
await screenshot(page, "stale-confirmation.png");
await page.reload();
assert.notEqual(await page.locator("body").getAttribute("data-analysis-digest"), oldAnalysis);
assert.equal(await page.locator("#mq-run-panel").isVisible(), false);
await average.click();
await averageForm.locator("[data-param-name=a]").fill("3");
await averageForm.locator("[data-action=prepare-function]").click();
await page.locator("[data-action=run-confirm]").click();
await result.locator("[data-action=export-result]").waitFor();
assert.equal(await result.locator(".mq-result-value code").innerText(), "4.0");
assert.equal(fs.readFileSync(runCount, "utf8"), "call\ncall\ncall\n");
assert.deepEqual(external, []);
assert.deepEqual(errors, []);
@@ -175,7 +209,7 @@ async function verifyOffline(browser, url) {
await context.close();
server.kill();
await verifyOffline(browser, pathToFileURL(path.join(extracted, "index.html")).href);
console.log("Live media, cross-document anchors, confirmed call, pre-terminal stdout, private download and offline ZIP: PASS");
console.log("Live media, cross-document anchors, stale confirmation, explicit calls, pre-terminal stdout and offline ZIP: PASS");
} finally {
if (browser) await browser.close();
server.kill();
+7
View File
@@ -388,6 +388,13 @@ function localHostOnly(url) {
check("selecting another function's result reuses its record without executing", submittedRuns === 3 &&
(await page.locator("#mq-run-status").innerText()).includes("历史运行") &&
(await page.locator("#mq-run-summary").innerText()).includes("18014398509481986"));
await page.fill('[data-param-name="items"]', 'double(7)');
await page.locator('.mq-function-interaction[data-function-for$=".format_arguments"] [data-action="prepare-function"]').click();
await page.click('[data-action="run-confirm"]');
await page.locator("#mq-run-status", { hasText: "运行前拒绝" }).waitFor();
check("CLI refuses a call expression in a constant field before running the document",
(await page.locator("#mq-run-summary").innerText()).includes("cli.invalid_argument") &&
!(await page.locator("#mq-export-result").isVisible()));
}
if (projectName === "circle-area.mq.md") {
+1 -1
View File
@@ -398,7 +398,7 @@ fn stale_request_digest_is_rejected_before_any_process_starts() {
.controller
.submit("session-a", body.to_string().as_bytes())
.expect_err("stale digest must be rejected");
assert_eq!(err.code(), "view.run_invalid");
assert_eq!(err.code(), "view.observation_stale");
assert!(!fixture.core.run_was_called());
}