Skip to content

test(extractor): lock sibling dynamic-as with props object (Prime regression) - #894

Draft
devfive-relay-c70423[bot] wants to merge 1 commit into
mainfrom
devfive/3099154426bffbeef8b62999b80bb038/test-sibling-dynamic-as-props
Draft

devfive-relay-c70423[bot] wants to merge 1 commit into
mainfrom
devfive/3099154426bffbeef8b62999b80bb038/test-sibling-dynamic-as-props

Conversation

@devfive-relay-c70423

@devfive-relay-c70423 devfive-relay-c70423 Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

What

Tests only. Locks the file shape that @devup-ui/wasm 1.0.78 – 1.0.81 wrote back as code that no longer parsed (reported from Prime, case 009). No source change: the defect is already fixed on main by #681 (4586885), and I found no remaining defect.

Repro

Two or more sibling elements in one file, each with a non-literal as:

import { Center, Flex, Text } from '@devup-ui/react'
import Link from 'next/link'

export const Footer = () => (
  <Flex gap={4}>
    <Center as={Link} props={{ href: '/privacy' }}>Privacy</Center>
    <Text as={Link} props={{ href: '/terms' }}>Terms</Text>
  </Flex>
)
export const Footer = () => <div className="a a-a">
    <Link className="a b c" {...{ href: "/privacy" }}>Privacy</Link>
    <Link {...{ href: "/terms" }}>Terms</Link>
  </div>;

Why new tests

The tests of #681 (test_dynamic_as_where_the_element_stands, test_dynamic_as_elements, test_spreads_are_read_once) have one dynamic as per parent and no props object, so this exact shape was not covered.

What the tests assert

libs/extractor/src/dynamic_as_sibling_props_tests.rs — 11 files × with/without source map = 22 cases: two siblings (the report), self-closing siblings, three siblings with style props, siblings in a fragment, siblings of a plain element, nested dynamic as, conditional as, URLs with /, ?, # and more props, siblings in a list, two components in one file, member as in an attribute.

For each case the extracted code must:

  1. parse as TSX with no diagnostics (Oxc parser);
  2. leave no Devup component and no as / props attribute;
  3. keep every href on its own element, in source order (read from the parsed AST, not matched as text);
  4. keep the statement after the component;
  5. match an insta snapshot (11 snapshots).

Checked against the parent of 4586885: 18 of the 22 cases fail there — 14 with extracted code has syntax errors, 2 with a Devup component left in the output, 2 with an href lost. The other two files (conditional as, two components in one file) already compiled correctly before the fix and are kept as neighbours of the shape.

bindings/devup-ui-wasm/src/dynamic_as_sibling_props_tests.rs — the reported file through code_extract_internal and code_extract_without_source_map_internal, the functions the codeExtract and codeExtractWithoutSourceMap exports call (2 cases). The whole output is compared with the expected code.

Checks

  • cargo test -p extractor -p devup-ui-wasm --lib dynamic_as_sibling — 24 passed
  • cargo fmt --all -- --check clean; cargo clippy --all-targets --all-features -- -D warnings reports nothing in the new files
  • No changepack: only libs/** and bindings/devup-ui-wasm/src/** change, which .changepacks/config.json ignores

🤖 Generated with Claude Code


Submitted via Devfive hub. Employee: ; device: 3099154426bffbeef8b62999b80bb038

…ression)

@devup-ui/wasm 1.0.78 - 1.0.81 wrote a file with two or more sibling
elements that take a non-literal `as` back as code that no longer parsed,
for example

  <Center as={Link} props={{ href: '/privacy' }}>Privacy</Center>
  <Text as={Link} props={{ href: '/terms' }}>Terms</Text>

#681 (4586885) fixed it by replacing such an element where it stands. The
tests of that change cover one dynamic `as` per parent and no `props`
object, so this shape was not locked.

- extractor: 11 files of that shape, with and without a source map. The
  extracted code must parse as TSX without diagnostics, leave no component,
  `as` or `props`, keep every href on its own element in source order, and
  match a snapshot. 20 of the 22 cases fail on the parent of 4586885.
- wasm: the reported file through the functions `codeExtract` and
  `codeExtractWithoutSourceMap` call, compared with the whole expected code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
bindings/devup-ui-wasm/src/lib.rs 100.00% <ø> (ø)
libs/extractor/src/lib.rs 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

0 participants