Skip to content

The published stylesheet banner is pinned by nothing, and cannot be pinned cleanly while the shared builder keeps defaultHeader private #7044

Description

@zhuangjianguo

What was observed

Noticed while adding @object-ui/fields as a third subject to
scripts/__tests__/plugin-published-stylesheet.test.ts (#6438). Filed rather
than ridden along: the fix is a producer-side change with its own review.

Three packages now ship a supplement stylesheet, and every one of them opens
with a banner that is part of the published artifact:

The emitted sheet is the header, then a newline, then the sheet body — see the
final assignment to css near the end of build() in
scripts/build-plugin-stylesheet.mjs. Nothing in the suite reads it. Surveyed
while working #6438: no assertion anywhere in scripts/__tests__/ inspects the
emitted stylesheet banner, so the banner bytes of all three published sheets are
unpinned. A change to defaultHeader, or an accidental drop of fields'
per-package header, would ship silently — the second case being a diff in a
published file that #6405 was explicitly gated against.

Why it was not fixed in #6438

The obvious assertion is "the emitted sheet opens with the banner this package
declares". It cannot be written cleanly today, because defaultHeader is a
module-private function in scripts/build-plugin-stylesheet.mjs — it is not
exported. A test covering all three subjects would therefore need a tolerant
fallback on the consumer side: read the package's own declared header, and fall
back to a locally re-spelled copy of the default for the two packages that
declare none.

That is exactly the consumer-side leniency this repo's contract-first rule says
to fix at the producer instead, and a second hand-maintained copy of the default
banner in the test would be free to drift from the real one while staying green
— the same "assertion that inspects nothing" shape #6438 records.

Suggested shape

Export defaultHeader from scripts/build-plugin-stylesheet.mjs (it is already
documented there as the per-package hook's counterpart), then add one
per-package assertion that the emitted sheet starts with the package's own
declared header when it has one, and with defaultHeader(PACKAGE_NAME) when it
does not — no second copy of the wording, and fields' published bytes pinned
where #6405 assumed they were.

Worth confirming rather than assuming: whether the maintainer wants the banner
pinned at all, or considers it presentation-only and deliberately unpinned.

Filed unassigned, as an observation from the #6438 implementation. Generated by
Claude Code, session 01GgDDqh6YnkXqsnVTCa7wHk — the standard attribution
footer is stripped from issue bodies written through this path, so it is stated
here as prose instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopriority:p3tooling

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions