Skip to content

chore: add tools/check-local.sh foundation gate - #123

Merged
DrunkOnJava merged 1 commit into
mainfrom
chore/foundation-clean
Aug 29, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
chore/foundation-clean

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

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

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets --all-features -- -D warnings passes
  • src/formats.rs retains contains_key("Unreachable") (no get(...).is_none() regression)
  • tools/check-local.sh --help / bash -n OK
  • Optional flags without prerequisites exit non-zero with clear errors (--audit, --deny, --corpus, --ifcopenshell)
  • Full tools/check-local.sh passed (766 lib unit tests + workspace targets; check-local: all requested gates passed)
  • New / changed code has unit tests — N/A (shell + docs)
  • IFC exporter unchanged — N/A
  • Element decoder unchanged — N/A
  • Performance change — N/A

Audit-honesty checklist

  • README / docs reflect current state — CONTRIBUTING updated; no new capability claims
  • No private paths / emojis / internal jargon
  • Commit messages describe what and why

Legal and contribution hygiene

  • Licensable under Apache-2.0
  • No Autodesk proprietary source
  • 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).

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]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

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.

Create PR

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
 fi

You 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.

Comment thread tools/check-local.sh
else
echo "==> wasm network-import audit skipped (wasm-objdump or viewer/pkg missing)"
fi
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6898fc4. Configure here.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review August 29, 2026 10:06
@DrunkOnJava
DrunkOnJava merged commit 0fd2ef1 into main Aug 29, 2026
22 checks passed
@DrunkOnJava
DrunkOnJava deleted the chore/foundation-clean branch August 29, 2026 10:07
DrunkOnJava added a commit that referenced this pull request Aug 31, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants