Skip to content

fix: reflect interface fields in VML repeaters - #38

Merged
medvednikov merged 1 commit into
masterfrom
fix/issue-26-20260919
Sep 19, 2026
Merged

medvednikov merged 1 commit into
masterfrom
fix/issue-26-20260919

Conversation

@medvednikov

Copy link
Copy Markdown
Member

Fixes #26.

Changes

Add interface-aware VML value and schema conversion. Runtime values expose the public fields declared by the interface; schema construction uses each declared field's type rather than selecting fields from a zero interface, so an empty []Item can still validate safely.

Regression coverage includes mixed value-backed and pointer-backed implementations, item.id keys and item.label rendering, action arguments, stable event identities after reordering, duplicate-key rejection, empty collections, and rejection of fields outside the interface contract.

Verification

Passed with V 0.5.2:

v -d ui2_headless test ui/vml_interface_repeater_test.v
v -d ui2_headless test ui/vml_model_test.v

The new regression fails with cannot read id from item.id against the original code and passes with this change. Both commands also passed on Linux before branch publication: verification log. That shared run subsequently failed on an existing scrolling-test compilation error while checking a different issue.

The interface regression tests also passed locally under AddressSanitizer (-cc gcc -gc none, leak detection disabled). This is an independent PR against master and includes no temporary verification workflow.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-19T14:05:31.409207Z a90f40c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a90f40ce8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/vml_interface_schema.v
mut fields := map[string]VValue{}
$for field in E.fields {
$if field.is_pub {
fields[field.name] = v_value_from(value.$(field.name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard zero interface values before reflecting fields

When a public model field uses an interface with declared fields but is left at its zero value, v_value_from eagerly converts that field even if the VML never references it, and this selector dereferences an interface with no backing object. That makes otherwise unrelated template rendering crash; previously, unsupported interface fields became an invalid VValue without being dereferenced. Detect a zero/nil-backed interface and return an invalid value or an actionable error before selecting its fields.

Useful? React with 👍 / 👎.

@medvednikov
medvednikov merged commit 423e8a8 into master Sep 19, 2026
0 of 5 checks passed
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.

Cannot user Repeater with interface

1 participant