Wave 509/509: Kernel rig: assembly cases for mass properties, align, find limits and moving items between parts (and 38 more)
39 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. These commits sit on several merged branches, so the wave holds their combined result. - 1b17dd7f5 brett19: Merge fixes: every crate and test target compiles on the merged tree, but for crates/geom's hlr - 8f2c11da2 brett19: Drawings hidden lines: read develop's B-rep records - c30ca0216 brett19: Hidden-line fixtures: build develop's records from the fixtures' data - 5dd2509ae brett19: Hidden lines: tests of the bounded edges, face charts and placed revolutions - 1642df0ea brett19: drawing-hlr doc: what is drawn and refused on develop's records - ddcb80c8e brett19: hlr tests: a placed revolution is refused when its placement is not rigid - e4977721f brett19: Hidden lines: a traced intersection is drawn only where its spline lies on both surfaces - b3ef6ae52 brett19: Hidden lines: kernel bodies through the production prepare against closed forms - 4cd2ae062 brett19: Tests from main: the world state is a Result here - 51d7ad09e brett19: A blend's pick measures close edges on their curves, not their polylines - 11a89713c brett19: Merge fixes from the first SMLib test pass - 48fcb7aac brett19: Merge fixes from the ui test pass and the gates - abd739855 brett19: A silhouette takes its facing from the surface's normals - 85114c5a2 brett19: Clippy and rustfmt on the merged tree - 55a46569f brett19: Stepwise open checks every feature under the session's mode - 4627402e4 brett19: Clippy without SMLib: the planar-sheet edge reader is built only with it - 5fbece0ac brett19: STEP import: a ball's halves whose seams are off each other's quarter lines each form within one turn - eb78d20b0 brett19: Lid ring sketch test: find the ring under the pick, not by main's kernel's name - 3048d8c49 brett19: Viewport culling test: each box's triangles from its mesh, not 12 - dc88b80e2 brett19: Timeline chip test: a fillet that really reduces - 876203621 brett19: Edge names: a seam names its one face once; the curve-id test reads every edge kernel-neutrally - 900635710 brett19: rustfmt on the merged tree - b7e83cd7c brett19: Known failing on SMLib: two of main's new tests assume truck's box mesh and fillet torus - 63bde053a jyviko: Locales: Vietnamese for the setback-too-short refusal, now that vi is a complete catalog - 967a1caa6 brett19: Kernel rig: exact volumes for 1213's bent-tube round and 4782's bar round, rel 1e-6 - 82c821d2a brett19: After the merge: clippy's auto-deref, and the mesh-decisions list for the merged tree - 5862ee223 brett19: After the merge: main's new tests on the SMLib kernel - be78372b2 brett19: Twisted sweep: circles about a straight path are exact cylinders (solidcore#2184) - 312d14500 jyviko: After the merge: a hole that misses is found by exact boxes; a face is a one-face patch; main's mesh-box helpers gone - 6f7e51acb jyviko: After the merge: split_move's Result reaches its callers; to_local's duplicated move check goes - 8f0c79b20 jyviko: After the merge: main's two new tests take world_state's Result, as the rest of their files do - 5f4d70061 jyviko: After the merge with main: its new code on develop's exact bounds, types and thread fields - 2b2ab6627 jyviko: Cargo.lock: develop's profile, smlib and step crates at main's 0.30.1 - e6a4b0a9a jyviko: Kernel rig: main's six new sketch-only commands are exempt from a kernel case - 5acbd2e71 jyviko: Cuts leave the bodies their tools can't reach, by exact boxes (#10225 on exact geometry) - d2b202307 jyviko: Kernel rig: main's new view, rendering, appearance and settings commands are exempt from a case - 21db090ba jyviko: Kernel rig: construct.plane.axis_point gets construction cases - c1f45cae2 jyviko: Kernel rig: assembly cases for mass properties, align, find limits and moving items between parts - 084695416 jyviko: Kernel rig: export and print face cases in the import area Co-authored-by: jyviko <2501648+jyviko@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# Manager-run local evidence collector. Does not launch/build anything or modify baseline files.
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][int]$Port,
|
||||
[Parameter(Mandatory = $true)][string]$OutputDirectory,
|
||||
[string]$TokenPath,
|
||||
[switch]$Baseline,
|
||||
[ValidateRange(1, 1000)][int]$Frames = 30
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (-not $TokenPath) { $TokenPath = Join-Path $env:LOCALAPPDATA "SolidCraft/control/$Port.token" }
|
||||
$blurToken = (Get-Content -LiteralPath $TokenPath -Raw).Trim()
|
||||
$blurOutput = [IO.Path]::GetFullPath($OutputDirectory)
|
||||
if (Test-Path -LiteralPath $blurOutput) { throw 'Use a new output directory; existing evidence is never overwritten.' }
|
||||
New-Item -ItemType Directory -Path $blurOutput | Out-Null
|
||||
$blurClient = [Net.Sockets.TcpClient]::new('127.0.0.1', $Port)
|
||||
$blurClient.ReceiveTimeout = 60000
|
||||
$blurClient.SendTimeout = 60000
|
||||
$blurStream = $blurClient.GetStream()
|
||||
$blurReader = [IO.StreamReader]::new($blurStream)
|
||||
$blurWriter = [IO.StreamWriter]::new($blurStream, [Text.UTF8Encoding]::new($false))
|
||||
$blurWriter.AutoFlush = $true
|
||||
$script:blurRequestId = 0
|
||||
function Invoke-BlurControl([string]$Method, $Parameters = @{}) {
|
||||
$script:blurRequestId++
|
||||
$blurWriter.WriteLine((@{ id = $script:blurRequestId; token = $blurToken; method = $Method; params = $Parameters } | ConvertTo-Json -Compress -Depth 30))
|
||||
$blurLine = $blurReader.ReadLine()
|
||||
if (-not $blurLine) { throw 'Control connection closed.' }
|
||||
$blurReply = $blurLine | ConvertFrom-Json
|
||||
if (-not $blurReply.ok) { throw "$Method failed: $($blurReply.error)" }
|
||||
return $blurReply.result
|
||||
}
|
||||
function Save-BlurShot([string]$Name) {
|
||||
Invoke-BlurControl 'ui.screenshot' @{ path = (Join-Path $blurOutput "$Name.png"); allow_paths = @($blurOutput) } | Out-Null
|
||||
}
|
||||
try {
|
||||
$blurInitial = Invoke-BlurControl 'ui.inspect'
|
||||
$blurPrefs = Invoke-BlurControl 'ui.prefs'
|
||||
$blurInitial | ConvertTo-Json -Depth 30 | Set-Content -LiteralPath (Join-Path $blurOutput 'initial-inspect.json')
|
||||
if (-not $Baseline) { Invoke-BlurControl 'ui.blur' @{ radius_px = 0; surface_alpha = $null } | Out-Null }
|
||||
# Leave the current scene/theme/size untouched for the main/branch zero comparison.
|
||||
$blurTimings = @()
|
||||
for ($blurIndex = 0; $blurIndex -lt ($Frames + 5); $blurIndex++) {
|
||||
$blurClock = [Diagnostics.Stopwatch]::StartNew()
|
||||
# A screenshot forces a presented frame. Reuse only this collector's scratch file.
|
||||
Save-BlurShot 'timing-scratch'
|
||||
$blurClock.Stop()
|
||||
$blurInspect = Invoke-BlurControl 'ui.inspect'
|
||||
if ($blurIndex -ge 5) {
|
||||
$blurTimings += @{ ui_cpu_ms = $blurInspect.frame_ms; screenshot_roundtrip_ms = $blurClock.Elapsed.TotalMilliseconds }
|
||||
}
|
||||
}
|
||||
$blurReport = @{ machine = $env:COMPUTERNAME; mode = $(if ($Baseline) { 'baseline' } else { 'branch-zero' }); samples = $blurTimings; inspect = $blurInitial }
|
||||
if (-not $Baseline) { $blurReport.counters = Invoke-BlurControl 'ui.blur' }
|
||||
$blurReport | ConvertTo-Json -Depth 30 | Set-Content -LiteralPath (Join-Path $blurOutput 'zero-timing.json')
|
||||
Save-BlurShot 'zero-ui'
|
||||
Invoke-BlurControl 'ui.render' @{ path = (Join-Path $blurOutput 'zero-model.png'); allow_paths = @($blurOutput) } | Out-Null
|
||||
if (-not $Baseline) {
|
||||
foreach ($blurTheme in @('light', 'dark')) {
|
||||
Invoke-BlurControl 'ui.prefs' @{ theme = $blurTheme } | Out-Null
|
||||
foreach ($blurRadius in @(0, 18)) {
|
||||
Invoke-BlurControl 'ui.blur' @{ radius_px = $blurRadius; surface_alpha = 0.7 } | Out-Null
|
||||
Save-BlurShot "$blurTheme-$blurRadius"
|
||||
$blurState = Invoke-BlurControl 'ui.blur'
|
||||
$blurState | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath (Join-Path $blurOutput "$blurTheme-$blurRadius-counters.json")
|
||||
if ($blurRadius -gt 0 -and $blurState.capability -ne 'Available') { throw "Blur unavailable: $($blurState.capability | ConvertTo-Json -Compress)" }
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (-not $Baseline) { Invoke-BlurControl 'ui.blur' @{ radius_px = 0; surface_alpha = $null } | Out-Null }
|
||||
if (-not $Baseline -and $blurPrefs -and $blurPrefs.theme) { Invoke-BlurControl 'ui.prefs' @{ theme = $blurPrefs.theme } | Out-Null }
|
||||
if (-not $Baseline -and $blurInitial -and $null -ne $blurInitial.ui.dark) { Invoke-BlurControl 'ui.set' @{ dark = $blurInitial.ui.dark } | Out-Null }
|
||||
} finally {
|
||||
$blurWriter.Dispose(); $blurReader.Dispose(); $blurClient.Dispose()
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Release step: give the pending design-format changes their number for good.
|
||||
# Release step: give the pending file-format changes their number for good.
|
||||
#
|
||||
# Moves every change in crates/doc/src/format/pending/ into crates/doc/src/format/v<N>/, where N
|
||||
# is the number development builds have been writing for them (the last folded format + 1).
|
||||
# Commit the result with the release's version bump. Nothing to do when nothing is pending.
|
||||
# See crates/doc/src/format/pending/README.md.
|
||||
# For each family of files in crates/doc/build.rs's FAMILIES (designs in crates/doc/src/format/,
|
||||
# drawings in crates/doc/src/drawing/format/), moves every change in its pending/ folder into its
|
||||
# v<N>/, where N is the number development builds have been writing for them (the family's last
|
||||
# folded format + 1). Commit the result with the release's version bump. Nothing to do for a family
|
||||
# with nothing pending. See crates/doc/src/format/pending/README.md.
|
||||
set -euo pipefail
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
dir="$root/crates/doc/src/format"
|
||||
last=$(sed -n 's/^const HAND_WRITTEN: u32 = \([0-9]*\);/\1/p' "$root/crates/doc/build.rs")
|
||||
[ -n "$last" ] || { echo "HAND_WRITTEN not found in crates/doc/build.rs" >&2; exit 1; }
|
||||
for d in "$dir"/v*/; do
|
||||
[ -d "$d" ] || continue
|
||||
n=${d%/}
|
||||
n=${n##*/v}
|
||||
if [ "$n" -gt "$last" ]; then last=$n; fi
|
||||
done
|
||||
families=$(grep -o 'Family { folder: "[^"]*", base: [0-9]*' "$root/crates/doc/build.rs" | sed 's/.*folder: "\([^"]*\)", base: \([0-9]*\)/\1 \2/' || true)
|
||||
[ -n "$families" ] || { echo "FAMILIES not found in crates/doc/build.rs" >&2; exit 1; }
|
||||
|
||||
shopt -s nullglob
|
||||
pending=("$dir"/pending/*.rs)
|
||||
if [ ${#pending[@]} -eq 0 ]; then
|
||||
echo "No pending format changes: this release writes format $last."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
next=$((last + 1))
|
||||
mkdir -p "$dir/v$next"
|
||||
git -C "$root" mv "${pending[@]}" "$dir/v$next/"
|
||||
echo "Format $next is now fixed, with ${#pending[@]} change(s):"
|
||||
for f in "${pending[@]}"; do echo " ${f##*/}"; done
|
||||
echo "Commit crates/doc/src/format/ with the version bump."
|
||||
folded=0
|
||||
while read -r folder last; do
|
||||
dir="$root/crates/doc/$folder"
|
||||
for d in "$dir"/v*/; do
|
||||
n=${d%/}
|
||||
n=${n##*/v}
|
||||
if [ "$n" -gt "$last" ]; then last=$n; fi
|
||||
done
|
||||
pending=("$dir"/pending/*.rs)
|
||||
if [ ${#pending[@]} -eq 0 ]; then
|
||||
echo "No pending format changes in $folder: this release writes format $last."
|
||||
continue
|
||||
fi
|
||||
next=$((last + 1))
|
||||
mkdir -p "$dir/v$next"
|
||||
git -C "$root" mv "${pending[@]}" "$dir/v$next/"
|
||||
echo "Format $next of $folder is now fixed, with ${#pending[@]} change(s):"
|
||||
for f in "${pending[@]}"; do echo " ${f##*/}"; done
|
||||
folded=$((folded + 1))
|
||||
done <<< "$families"
|
||||
[ "$folded" -eq 0 ] || echo "Commit crates/doc/src/ with the version bump."
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
'use strict';
|
||||
// While a new geometry kernel is evaluated, new issues, pull requests and discussions about
|
||||
// kernel work get the `kernel-paused` label, so a maintainer finds them and answers in person
|
||||
// (CONTRIBUTING.md, "Kernel work is paused"). Reports of crashes and data loss are left alone,
|
||||
// and so is anyone who can push to the repository.
|
||||
// While a new geometry kernel is evaluated, new issues and discussions about kernel work, and new
|
||||
// pull requests that change the kernel directories, get the `kernel-paused` label, so a maintainer
|
||||
// finds them and answers in person (CONTRIBUTING.md, "Kernel work is paused"). Reports of crashes
|
||||
// and data loss are left alone, and so is anyone who can push to the repository.
|
||||
|
||||
const LABEL = 'kernel-paused';
|
||||
const LABEL_COLOR = 'b60205';
|
||||
const LABEL_DESCRIPTION = 'Kernel work is paused while a new geometry kernel is evaluated';
|
||||
|
||||
// Kernel operations named in a title. "Hole" and "shell" are left out on purpose: they name UI
|
||||
// work too, and a pull request that changes the kernel is caught by its files.
|
||||
// Kernel operations named in the title of an issue or discussion. "Hole" and "shell" are left out
|
||||
// on purpose: they name UI work too. A pull request is judged by its files, never by its title.
|
||||
const TOPIC =
|
||||
/\b(booleans?|fillets?|chamfers?|offsets?|sweeps?|lofts?|threads?|step|stp|iges|igs|tessellat\w*|kernel|truck|b-?rep)\b/i;
|
||||
// Crashes and lost work come first whatever the kernel is.
|
||||
const URGENT = /\b(crash\w*|panic\w*|data loss|lost (my )?work|corrupt\w*)\b/i;
|
||||
// What a pull request changes that makes it kernel work.
|
||||
const KERNEL_PATHS = ['crates/kernel/', 'vendor/truck'];
|
||||
const KERNEL_PATHS = ['crates/kernel/', 'crates/geom/', 'vendor/truck'];
|
||||
|
||||
function isTopic(title) {
|
||||
return TOPIC.test(title || '');
|
||||
@@ -55,10 +55,12 @@ async function handleOpened({ github, context }) {
|
||||
const pull = Boolean(context.payload.pull_request);
|
||||
if (isUrgent(item.title, item.body)) return `#${item.number}: a crash or data-loss report, left alone`;
|
||||
if (await canPush({ github, context }, item.user.login)) return `#${item.number}: by a maintainer, left alone`;
|
||||
let kernel = isTopic(item.title);
|
||||
if (pull && !kernel) {
|
||||
let kernel;
|
||||
if (pull) {
|
||||
const files = await github.paginate(github.rest.pulls.listFiles, { ...context.repo, pull_number: item.number, per_page: 100 });
|
||||
kernel = touchesKernel(files.map((f) => f.filename));
|
||||
} else {
|
||||
kernel = isTopic(item.title);
|
||||
}
|
||||
if (!kernel) return `#${item.number}: not kernel work`;
|
||||
await ensureLabel({ github, context });
|
||||
|
||||
@@ -80,6 +80,20 @@ test('a pull request outside the kernel is left alone', async () => {
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('a pull request with a kernel topic in its title but no kernel files is left alone', async () => {
|
||||
const { github, calls } = fake({ files: ['crates/ui-egui/src/dialogs.rs'] });
|
||||
const pr = { number: 10, title: 'Fillet dialog: a clearer radius field', body: '', draft: false, node_id: 'PR_3', user: { login: 'someone' } };
|
||||
await paused.handleOpened({ github, context: { repo, payload: { pull_request: pr } } });
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('a pull request that changes crates/geom is labelled', async () => {
|
||||
const { github, calls } = fake({ files: ['crates/geom/src/lib.rs'] });
|
||||
const pr = { number: 11, title: 'Tidy a helper', body: '', draft: false, node_id: 'PR_4', user: { login: 'someone' } };
|
||||
await paused.handleOpened({ github, context: { repo, payload: { pull_request: pr } } });
|
||||
assert.deepEqual(names(calls), ['addLabels']);
|
||||
});
|
||||
|
||||
test('a kernel discussion is labelled', async () => {
|
||||
const { github, calls } = fake();
|
||||
const d = { number: 3, title: 'Ideas for better booleans', body: '', node_id: 'D_1', user: { login: 'someone' } };
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Pull request checks for .github/workflows/pr-checks.yml (CONTRIBUTING.md, "Sending a change"):
|
||||
// 1. duplicate: fails when a lower-numbered open PR already closes the same issue;
|
||||
// 2. defaults: the template line `Changes a default: no | yes - <what>, old behaviour kept behind
|
||||
// preference <name>` must be present and well formed; `yes` earns the `changes-default` label.
|
||||
// preference <name>` must be present and well formed; `yes` earns the `changes-default` label;
|
||||
// 3. picture: a PR adding to the showcase or docs/screenshots shows a picture in its description.
|
||||
// The parsing is pure and tested in scripts/pr-checks/pr-checks.test.js; the functions that talk to
|
||||
// GitHub take the github-script `github` client and `context`, so the tests can pass fakes.
|
||||
'use strict';
|
||||
@@ -10,6 +11,11 @@ const SKIP_LABEL = 'not-a-duplicate';
|
||||
const DEFAULT_LABEL = 'changes-default';
|
||||
// PRs opened before this predate the template line; they pass the defaults check with a notice.
|
||||
const DEFAULTS_ENFORCED_FROM = Date.parse('2026-10-25T00:00:00Z');
|
||||
// PRs opened before this predate the picture rule; they pass the picture check with a notice.
|
||||
const PICTURE_ENFORCED_FROM = Date.parse('2026-11-02T00:00:00Z');
|
||||
const PICTURE_HELP =
|
||||
'Show it in the description: drag a picture or video into the PR text so it can be seen without ' +
|
||||
'opening the changed files, and say in plain words what it is (CONTRIBUTING.md, "Sending a change").';
|
||||
const BOT_LOGINS = new Set(['dependabot[bot]', 'github-actions[bot]', 'dependabot-preview[bot]']);
|
||||
|
||||
// Template comments and code blocks hold examples, not claims.
|
||||
@@ -106,6 +112,33 @@ async function checkDuplicate({ github, context, core }) {
|
||||
return { dups };
|
||||
}
|
||||
|
||||
// A picture or video someone can see in the description: not one in a comment, a code block or the
|
||||
// template's own text.
|
||||
function hasPicture(body) {
|
||||
const text = stripNoise(body);
|
||||
return /!\[[^\]]*\]\([^)\s]+[^)]*\)/.test(text)
|
||||
|| /<(?:img|video)\b[^>]*\bsrc=/i.test(text)
|
||||
|| /https:\/\/github\.com\/user-attachments\/assets\/\S+/.test(text);
|
||||
}
|
||||
|
||||
// Files that are about something to look at, whatever the rest of the PR does.
|
||||
function needsPicture(files) {
|
||||
return files.some((f) => f === 'docs/showcase.md' || f.startsWith('docs/screenshots/'));
|
||||
}
|
||||
|
||||
async function checkPicture({ github, context, core }) {
|
||||
const pull = context.payload.pull_request;
|
||||
if (isBot(pull.user)) return { skipped: 'bot' };
|
||||
if (!(Date.parse(pull.created_at) >= PICTURE_ENFORCED_FROM)) return { skipped: 'opened before enforcement' };
|
||||
const files = (await github.paginate(github.rest.pulls.listFiles, {
|
||||
...context.repo, pull_number: pull.number, per_page: 100,
|
||||
})).map((f) => f.filename);
|
||||
if (!needsPicture(files)) return { skipped: 'nothing to show' };
|
||||
const shown = hasPicture(pull.body);
|
||||
if (!shown) core.setFailed(`This PR adds something to look at, but the description shows no picture. ${PICTURE_HELP}`);
|
||||
return { shown };
|
||||
}
|
||||
|
||||
async function checkDefaults({ github, context, core }) {
|
||||
const pull = context.payload.pull_request;
|
||||
if (isBot(pull.user)) return { skipped: 'bot' };
|
||||
@@ -132,10 +165,16 @@ async function syncDefaultLabel({ github, context, core }) {
|
||||
const { status } = parseDefaults(pull.body);
|
||||
const has = hasLabel(pull, DEFAULT_LABEL);
|
||||
const args = { ...context.repo, issue_number: pull.number };
|
||||
if (status === 'yes' && !has) {
|
||||
await github.rest.issues.addLabels({ ...args, labels: [DEFAULT_LABEL] });
|
||||
} else if (status !== 'yes' && has) {
|
||||
await github.rest.issues.removeLabel({ ...args, name: DEFAULT_LABEL });
|
||||
try {
|
||||
if (status === 'yes' && !has) {
|
||||
await github.rest.issues.addLabels({ ...args, labels: [DEFAULT_LABEL] });
|
||||
} else if (status !== 'yes' && has) {
|
||||
await github.rest.issues.removeLabel({ ...args, name: DEFAULT_LABEL });
|
||||
}
|
||||
} catch (e) {
|
||||
// A fork PR's token is read-only: say so instead of failing the check.
|
||||
if (e.status !== 403) throw e;
|
||||
core.notice(`Could not ${status === 'yes' ? 'add' : 'remove'} the ${DEFAULT_LABEL} label (read-only token); a maintainer sets it.`);
|
||||
}
|
||||
core.info(`Defaults line: ${status}`);
|
||||
}
|
||||
@@ -143,4 +182,5 @@ async function syncDefaultLabel({ github, context, core }) {
|
||||
module.exports = {
|
||||
DEFAULTS_ENFORCED_FROM, SKIP_LABEL, DEFAULT_LABEL, stripNoise, parseClosing, parseDefaults, isBot, isDocsOnly,
|
||||
findDuplicates, checkDuplicate, checkDefaults, syncDefaultLabel,
|
||||
PICTURE_ENFORCED_FROM, hasPicture, needsPicture, checkPicture,
|
||||
};
|
||||
|
||||
@@ -136,6 +136,18 @@ test('syncDefaultLabel adds and removes', async () => {
|
||||
assert.deepEqual(f.calls, [['remove', 'changes-default']]);
|
||||
});
|
||||
|
||||
test('syncDefaultLabel notes a read-only token instead of failing', async () => {
|
||||
const yes = 'Changes a default: yes — a, old behaviour kept behind preference p';
|
||||
const f = fakes(mk(1, 'a', yes));
|
||||
const notes = [];
|
||||
f.core.notice = (m) => notes.push(m);
|
||||
f.github.rest.issues.addLabels = async () => { throw Object.assign(new Error('Resource not accessible by integration'), { status: 403 }); };
|
||||
await pc.syncDefaultLabel(f);
|
||||
assert.equal(notes.length, 1);
|
||||
f.github.rest.issues.addLabels = async () => { throw Object.assign(new Error('server error'), { status: 500 }); };
|
||||
await assert.rejects(pc.syncDefaultLabel(f));
|
||||
});
|
||||
|
||||
test('checkDefaults only enforces from 2026-10-25', async () => {
|
||||
const files = [{ filename: 'crates/a.rs' }];
|
||||
const old = mk(20, 'alice', 'Fixes #5', { created_at: '2026-10-24T23:59:59Z' });
|
||||
@@ -146,3 +158,39 @@ test('checkDefaults only enforces from 2026-10-25', async () => {
|
||||
await pc.checkDefaults(f);
|
||||
assert.equal(f.failures.length, 1);
|
||||
});
|
||||
|
||||
test('hasPicture needs one a reader can see in the description', () => {
|
||||
assert.equal(pc.hasPicture(''), true);
|
||||
assert.equal(pc.hasPicture('<img width="960" alt="x" src="https://github.com/user-attachments/assets/abc" />'), true);
|
||||
assert.equal(pc.hasPicture('<video src="https://example.com/a.mp4"></video>'), true);
|
||||
assert.equal(pc.hasPicture('https://github.com/user-attachments/assets/abc'), true);
|
||||
assert.equal(pc.hasPicture(''), false);
|
||||
assert.equal(pc.hasPicture(null), false);
|
||||
assert.equal(pc.hasPicture('The GIF is the change.'), false);
|
||||
assert.equal(pc.hasPicture('See docs/screenshots/box.gif'), false);
|
||||
assert.equal(pc.hasPicture('<!--  -->'), false);
|
||||
assert.equal(pc.hasPicture('```\n\n```'), false);
|
||||
assert.equal(pc.hasPicture('``'), false);
|
||||
});
|
||||
|
||||
test('needsPicture covers the showcase and its media only', () => {
|
||||
assert.equal(pc.needsPicture(['docs/showcase.md']), true);
|
||||
assert.equal(pc.needsPicture(['crates/a.rs', 'docs/screenshots/a.gif']), true);
|
||||
assert.equal(pc.needsPicture(['docs/mcp.md', 'crates/a.rs']), false);
|
||||
});
|
||||
|
||||
test('checkPicture fails a showcase PR with no picture, from 2026-11-02 on', async () => {
|
||||
const files = [{ filename: 'docs/showcase.md' }];
|
||||
const pr = mk(30, 'alice', 'The GIF is the change.', { created_at: '2026-11-02T00:00:00Z' });
|
||||
let f = fakes(pr, { files });
|
||||
assert.deepEqual(await pc.checkPicture(f), { shown: false });
|
||||
assert.equal(f.failures.length, 1);
|
||||
f = fakes({ ...pr, body: '' }, { files });
|
||||
assert.deepEqual(await pc.checkPicture(f), { shown: true });
|
||||
assert.equal(f.failures.length, 0);
|
||||
f = fakes({ ...pr, created_at: '2026-11-01T23:59:59Z' }, { files });
|
||||
assert.deepEqual(await pc.checkPicture(f), { skipped: 'opened before enforcement' });
|
||||
f = fakes(pr, { files: [{ filename: 'crates/a.rs' }] });
|
||||
assert.deepEqual(await pc.checkPicture(f), { skipped: 'nothing to show' });
|
||||
assert.equal(f.failures.length, 0);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Checks the design-format change files (crates/doc/src/format/): two branches that each add a
|
||||
# pending change merge without a conflict, and the release fold moves both into the next number.
|
||||
# A drawing-format change (crates/doc/src/drawing/format/) folds into the drawing's own next number.
|
||||
# The order they apply in and the upgrades themselves are tested in crates/doc/src/format.rs.
|
||||
set -euo pipefail
|
||||
|
||||
@@ -8,11 +9,12 @@ root=$(git rev-parse --show-toplevel)
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
repo="$tmp/repo"
|
||||
mkdir -p "$repo/crates/doc/src" "$repo/scripts"
|
||||
mkdir -p "$repo/crates/doc/src/drawing" "$repo/scripts"
|
||||
cp -r "$root/crates/doc/src/format" "$repo/crates/doc/src/"
|
||||
cp -r "$root/crates/doc/src/drawing/format" "$repo/crates/doc/src/drawing/"
|
||||
cp "$root/crates/doc/build.rs" "$repo/crates/doc/"
|
||||
cp "$root/scripts/fold-format-pending.sh" "$repo/scripts/"
|
||||
rm -f "$repo"/crates/doc/src/format/pending/*.rs # start from a release: nothing pending
|
||||
rm -f "$repo"/crates/doc/src/format/pending/*.rs "$repo"/crates/doc/src/drawing/format/pending/*.rs # start from a release: nothing pending
|
||||
git() { command git -C "$repo" -c user.name=test -c user.email=test@example.com "$@"; }
|
||||
git init -q -b main
|
||||
git add -A
|
||||
@@ -20,12 +22,13 @@ git commit -qm base
|
||||
|
||||
change() {
|
||||
git switch -q -c "$1" main
|
||||
printf '//! %s\n' "$1" > "$repo/crates/doc/src/format/pending/$1.rs"
|
||||
printf '//! %s\n' "$1" > "$repo/crates/doc/src/${2:-format}/pending/$1.rs"
|
||||
git add -A
|
||||
git commit -qm "$1"
|
||||
}
|
||||
change b-second
|
||||
change a-first
|
||||
change c-drawing drawing/format
|
||||
|
||||
git switch -q main
|
||||
if ! tree=$(git merge-tree --write-tree a-first b-second); then
|
||||
@@ -36,12 +39,18 @@ git merge -q --no-edit a-first b-second >/dev/null
|
||||
listed=$(git ls-tree --name-only HEAD crates/doc/src/format/pending/ | grep '\.rs$' | sed 's#.*/##' | tr '\n' ' ')
|
||||
[ "$listed" = "a-first.rs b-second.rs " ] || { echo "FAIL: merged pending changes are: $listed" >&2; exit 1; }
|
||||
[ "$tree" = "$(git rev-parse HEAD^{tree})" ] || { echo "FAIL: merge-tree and merge disagree" >&2; exit 1; }
|
||||
git merge -q --no-edit c-drawing >/dev/null
|
||||
|
||||
before=$(ls -d "$repo"/crates/doc/src/format/v*/ 2>/dev/null | wc -l)
|
||||
drawings=$(find "$repo/crates/doc/src/drawing/format" -mindepth 1 -maxdepth 1 -type d -name 'v*' | wc -l)
|
||||
(cd "$repo" && bash scripts/fold-format-pending.sh) > "$tmp/fold.log"
|
||||
after=$(ls -d "$repo"/crates/doc/src/format/v*/ | sort -V | tail -1)
|
||||
[ "$(ls -d "$repo"/crates/doc/src/format/v*/ | wc -l)" -eq $((before + 1)) ] || { echo "FAIL: the fold made no new version" >&2; exit 1; }
|
||||
[ "$(ls "$after")" = "$(printf 'a-first.rs\nb-second.rs')" ] || { echo "FAIL: the fold moved $(ls "$after")" >&2; exit 1; }
|
||||
[ -z "$(ls "$repo/crates/doc/src/format/pending/" | grep '\.rs$' || true)" ] || { echo "FAIL: pending changes left after the fold" >&2; exit 1; }
|
||||
(cd "$repo" && bash scripts/fold-format-pending.sh) | grep -q "No pending format changes" || { echo "FAIL: a second fold did something" >&2; exit 1; }
|
||||
echo "ok: pending format changes merge cleanly and fold into $(basename "$after")"
|
||||
# A drawing's formats start at 1, so its folded ones are v2/, v3/ and so on: the next is its own, never the design's.
|
||||
drawing_next="$repo/crates/doc/src/drawing/format/v$((drawings + 2))"
|
||||
[ "$(ls "$drawing_next" 2>/dev/null)" = c-drawing.rs ] || { echo "FAIL: the drawing change did not fold into ${drawing_next##*/}/" >&2; exit 1; }
|
||||
second=$(cd "$repo" && bash scripts/fold-format-pending.sh)
|
||||
grep -q "No pending format changes" <<< "$second" && ! grep -q "now fixed" <<< "$second" || { echo "FAIL: a second fold did something" >&2; exit 1; }
|
||||
echo "ok: pending format changes merge cleanly and fold into $(basename "$after"), a drawing's into ${drawing_next##*/}"
|
||||
|
||||
@@ -30,7 +30,7 @@ const NOT_A_BUG = /^\s*\[(feat|feature|change|enhancement)|feature request|sugge
|
||||
const APP_TITLE = /^([A-Z][A-Z ]+|Modeling|Part|Sketch|Surface|Sheet Metal|Plastic|Mesh|Render):\s*\S/;
|
||||
// A report this long describes what it saw; only short ones are asked.
|
||||
const SHORT = 300;
|
||||
const ATTACHMENT = /user-attachments\/|\.solidcraft\b|repro\.json|\.(step|stp|3mf|stl)\b/i;
|
||||
const ATTACHMENT = /user-attachments\/|\.(sc|solidcraft)\b|repro\.json|\.(step|stp|3mf|stl)\b/i;
|
||||
const COMMAND = /["`][a-z_]+\.[a-z_][a-z_.]*["`]/;
|
||||
const VERSION = /\b\d+\.\d+\.\d+\b|\b[0-9a-f]{7,40}\b/i;
|
||||
|
||||
@@ -61,7 +61,7 @@ function askBody(asks) {
|
||||
const lines = ['Thanks for the report! To reproduce it we need a little more:'];
|
||||
lines.push(
|
||||
'- **Steps to reproduce**: what you clicked or typed, in order. For a problem on a particular design, ' +
|
||||
'`solidcraft-cli script design.solidcraft --out repro.json` turns its history into a script; attach that, or the design.',
|
||||
'`solidcraft-cli script design.sc --out repro.json` turns its history into a script; attach that, or the design.',
|
||||
);
|
||||
if (asks.includes('version')) lines.push('- **SolidCraft version** (Help → About) and your OS.');
|
||||
lines.push(
|
||||
|
||||
@@ -54,6 +54,7 @@ test('missing: empty app reports are asked to paste the copied report', () => {
|
||||
|
||||
test('missing: reproducible, long, app-filed and non-bug issues are left alone', () => {
|
||||
assert.deepEqual(info.missing('Loft fails', '## Reproduction\n1. sketch two circles\n2. loft them'), []);
|
||||
assert.deepEqual(info.missing('Loft fails', 'see design.sc attached'), []);
|
||||
assert.deepEqual(info.missing('Loft fails', 'see design.solidcraft attached'), []);
|
||||
assert.deepEqual(info.missing('Loft fails', 'runs `solid.loft` and fails'), []);
|
||||
assert.deepEqual(info.missing('Loft fails', long), []);
|
||||
|
||||
Reference in New Issue
Block a user