Skip to content

fix(cli): skip test and fixture files when loading integration codemods - #6230

Merged
josephfarina merged 2 commits into
mainfrom
autolink-kill-switch
Sep 24, 2026
Merged

josephfarina merged 2 commits into
mainfrom
autolink-kill-switch

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

User impact

An integration that keeps a test next to its codemod ships a broken upgrade. Every .ts, .mjs, and .js file under a codemod version folder was loaded and validated as a codemod, so the colocated test failed validation. A definition error is a hard error, so that one file took every codemod in the version with it, and astryx upgrade applied nothing while still reporting success.

Problem and solution fit

The integration codemod collector walked the whole version folder and treated every script as a transform. Core's own codemods come from a registry rather than a directory walk, so only integration codemods hit this, and only a loader change reaches integrations that are already published.

The collector now skips reserved names: *.test.*, *.spec.*, *.fixture.*, and anything under __tests__/ or __fixtures__/.

Expected behavior and authority

spec:AST-017 FR14 requires automatic CLI behavior to be documented and discoverable. The reserved names are documented in the integrations guide (astryx docs cli-integrations, Codemods section), with a directory example.

This PR started as an autolink kill switch (ASTRYX_NO_AUTOLINK and astryx.autolink in package.json). Both switches are removed: FR14 rules out Astryx-owned environment variables, and FR19 admits a new configuration key only with a reproduced detection failure, which we don't have. If that evidence shows up, the switch can come back as its own proposal.

Smallest restoration

Skip the reserved test and fixture names in the codemod collector. Nothing else about codemod discovery changes.

Evidence

  • Regression tests: 13 cases in integration-discovery.test.mjs cover all five reserved patterns.
  • Representative unchanged path: a nested helper module that isn't a reserved name still loads (positive case in the same suite).
  • Autolink, integration discovery, and project suites pass unchanged apart from the removed switch tests.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run packages/cli/foundation/integrations packages/cli/foundation/config/project.test.mjs (136 passed)
  • pnpm -F @astryxdesign/cli exec tsc --project tsconfig.api-dts.json
  • pnpm check:knowledge
  • pnpm check:changesets
  • git diff --check

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 10, 2026
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 24, 2026 5:49am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Sep 24, 2026, 6:07 AM UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: 36 accessibility violation(s) found — 2 critical, 34 serious.

Button pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/19 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatReasoning - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatToolCalls - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Checkbox pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/33 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ClickableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditor - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/7 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorPerf - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/2 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 13/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 14/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/21 stories · Learn more
    • WCAG: 4.1.2 (Level A)
FileInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
GridMasonry - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Heading - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Icon - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
LogStream - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
MediaTheme Auto - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PowerSearch - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ProgressBar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Radio group pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RichTextEditor - 2 issue(s)
  • 🟠 serious: Ensure every ARIA input field has an accessible name
    • Rule: aria-input-field-name · Affects 2/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
  • 🔴 critical: Ensure every form element has a label
    • Rule: label · Affects 1/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
SelectableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/4 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
TableGroupedRows - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 3/3 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TableTree - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 8/9 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Theme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PopArt - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/6 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Timestamp - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/20 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

19 of 422 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Slider Default probe light 15,617
Slider Default probe dark 15,615
Chat With Attachments probe light 12,964
Chat With Attachments probe dark 12,114
InputGroup With Typeahead probe light 11,012
InputGroup With Typeahead probe dark 9,189
ComplexSelector Tree list with search probe light 6,245
TextArea Vertical Form Alignment probe light 5,634
ComplexSelector Tree list with search probe dark 5,602
TextArea Vertical Form Alignment probe dark 5,047
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
ToggleButton Group Single probe dark 1,538
ToggleButton Group Single probe light 1,538
MediaTheme On Dark neutral dark 838
Banner Collapsible Content (Expanded) probe dark 92
Banner Collapsible Content (Expanded) probe light 90
AlertDialog Delete neutral light 71
TableRowStatus Default neutral light 23

Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change looks well-implemented, but approval is waiting on a maintainer spec decision.

The implementation adds two ways to disable only autolinked integrations — ASTRYX_NO_AUTOLINK in the environment and {"astryx": {"autolink": false}} in package.json — while leaving configured integrations loaded, and it stops test and fixture files and __tests__/__fixtures__ directories under a codemod version folder being loaded as codemods. Targeted tests for both behaviours pass, with lint and diff checks clean, and no concrete code defect was found.

What a maintainer must settle: please provide or identify the governing spec with current authority (or update and approve the CLI surface record) for those exact semantics — the environment parsing (any non-empty value except 0/false), the package.json false-only opt-out and configured-integration exemption, and the reserved codemod names (*.test.*, *.spec.*, *.fixture.*, __tests__, __fixtures__). The record currently describing the switches is draft, so it cannot settle them on its own. Once that authority is in place, this review's implementation evidence supports proceeding; if the settled semantics differ, the implementation should be conformed to them.

[Automated review]

josephfarina and others added 2 commits September 23, 2026 22:37
Autolinking loads an installed integration a project never named, which is
the point — it fixes the apps that have the dependency and no config. But
until now there was no way to stop it. A consumer resolves the CLI from its
own lockfile, so a fix that ships in a version reaches the fleet on each
app's upgrade schedule rather than ours, and an integration behaving badly
had no faster answer than editing every consumer's package.json.

Two switches, for two different emergencies. `ASTRYX_NO_AUTOLINK` in the
environment needs no change to any repo, which is what a fleet-wide stop
requires. `{"astryx": {"autolink": false}}` in package.json is the durable
per-project answer, and lives there rather than in astryx.config for the
reason `astryx.inheritDebug` already does: an unknown config key is a hard
error on an older CLI, while an `astryx` block in package.json is inert to
every version that does not look for it.

Neither switch touches a CONFIGURED integration. Naming one is asking for
it, and a kill switch that silently dropped a declaration would be a second
silent failure in a system that already has too many.

Also: test and fixture files under `codemods/<version>/` are no longer
loaded as codemods. Every js/ts/mjs file under a version folder was loaded
and validated, so a test colocated with its transform failed validation
and — a definition error being a hard error — took every codemod in that
version with it, while `upgrade` applied nothing and reported success.
Core never hit this because its own codemods are enumerated in a registry
rather than found by walking a directory; only integrations carry the
landmine, and only a loader fix reaches the ones already published.
Drop both autolink switches (ASTRYX_NO_AUTOLINK env var and the
package.json astryx.autolink key) — FR19 requires evidence of a case
where automatic behavior produces the wrong result, and the switch had
none.

Keep the codemod loader fix: test and fixture files colocated under a
version folder are now skipped automatically. Reserved names
(*.test.*, *.spec.*, *.fixture.*, __tests__/, __fixtures__/) are
documented in the consumer integrations guide (FR14).
@josephfarina josephfarina changed the title fix(cli): let autolinking be switched off without a release fix(cli): skip test and fixture files when loading integration codemods Sep 24, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change looks good to approve.

The codemod loader now skips test and fixture files (*.test.*, *.spec.*, *.fixture.*, and anything under __tests__/ or __fixtures__/) instead of loading them as codemods — so a test colocated with a transform can no longer fail validation, take every codemod in its version with it, and leave astryx upgrade applying nothing while reporting success. The reserved names are documented in the integrations guide with an example, the patch changeset matches the non-breaking nature of the fix (those files were never valid codemods), and regression tests cover all five reserved patterns plus a nested-helper case that still loads — the discovery suite passes 13/13 locally.

Worth noting for authors: a real codemod must not use a reserved name or live under __tests__//__fixtures__/ — that constraint is now documented in the guide. The earlier autolink switches are no longer part of this PR, which keeps the change to the single restorative fix.

[Automated review]

@josephfarina
josephfarina merged commit 1a9bb4a into main Sep 24, 2026
34 checks passed
@github-actions
github-actions Bot deleted the autolink-kill-switch branch September 24, 2026 06:23
gunjanjaswal added a commit to gunjanjaswal/astryx that referenced this pull request Nov 13, 2026
Proposes RFC option 1 from meta#4975: identify codemods by shape rather than
treating every module under codemods/<version>/ as a codemod.

Builds on meta#6230, which already skips test/spec/fixture paths in the walk. On
top of that, a module counts as a codemod only when it default-exports an
object; a co-located helper (named exports only, or a default-exported
function) is skipped instead of being fed to parseCodemod. A module that does
default-export an object is still validated at the load boundary, so a
genuinely broken codemod (missing field, no type) still fails loudly.

Contract change: a module with no codemod default export was previously a hard
error; it is now treated as a co-located helper and skipped. This is the crux
meta#4975 defers to the team, so this stays a draft for discussion.

Refs meta#4975

This branch was successfully deployed

1 active deployment
Preview — 37026d6b Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant