Repository navigation
chore: add tools/check-local.sh foundation gate - #123
Conversation
Provide a developer-friendly fmt/clippy/docs/test gate with optional viewer, corpus, ifcopenshell, deny, and audit flags. Point CONTRIBUTING.md at the new script. formats.rs already uses contains_key (clippy unnecessary_get_then_check) so no code change was required there. Co-authored-by: DrunkOnJava <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Viewer gate skips WASM package
- The --viewer gate now requires wasm-pack, builds viewer/pkg via wasm-pack before npm typecheck/build, and audits the freshly built WASM binary.
Or push these changes by commenting:
@cursor push d5fafde669
Preview (d5fafde669)
diff --git a/tools/check-local.sh b/tools/check-local.sh
--- a/tools/check-local.sh
+++ b/tools/check-local.sh
@@ -109,14 +109,18 @@
# --- optional gates ---------------------------------------------------------
if [[ "$run_viewer" -eq 1 ]]; then
+ require_cmd wasm-pack "Install wasm-pack (see AGENTS.md or .cursor/install.sh)."
if [[ ! -d viewer/node_modules ]]; then
echo "error: viewer/node_modules is missing." >&2
echo " From viewer/: run 'npm ci' once (network), then re-run with --viewer." >&2
exit 1
fi
+ run wasm-pack build --target web -- --features wasm --no-default-features
+ rm -rf viewer/pkg
+ mv pkg viewer/pkg
run npm --prefix viewer run typecheck
run npm --prefix viewer run build
- if command -v wasm-objdump >/dev/null 2>&1 && [[ -f viewer/pkg/rvt_bg.wasm ]]; then
+ if command -v wasm-objdump >/dev/null 2>&1; then
printf '\n==> wasm network-import audit\n'
if wasm-objdump -j Import -x viewer/pkg/rvt_bg.wasm \
| grep -iE '"(fetch|XMLHttpRequest|WebSocket|EventSource|sendBeacon)"' >/dev/null; then
@@ -125,7 +129,7 @@
fi
echo "PASS: no network imports"
else
- echo "==> wasm network-import audit skipped (wasm-objdump or viewer/pkg missing)"
+ echo "==> wasm network-import audit skipped (wasm-objdump not installed)"
fi
fiYou can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6898fc4. Configure here.
| else | ||
| echo "==> wasm network-import audit skipped (wasm-objdump or viewer/pkg missing)" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
Viewer gate skips WASM package
Medium Severity
--viewer only requires viewer/node_modules, then runs npm typecheck/build and an optional wasm import audit. Those steps need viewer/pkg from wasm-pack, which is gitignored and never built here. After the documented npm ci, typecheck fails on the missing ../pkg/rvt.js import, and the audit is skipped or checks a stale binary.
Reviewed by Cursor Bugbot for commit 6898fc4. Configure here.
## Summary
Lane One (foundation) cleanup: add a developer-friendly local quality
gate and document it for contributors.
## Motivation
Refs the M0-04 intent in `TODO.md` (`tools/check-local.sh` as the
day-to-day local gate). `tools/quality.sh` remains the fuller pre-push
path. The historical `clippy::unnecessary_get_then_check` site in
`src/formats.rs` is already fixed on `main`
(`assert!(!m.contains_key("Unreachable"))`); this PR verifies clippy
stays clean rather than re-touching that file.
## Changes
- Add `tools/check-local.sh` — always runs fmt check, clippy `-D
warnings`, rustdoc `-D warnings`, and workspace tests
- Optional flags: `--viewer`, `--corpus`, `--ifcopenshell`, `--deny`,
`--audit`, `--all-optional` (no network by default; missing
prerequisites fail clearly)
- Update `CONTRIBUTING.md` to point contributors at
`tools/check-local.sh`
## Testing
- [x] `cargo fmt --all -- --check` passes
- [x] `cargo clippy --workspace --all-targets --all-features -- -D
warnings` passes
- [x] `src/formats.rs` retains `contains_key("Unreachable")` (no
`get(...).is_none()` regression)
- [x] `tools/check-local.sh --help` / `bash -n` OK
- [x] Optional flags without prerequisites exit non-zero with clear
errors (`--audit`, `--deny`, `--corpus`, `--ifcopenshell`)
- [x] Full `tools/check-local.sh` passed (766 lib unit tests + workspace
targets; `check-local: all requested gates passed`)
- [x] New / changed code has unit tests — N/A (shell + docs)
- [x] IFC exporter unchanged — N/A
- [x] Element decoder unchanged — N/A
- [x] Performance change — N/A
## Audit-honesty checklist
- [x] README / docs reflect current state — CONTRIBUTING updated; no new
capability claims
- [x] No private paths / emojis / internal jargon
- [x] Commit messages describe what and why
## Legal and contribution hygiene
- [x] Licensable under Apache-2.0
- [x] No Autodesk proprietary source
- [x] No new fixtures / PII
## Breaking changes
None.
## Screenshots or output samples
N/A (non-UI).
## Related issues
Refs #12 (M0-04; previously closed via `quality.sh` — this lands the
named `check-local.sh` entry point). Refs #10 (M0-02 clippy; already
fixed on main).
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: DrunkOnJava <[email protected]>



Summary
Lane One (foundation) cleanup: add a developer-friendly local quality gate and document it for contributors.
Motivation
Refs the M0-04 intent in
TODO.md(tools/check-local.shas the day-to-day local gate).tools/quality.shremains the fuller pre-push path. The historicalclippy::unnecessary_get_then_checksite insrc/formats.rsis already fixed onmain(assert!(!m.contains_key("Unreachable"))); this PR verifies clippy stays clean rather than re-touching that file.Changes
tools/check-local.sh— always runs fmt check, clippy-D warnings, rustdoc-D warnings, and workspace tests--viewer,--corpus,--ifcopenshell,--deny,--audit,--all-optional(no network by default; missing prerequisites fail clearly)CONTRIBUTING.mdto point contributors attools/check-local.shTesting
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets --all-features -- -D warningspassessrc/formats.rsretainscontains_key("Unreachable")(noget(...).is_none()regression)tools/check-local.sh --help/bash -nOK--audit,--deny,--corpus,--ifcopenshell)tools/check-local.shpassed (766 lib unit tests + workspace targets;check-local: all requested gates passed)Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None.
Screenshots or output samples
N/A (non-UI).
Related issues
Refs #12 (M0-04; previously closed via
quality.sh— this lands the namedcheck-local.shentry point). Refs #10 (M0-02 clippy; already fixed on main).