Repository navigation
feat(id/web): trusted form widgets for presented forms (#8938, web half) - #11324
Conversation
The web ID client projected every presented form as text, so a user could not complete or cancel one. Add a manifest-gated presenter that mirrors the SSH reference in pkgs/id/crates/id-worlds/src/world_ssh.rs: - renders widgets only from this browser's own input manifest plus the closed field/action model — no markup from the presenting program; - sends form_result with the view's form_id and presentation_token on submit and on cancel (cancel carries no values, as the SSH presenter); - handles form_result_status by re-presenting with the returned token, preserving a retry alias when the program redraws with its old token; - falls back to the escape-free text projection when the document is invalid or this presenter cannot collect every field. Tests cover submit, cancel, token rotation, retry-alias redraw, the untrusted-manifest refusal, and the projection.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
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. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Scheduled lane code-f resumed task 20240, verified this PR remains canonical and web-only, and parked it again for the native-shell half. No files changed. Resume in |
… native half) (#11434) The native shell projected every presented form as text: its session layer had no form handling at all, so a form_result could never be sent and a presented form was a dead end (the web half landed in PR #11324; the SSH terminal is the third presenter). Add a pure FormPresenter (src/form.rs) mirroring world_ssh.rs: - widgets are built only from this client's own input manifest plus the closed FormField/FormAction model (no markup from the program); - a form without a presentation token, or one whose fields this presenter's manifest cannot collect, renders no actionable widget and falls back to the surface's escape-free text projection; - form_result_frame carries the view's form_id and current presentation_token; a cancel sends no values (reference behaviour); - settle() mirrors the SSH token rotation, including the retry alias so a redraw carrying the program's stale token keeps the host's token. session.rs now validates and retains form_result_status (the contract already names it), render.rs renders widget lines through a new PresentedForm resource, and main.rs folds each drained view through the presenter. Tests: tests/form_widgets.rs drives real session frames — submit and cancel frame identity, rejection re-presents with the returned token and the next answer uses it, and an untrusted manifest renders nothing. Unit tests cover the presenter, and render tests prove a trusted form draws widgets while an untrusted one falls back to text. Co-authored-by: repo-worker-code <worker@developing.today>
Partial: web form widgets for #8938.
The web ID client projected every presented form as text, so a user could not complete or cancel one. This adds
pkgs/id/web/src/world-form.ts, a manifest-gated presenter mirroring the SSH reference inpkgs/id/crates/id-worlds/src/world_ssh.rs:form_resultwith the view'sform_idandpresentation_token(cancel carries no values, as the SSH presenter does);form_result_statusacceptance clears the widget; a rejection carrying a fresh token re-presents with that token, and a redraw that still carries the program's old token keeps the host-issued retry token active;world.tswires the presenter into theviewand the newform_result_statusframe, replacing the screen surface when a form arrives and leaving ordinary screen/text redraws untouched.Tests
cd pkgs/id/web && ./node_modules/.bin/vitest run— 838 passed, 9 skipped. Newsrc/world-form.test.tscovers submit, cancel, token rotation, the retry-alias redraw, untrusted-manifest refusal and the projection.tsc --noEmitandbiome checkclean.Not in this PR
The native-shell presenter (
pkgs/id/crates/id-native-shell) — the second half of #8938. Tracking it as the follow-up half of the same task; the web client is one of the two shipped clients named in the issue, and the contract shapes here are the ones the native presenter must match.Refs #8938
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.