Skip to content

feat: native frequency controls and exports (supersedes #77, targets main) - #80

Closed
KaguraSayuki wants to merge 5 commits into
mainfrom
claude/great-hamilton-8abp87
Closed

KaguraSayuki wants to merge 5 commits into
mainfrom
claude/great-hamilton-8abp87

Conversation

@KaguraSayuki

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #77 and targets main (#75 is merged). It contains #77's two commits unchanged (b8d6ebb by @yyywaa from #76, and ec0e03a), plus three commits that address the requested changes in the #77 review and CodeRabbit's open comments.

1. PNG export was disabled; WebM never started (e3cb28a)

  • PNG: Trajectory spreads a fresh structure_props object into Structure. That reset Structure's unbound wrapper bindable prop to undefined, so StructureExportPane never saw the canvas, and Download PNG stayed disabled from the start. Structure now passes its rendered element to child panes; the bindable prop is still synced for parents that bind it.
  • WebM (this step was never reached before): TrajectoryExportPane computed canvas as a $derived of wrapper.querySelector('canvas'). That ran once, before the canvas existed, so the pane reported "Canvas not ready". The pane now tracks the canvas with the same DOM observer that sets has_canvas.

2. A successful save was reported as interrupted (e3cb28a)

  • Both export panes now guard only before submitting a save. A save already sent to the host (saved, cancelled or failed) is reported as the host returned it.
  • finish_export treats an AbortError during restore as "nothing to restore", so cleanup can no longer replace a completed result with an interruption.
  • WebM no longer races the submitted save against the pane's abort signal.
  • The companion MTL of an OBJ export is still refused for a replaced owner, and the error says the OBJ was saved but the MTL was not.

3. Existing test:frequency camera check regressed (e3cb28a)

This regression was already present in #77, and CI would have caught it after retargeting. FrequencyViewer rebuilt its on_download sink on every mode change. Trajectory then re-spread Structure's props, which reset the native camera zoom (244 → 227 in the "switching modes must preserve the camera" check). The viewer now passes one stable sink. On the same machine, test:frequency passes 7/7 on the #75 base, fails on the #77 head, and passes 7/7 on this branch.

4. CodeRabbit findings

  • Long filenames (e3cb28a): the stem of generated structure filenames is now capped at 96 characters, so they fit the host's 128-byte limit with a DPI suffix and extension. OBJ and MTL share the stem, so the mtllib reference still matches.
  • No silent replace of adjusted paths (3f946ee): when the host appends a suffix the dialog never confirmed, it creates the file exclusively with create_new, so a file that appears after the existence check is never replaced. Paths the dialog confirmed keep the atomic temp-file-and-rename write.
  • Docs: the "interrupted" limitation note is no longer needed; the save semantics are documented in docs/frequency-viewer.md.

5. CI (6151b9b)

Vendor archive

The freq2 patch and archive are regenerated reproducibly from the retained freq1 archive. Before editing, the recipe reproduced both existing files byte for byte. The changed-file allowlist is the same, and the lockfile integrity is updated. vendor-frequency.test.ts passes.

Validation

All runs are local, on Node 24.11.1, pnpm 11.5.0 and Rust 1.88.0 (the CI versions).

  • Frontend: pnpm test 337 passed, 1 pre-existing skip. svelte-check 0 errors. VITE_MATTERVIZ_PRERELEASE_UPDATER=1 pnpm build passed.
  • New tests/frequency-export-transaction.test.ts runs the exact production code of the export pane, the Trajectory transaction and the native sink together. It covers saved, cancelled and failed results after an owner change, OBJ saved then owner change (MTL not submitted), MTL cancelled or failed (partial result), owner change before submission (refused), WebM after an owner change plus pane abort, and long-formula filenames. 4 of its 6 tests fail on the feat: native frequency controls and exports, with review fixes (supersedes #76) #77 archive; all pass here.
  • Browser, real Chromium: test:frequency 7/7. test:frequency-controls 7/7, which now includes PNG bytes, WebM frame geometry plus camera/step restore, resume after export, and a new check that a save completed after a mode change is reported as saved. In that browser test the save endpoint is stubbed at the HTTP boundary.
  • Rust desktop crate (GTK/WebKit dev libraries installed): cargo fmt --check, cargo test --locked (167 passed), cargo clippy -D warnings and cargo build --release all passed.
  • Rust headless harness: 171 passed, including a new test where a file appears at the adjusted path after the check and is not replaced. fmt and clippy are clean.
  • GTK helper: noGUI/matterviz_file_dialog.c builds with -Wall -Wextra -Werror.
  • Native dialog, Linux GTK only: driven under Xvfb with xdotool, invoked the way file_dialog.rs invokes it. Accept returns the path (exit 0). Escape returns exit 1. On an existing file the overwrite confirmation appears; Replace returns the path and Cancel returns exit 1. A name with the suffix removed comes back without the suffix, which confirms the host-side append is needed.
  • Not validated: macOS and Windows native save dialogs, and the full packaged app writing through a real dialog end to end.

Generated by Claude Code

yyywaa and others added 5 commits October 24, 2026 02:55
Add CJSON queues, displacement arrows, native export transactions and
bounded workbench save handling on top of the native frequency viewer.

Includes export ownership, pre-auth body limits and async API regressions.
Snapshot matches locally reviewed tree 0b05285ca7ca07af7127feebfbae898ba4f657da.
Review fixes on top of the native frequency controls PR:

- Save sink: an abort only prevents new submissions. The in-flight request
  is no longer aborted and a host "saved" result is no longer turned into
  an AbortError, since the native dialog cannot be cancelled from the page.
- Displacement arrows use the mode's constant peak excursion instead of the
  per-frame shift, which was zero on the default equilibrium frame.
- Host: viewer save dialogs use their own mutex instead of the workflow
  execution gate, so batch control is not blocked while a dialog is open.
- Host: write via a sibling temporary file and rename, so a failed write
  never truncates an overwritten file.
- Host: append the expected suffix when the chooser returns a name without
  it, refusing to replace an unconfirmed existing file.
- Host: drop the route-level re-validation duplicated from the pre-body
  header check; save_with now distinguishes invalid (400) from failed (500).
- Remove the invalid allowBuilds key that made pnpm 11.5.0 reject the
  workspace; the existing `matterviz: true` entry covers the package.
- Structure passes its rendered element to child panes. Trajectory spreads
  fresh structure_props, which reset Structure's unbound `wrapper` prop to
  undefined, so the export pane never saw the canvas and PNG stayed disabled.
- The trajectory export pane tracks its canvas with the DOM observer instead
  of a derived query that ran once before the canvas existed ("Canvas not
  ready" for WebM).
- Export panes guard only before submitting a save. A submitted native save
  (saved, cancelled or failed) is reported as returned, even if the mode
  changed meanwhile; restore-time AbortErrors no longer replace that result,
  and OBJ's companion MTL is still refused for a replaced owner.
- WebM no longer races its submitted save against the abort signal.
- Bound structure filename stems to 96 characters so long formulas fit the
  host's 128-byte limit; OBJ and MTL share the bounded stem.
- FrequencyViewer passes one stable save sink. Recreating it per mode change
  re-spread Structure's props and reset the native camera zoom, failing the
  existing test:frequency camera check.

The freq2 patch and archive are regenerated reproducibly from freq1 (same
file allowlist); the lockfile integrity is updated. New
frequency-export-transaction tests run the exact pane, Trajectory transaction
and native sink code together; they fail on the previous archive.
test:frequency-controls now completes PNG and WebM and checks a save that
completes after a mode change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0195VKS46ScdD4A2Ai3skx3k
When the chooser returns a name without the expected suffix, the host appends
it. The dialog never confirmed that adjusted path, so it is now created
exclusively (create_new) instead of renamed over the target; a file that
appears after the existence check is never replaced. Paths the dialog
confirmed keep the atomic temporary-file-and-rename write.

Also apply rustfmt to the viewer export changes, which failed the
matterviz-gui `cargo fmt --check` step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0195VKS46ScdD4A2Ai3skx3k
Run `pnpm test:frequency-controls` after `test:frequency` in matterviz-gui and
upload its failure artifacts. Document that submitted native saves are
reported as returned, the bounded filenames, the exclusive write for adjusted
names, the canvas fixes and the current validation coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0195VKS46ScdD4A2Ai3skx3k
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@KaguraSayuki

Copy link
Copy Markdown
Collaborator Author

Superseded by #81: the same commits, moved to a branch without the claude/ prefix.


Generated by Claude Code

@KaguraSayuki
KaguraSayuki deleted the claude/great-hamilton-8abp87 branch November 7, 2026 02:54
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.

3 participants