Repository navigation
feat(inspection): add callout banner form field type - #1255
Conversation
Add a read-only Callout (callout) parameter form field across Protobuf, Go form metadata, formtask (DefineCalloutForm), Connect-RPC conversion, MCP dry_run_inspection rendering, and Angular New Inspection dialog UI so inspection tasks can surface informational, warning, and blocking error notices without rendering an input control.
There was a problem hiding this comment.
Code Review
This pull request introduces a new read-only callout banner form task (DefineCalloutForm) to display prerequisite notices, warnings, or errors in parameter forms without input controls. It updates the backend task definition, proto schemas, and server converters, while adding a frontend CalloutParameterComponent with corresponding validation logic and documentation. The review feedback suggests replacing the use of [innerHTML] and the custom breakline pipe with standard Angular interpolation and CSS white-space: pre-line to prevent potential XSS vulnerabilities and simplify the component imports.
| @if (param.description) { | ||
| <p class="description" [innerHTML]="param.description | breakline"></p> | ||
| } | ||
| @if (param.hint) { | ||
| <p class="message" [innerHTML]="param.hint | breakline"></p> | ||
| } |
There was a problem hiding this comment.
Instead of using [innerHTML] with a custom breakline pipe to render multiline text, you can leverage standard Angular interpolation combined with the CSS property white-space: pre-line (or pre-wrap) on the .description and .message classes. This is more secure as it avoids bypassing Angular's built-in XSS protection via [innerHTML], and it simplifies the template by removing the pipe dependency. Remember to add white-space: pre-line; to the .description and .message classes in callout-parameter.component.scss to preserve the newlines.
| @if (param.description) { | |
| <p class="description" [innerHTML]="param.description | breakline"></p> | |
| } | |
| @if (param.hint) { | |
| <p class="message" [innerHTML]="param.hint | breakline"></p> | |
| } | |
| @if (param.description) { | |
| <p class="description">{{ param.description }}</p> | |
| } | |
| @if (param.hint) { | |
| <p class="message">{{ param.hint }}</p> | |
| } |
There was a problem hiding this comment.
Addressed in 228925a. Replaced [innerHTML] + breakline with standard text interpolation and added white-space: pre-line; to .description and .message in callout-parameter.component.scss.
| imports: [ | ||
| MatIconModule, | ||
| MatProgressSpinnerModule, | ||
| KHIIconRegistrationModule, | ||
| BreaklinePipe, | ||
| ], |
There was a problem hiding this comment.
There was a problem hiding this comment.
Addressed in 228925a. Removed the unused BreaklinePipe import and @Component.imports entry.
Summary
Adds a read-only Callout Banner (
callout) parameter form field type across the dynamic inspection parameter form stack so inspection tasks can display contextual notices, prerequisite advisories, quota warnings, and blocking error banners without rendering an input control (<mat-form-field>/<input>) or validation checkmark (check_circle).Key Changes
proto/api/v1/inspection.proto):CalloutFormFieldand addedCalloutFormField callout = 12toFormField.kind.pkg/generated/api/v1/inspection.pb.go) and TypeScript (web/src/app/generated/api/v1/inspection_pb.{js,d.ts}) bindings.pkg/core/inspection/metadata/,pkg/core/inspection/formtask/):Callout("callout") toParameterInputTypeandCalloutParameterFormFieldtoinspectionmetadata.formtask.DefineCalloutFormandCalloutFormSpecsupportingInfo,Warning, andErrorseverities, omitting empty/Nonebanners, and failingTaskModeRunwhen anErrorcallout remains unresolved.pkg/server/api/v1/,pkg/server/mcp/):CalloutParameterFormFieldinconvertFormFields.dry_run_inspectionformatting and template guidance socalloutfields render read-only notices (Info,Warning,Error), contribute to warning/error counts appropriately, and accept no parameter value.web/src/app/...):ParameterInputType.CalloutandCalloutParameterFormFieldtoform-types.tsandinspection-converter.ts.new-inspection.utils.tsandParameterInputStepComponentso read-only callouts do not inflate user inputfieldCountdenominators while still disabling the Run button and displaying clear footer status messages when an error or pending callout is active.CalloutParameterComponent(khi-new-inspection-callout-parameter), registered it inGroupParameterComponent, and added Storybook stories (Dialogs/NewInspection/CalloutParameter).docs/{en,ja}/task-system/03-advanced-and-form-tasks.md):formtask.DefineCalloutFormin both English and Japanese task system guides.Verification
make format-proto,make lint-proto,make build-protomake pre-commitmake build-go,make lint-go,make test-gomake build-web,make lint-web,make test-web,make build-storybook