generate-fixtures output is unreadable as a maintained fixture
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #453 @silverbackdan による — マージ済み
評価
調査の方向性
Start in GenerateFixturesCommand, reading emitComponent(), emitGroup(), exportValue(), build() and the $deferredReferences / afterRoutes() handling. Generate a fixture from a small site and compare it with the output. Done when the generated class has readable variable names, inline references, nowdoc HTML, opt-in timestamps and per-page methods, and still reloads to the same rows.
索引モデルが issue の本文から書いたものです。
説明
silverback:api-components:generate-fixtures (2.0.0-alpha.18) reproduces a site faithfully. A snapshot of a production site with 18 pages, 66 groups, 119 components and 13 images reloads with every content row matching. But the class it writes can't be maintained as a fixture: a developer opening it found it unreadable. The causes are all in GenerateFixturesCommand:
- Positional variables. Every component is
$c[n]and every group$g[n], numbered in walk order (emitComponent(),emitGroup()).$c[35]->html = ...says nothing about what it is. - References are written far from their component. Every non-component association (e.g. a navigation link's
route) is deferred to anafterRoutes()block at the end of the file ($deferredReferences). A link is created on line 35 and given its route 600 lines later as$c[3]->route = $cwa->getRoute('/about/team'). - HTML on one line.
exportValue()usesvar_export(), so rich HTML becomes a single quoted string. The longest line in the snapshot is 12,963 characters. - Timestamps on everything. Every publishable component gets
setPublishedAt(new \DateTime('2026-10-02T14:48:09.000000+00:00')): 81 of them in a 649-line file. - No structure.
build()is a single flat method, with no marker where each page starts, and the layout's groups are written before any page. - Lists written with index keys.
uiClassNamesand other plain lists come out as[0 => '...'].
Requested
- Readable variable names. Derive them from the short class name plus an identifying value (label, title, reference or the owning page's reference), e.g.
$aboutTeamLinkor$homeHeroGroup, with a numeric suffix only to resolve clashes. Don't create a variable at all for components nothing refers to later. - Set references inline.
afterRoutes()exists only because the target route isn't built yet. A lazy builder reference resolved on flush (e.g.$cwa->routeRef('about-team')) would let the generator write$link->route = $cwa->routeRef('about-team')next to the link. KeepafterRoutes()for draft components only. - Readable HTML. Emit long HTML as a nowdoc with a line break after each block-level closing tag. Alternatively, add an option to write each one to
assets/html/<name>.htmland load it withfile_get_contents(__DIR__ . '/assets/html/<name>.html'). - Timestamps opt-in. By default, emit a single "published" call per component (e.g.
$cwa->publish($x), published at load time) instead of the exactpublishedAt. Add--keep-timestampsfor exact copies. - Structure. At minimum, write a comment header for each layout and page, e.g.
// Page: About - Team (/about/team). Better: one private method per layout and top-level page, called frombuild(), keeping nested children inside their parent's method. - Plain lists. Use
array_is_list()inexportValue()so lists are written as['a', 'b'].
The expected result: running generate-fixtures against a live site gives a class a developer can read, edit and review in a diff as easily as a hand-written AbstractCwaScaffold, while still reloading to the same rows.
- 主要言語
- PHP
- スター
- 32
- フォーク
- 8
- 平均マージ
- 1時間 1分
- マージ済み PR(30日)
- 159
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
components-web-app/api-components-bundle のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
components-web-app/api-components-bundle#504 · コメント 22 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
components-web-app/api-components-bundle#333 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#325 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
components-web-app/api-components-bundle#259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#186 ·
メンテナーはふだん 1 日以内に返信
components-web-app/api-components-bundle の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
nextcloud/integration_openai#446 ·
-
bug customer-reported
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
MagnaCapax/PMSS#1101 ·
メンテナーはふだん 5 日以内に返信
-
InvoiceSettled is answered 200 when the invoice cannot be re-fetched, so BTCPay never redelivers itオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
btcpayserver/woocommerce-greenfield-plugin#93 ·
メンテナーはふだん 1 日以内に返信
-
kind/bug status/triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
🐛 [Bug] Bulk CSV import stores hide_from_combined_view=FALSE as a string, which hides every account from Sent, Junk, Trash and Drafts対応中かも @exSnake が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信