You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
INSERT: Verify and Preset attributes, ATTREQ and ATTDIA with the Edit Attributes dialog (F17) - #2376
Before: attribute definitions keep their Verify and Preset modes (read and written since 2026-10-12), but INSERT ignored them: a Verify attribute was asked once and a Preset one was asked like any other. There was no ATTREQ or ATTDIA, so a typed INSERT always asked every value at the command line, one by one, and couldn't be told to take the defaults. INSERT also counted its answers by tag, so a block with two definitions of one tag asked the second prompt for ever.
After: a typed or menu INSERT asks a Verify attribute's value twice ("Verify attribute value :", Enter keeps it, a new value replaces it), gives Preset (and constant) attributes their defaults without asking, and follows two new user settings:
ATTREQ 0 gives every attribute its default without asking (1, the default, asks).
ATTDIA 1 (AutoCAD's default) asks for the values in an Edit Attributes dialog: block name, one field per prompt filled with the default, OK (or Enter in a field) and Cancel. Values typed at the command line still work; the dialog goes away after the first one. ATTDIA 0 asks at the command line.
The JSON form (insert {attribs}), scripts' answers and every programmatic call never open the dialog.
ATTREQ and ATTDIA are user settings (SETVAR, Settings), not drawing header variables: DWG keeps them in its header only before R2000 (ODA specification, "R13-R14 only"), so AutoCAD keeps them per user.
How:InsertM (crates/engine/src/cmd/blocks.rs) collects the attributes it asks for as AttribAsk {tag, prompt, default, verify}, counts answers instead of looking at the values map, and holds a pending Verify value. A new Interactive::attribute_entry hook (run under the panic guard, exposed as Session::attribute_entry) returns the block and those rows while INSERT waits for its first value with ATTDIA 1; AttribEntry::answers turns the dialog's values into the inputs INSERT expects (a Verify value twice), so the dialog (crates/ui-egui/src/attentry.rs, shown from dialogs::show like the MTEXT editor) only feeds session.input. ATTREQ and ATTDIA are Settings toggles in the SETVAR table. Italian and Ukrainian strings for the dialog.
Tests:
engine/tests/it/insert_attrib_entry.rs (new): Verify asked twice and Preset/constant skipped, typed and from a script; ATTREQ 0 takes the defaults; ATTDIA 1 exposes the rows, answers and typed answers both finish the insert, Cancel inserts nothing; JSON inserts never ask; hostile SETVAR values refused and short/long answer lists handled; two definitions with one tag are each asked once (on main INSERT counted answers by tag and asked the second for ever).
ui-egui/tests/it/insert_attrib_dialog.rs (new, egui_kittest with real events): OK gives the edited values, Enter in a field is OK and a Verify attribute isn't asked again, Cancel inserts nothing, no dialog with ATTDIA 0 or from JSON.
cargo test -p cadcraft-engine, cargo test -p cadcraft-ui-egui, cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings -A deprecated (origin/main itself fails plain -D warnings on the deprecated Ui::id in crates/ui-egui/src/palettes.rs:741 and on xtask's unused walk import, neither touched here), xtask layers, xtask assets, cargo check --target wasm32-unknown-unknown on engine and ui-egui.
Related open PRs: #1729 (ATTDEF dialog and modes) creates Verify/Preset definitions this PR then honours; #993 (no grips on locked attributes) covers Lock position. Not here: the dialog's Previous/Next pages (one scrolling list instead), and keeping ATTREQ/ATTDIA in the preferences file across sessions (they live in Settings, like AUDITCTL).
… Attributes dialog (F17)
A typed or menu INSERT asks a Verify attribute's value twice and gives
Preset (and constant) attributes their defaults without asking. ATTREQ 0
gives every attribute its default; ATTDIA 1 (the default) asks for the
values in an Edit Attributes dialog, typed answers still working. Both are
user settings, as DWG keeps them in its header only before R2000. Answers
are counted per prompt, so two definitions with one tag no longer ask the
second for ever. The JSON form never asks.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewing files that changed from the base of the PR and between 0332836 and d3ec8ef.
Files selected for processing: 6
crates/engine/src/settings.rs
crates/engine/src/sysvars/table.rs
crates/engine/tests/it/insert_attrib_entry.rs
crates/ui-egui/tests/it/insert_attrib_dialog.rs
docs/gaps.md
docs/ui-parity.md
Files skipped from review as they are similar to previous changes: 3
crates/engine/src/sysvars/table.rs
docs/ui-parity.md
docs/gaps.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
INSERT now supports attribute defaults, Verify prompts, and the ATTREQ and ATTDIA settings. When ATTDIA enables dialog entry, the UI displays eligible attributes and submits edited answers to the active INSERT command.
Changes: INSERT attribute entry
Layer / File(s)
Summary
Attribute-entry contract and settings crates/engine/src/prompt.rs, crates/engine/src/settings.rs, crates/engine/src/sysvars/table.rs, crates/engine/src/session/interactive.rs, crates/engine/src/guard.rs, crates/engine/src/lib.rs
The prompt API defines attribute rows and answer expansion. Settings and system-variable mappings add ATTREQ and ATTDIA. Session and Guarded expose the active command’s attribute-entry data.
INSERT applies ATTREQ and ATTDIA, skips constant and preset attributes, and supports Verify confirmation. Integration tests and documentation describe the prompt and setting behavior.
Attribute dialog and UI integration crates/ui-egui/src/attentry.rs, crates/ui-egui/src/dialogs.rs, crates/ui-egui/src/lib.rs, crates/ui-egui/tests/it/insert_attrib_dialog.rs, crates/ui-egui/tests/it/main.rs
The dialog displays attribute rows, submits edited answers, and cancels the session when requested. UI tests cover confirmation, Verify rows, cancellation, and cases where no dialog appears.
No concrete merge-blocking risk was established by the reviewed change.
Security architecture risk: Low · up to d3ec8
The new dialog uses existing command-input and document-update paths without demonstrating additional privileges or a new remote attack path. A bounded lifecycle weakness remains: canceled dialog edits can carry into a replacement INSERT when both commands occur between dialog updates.
Retained concerns
Low · reliability · inferred: Pending dialog edits are not bound to a particular INSERT instance. The UI reuses them when block name and row count match. Queued control requests can cancel an INSERT and advance its replacement before the next dialog update, allowing edits belonging to the canceled command to populate and subsequently be submitted to the replacement. Ordinary cancellation clears state when the dialog observes no pending entry, but that intermediate observation is not guaranteed. This is a bounded command-state ownership and cleanup weakness; no privilege escalation or cross-tenant exposure was established.
Security review details
Security Blast Radius
inferred — The demonstrated new exposure is within the active application session: drawing attribute metadata is displayed and submitted values become inserted attributes. The inspected paths do not establish new service, credential, environment or tenant authority. The lifecycle concern is limited to matching replacement INSERT dialogs; cross-document disclosure was not demonstrated.
Trust Boundaries and Controls
observed — The presentation boundary does not gain direct document-mutation authority. Session delegates metadata access through guarded command dispatch, and dialog answers return through the normal input path. Programmatic INSERT still calls its JSON handler, while the existing control interface documents that execution path as dialog-free.
Resilience and Maintainability Implications
inferred — Cancellation cleanup depends on the dialog observing an absent entry, rather than receiving a command-lifecycle identity change. Because the control queue drains multiple requests before rendering, the intermediate canceled state can be missed. This weakens isolation between successive command instances without demonstrating an authorization bypass.
Hardening Proposals
proposed — Bind pending dialog state and answer submission to a command-generation identity, or invalidate stored state directly on command replacement. This would prevent canceled edits from being inherited even when cancellation and replacement occur between rendered frames.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 41.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly identifies the main INSERT changes: Verify and Preset attribute handling, ATTREQ and ATTDIA settings, and the Edit Attributes dialog.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 41.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 17 functions across 14 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Clippy (1.99.0)
Clippy execution timed out
Comment @coderabbitai help to get the list of available commands.
The reason will be displayed to describe this comment to others. Learn more.
Tested on Windows 10 Pro x64 (Rust 1.99.1, cargo-nextest 0.9.150), with this PR merged onto current main (336243e). It merges cleanly and compiles there, and it works.
The 10 insert_attrib tests pass: the engine's insert_attrib_entry and the dialog tests in insert_attrib_dialog, including Verify being asked once in the dialog and no dialog with ATTDIA 0 or from JSON.
cargo xtask ci passes all 7 steps (2629 tests) with this PR merged onto main together with #2377, which I tested at the same time (I kept one side of their docsGATE_LINEgaps.md conflict on my test branch), and #2198 so the gate runs on Windows.
Counting answers per definition instead of per tag, so a block with two definitions of one tag stops asking the second prompt forever, is worth having on its own, apart from the new modes.
Two things:
ATTDIA's default. The description calls 1 AutoCAD's default. Several third-party references give ATTDIA's initial value as 0 (prompts at the command line), at least for older releases. If 1 comes from observing a current AutoCAD, a line saying so would settle it. If not, 0 would keep a typed INSERT at the command line as before, which also suits scripts and agents typing through MCP's command_line.
This conflicts with #2381 (MLEADER block attributes) in crates/engine/src/cmd/blocks.rs: that PR moves INSERT's attribute placement into blocks::reference_attribs, and this one changes the same code. Whichever lands second needs to carry its change into the other's shape. Both also touch docs/gaps.md.
AutoCAD's published system variable reference gives ATTDIA an initial
value of 0: a typed INSERT asks for attribute values at the command line,
which also keeps scripts and agents typing through the command line as
before. ATTDIA 1 still opens the Edit Attributes dialog. The dialog tests
set ATTDIA 1 themselves; a new check shows the default opens no dialog.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Still approving at d3ec8ef. ATTDIA's initial value is 0 in AutoCAD, so INSERT asking at the command line by default is right. The tests now cover both defaults (ATTDIA 0, ATTREQ 1) and set ATTDIA 1 where they need the dialog.
cargo xtask ci passes with this merged onto current main, together with #2347 and #2377: all 7 steps, 2646 tests. One small thing: the module comment at the top of insert_attrib_entry.rs now has a line well over 100 characters, which rustfmt won't wrap.
@francescoBV I merged current main into this branch in #3411, keeping all of your commits as they are. main gained ATTREQ, Preset and Verify in #2535 while this was open, so the branch now adds ATTDIA, the Edit Attributes dialog and the per-definition answer count on top of it. The repair also keeps scripts and AutoLISP from opening the dialog, and stops a cancelled or queued dialog confirmation from reaching the next INSERT. One correction to the description here: the default is ATTDIA 0 (AutoCAD's initial value), as the earlier review said, and the code already does that. I couldn't push to this branch, so it's a separate PR. If you'd rather pull those commits in here, I'll close mine.
Correction to my note above: AutoCAD 2026's ATTDIA page gives Initial value 1, not 0. #3411 now defaults ATTDIA to 1, as this PR's description said; ATTDIA 0 still asks at the command line when set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Francesco BV
Before: attribute definitions keep their Verify and Preset modes (read and written since 2026-10-12), but INSERT ignored them: a Verify attribute was asked once and a Preset one was asked like any other. There was no ATTREQ or ATTDIA, so a typed INSERT always asked every value at the command line, one by one, and couldn't be told to take the defaults. INSERT also counted its answers by tag, so a block with two definitions of one tag asked the second prompt for ever.
After: a typed or menu INSERT asks a Verify attribute's value twice ("Verify attribute value :", Enter keeps it, a new value replaces it), gives Preset (and constant) attributes their defaults without asking, and follows two new user settings:
The JSON form (
insert {attribs}), scripts' answers and every programmatic call never open the dialog.ATTREQ and ATTDIA are user settings (SETVAR,
Settings), not drawing header variables: DWG keeps them in its header only before R2000 (ODA specification, "R13-R14 only"), so AutoCAD keeps them per user.How:
InsertM(crates/engine/src/cmd/blocks.rs) collects the attributes it asks for asAttribAsk {tag, prompt, default, verify}, counts answers instead of looking at the values map, and holds a pending Verify value. A newInteractive::attribute_entryhook (run under the panic guard, exposed asSession::attribute_entry) returns the block and those rows while INSERT waits for its first value with ATTDIA 1;AttribEntry::answersturns the dialog's values into the inputs INSERT expects (a Verify value twice), so the dialog (crates/ui-egui/src/attentry.rs, shown fromdialogs::showlike the MTEXT editor) only feedssession.input. ATTREQ and ATTDIA areSettingstoggles in the SETVAR table. Italian and Ukrainian strings for the dialog.Tests:
engine/tests/it/insert_attrib_entry.rs(new): Verify asked twice and Preset/constant skipped, typed and from a script; ATTREQ 0 takes the defaults; ATTDIA 1 exposes the rows,answersand typed answers both finish the insert, Cancel inserts nothing; JSON inserts never ask; hostile SETVAR values refused and short/long answer lists handled; two definitions with one tag are each asked once (on main INSERT counted answers by tag and asked the second for ever).ui-egui/tests/it/insert_attrib_dialog.rs(new, egui_kittest with real events): OK gives the edited values, Enter in a field is OK and a Verify attribute isn't asked again, Cancel inserts nothing, no dialog with ATTDIA 0 or from JSON.cargo test -p cadcraft-engine,cargo test -p cadcraft-ui-egui,cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings -A deprecated(origin/main itself fails plain-D warningson the deprecatedUi::idincrates/ui-egui/src/palettes.rs:741and on xtask's unusedwalkimport, neither touched here),xtask layers,xtask assets,cargo check --target wasm32-unknown-unknownon engine and ui-egui.Related open PRs: #1729 (ATTDEF dialog and modes) creates Verify/Preset definitions this PR then honours; #993 (no grips on locked attributes) covers Lock position. Not here: the dialog's Previous/Next pages (one scrolling list instead), and keeping ATTREQ/ATTDIA in the preferences file across sessions (they live in
Settings, like AUDITCTL).🤖 Generated with Claude Code
Summary by CodeRabbit
ATTDIAandATTREQsettings control the dialog and attribute prompts.