Skip to content

docs: update agent guidance#11842

Merged
kdy1 merged 1 commit intomainfrom
kdy1/docs-agent-guidance
May 4, 2026
Merged

docs: update agent guidance#11842
kdy1 merged 1 commit intomainfrom
kdy1/docs-agent-guidance

Conversation

@kdy1
Copy link
Copy Markdown
Member

@kdy1 kdy1 commented May 4, 2026

Description:

Adds agent guidance requested from PR review feedback:

  • Respect the project MSRV when writing Rust code.
  • Keep new swc_ecma_minifier regression coverage out of tests/terser and prefer SWC-owned fixtures such as tests/fixture/issues.

This is documentation-only and helps future automated edits choose the right compatibility and fixture behavior.

BREAKING CHANGE:

None.

Related issue (if exists):

Refs #11830 (comment)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

⚠️ No Changeset found

Latest commit: 410c301

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Binary Sizes

File Size
swc.linux-x64-gnu.node 27M (27759688 bytes)

Commit: aa68740

@kdy1 kdy1 marked this pull request as ready for review May 4, 2026 01:57
@kdy1 kdy1 requested review from a team as code owners May 4, 2026 01:57
Copilot AI review requested due to automatic review settings May 4, 2026 01:57
@kdy1 kdy1 merged commit bf2d015 into main May 4, 2026
45 checks passed
@kdy1 kdy1 deleted the kdy1/docs-agent-guidance branch May 4, 2026 01:58
@github-actions github-actions Bot added this to the Planned milestone May 4, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 4, 2026

Merging this PR will not alter performance

✅ 219 untouched benchmarks
⏩ 31 skipped benchmarks1


Comparing kdy1/docs-agent-guidance (410c301) with main (9101c71)

Open in CodSpeed

Footnotes

  1. 31 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

Review

Documentation-only change to AGENTS.md files. Both additions look reasonable and address concrete pain points raised in PR #11830. A few constructive observations:

MSRV rule (root AGENTS.md)

Respect the project's MSRV. Do not rely on Rust language features or standard library APIs newer than the MSRV unless the change intentionally raises the MSRV.

The guidance is sound, but it isn't actionable as written because the repo doesn't appear to declare an MSRV anywhere I can find:

  • No rust-version field in the workspace Cargo.toml or in any per-crate Cargo.toml.
  • rust-toolchain pins nightly-2026-04-10, which conflicts with the spirit of an MSRV.
  • No MSRV mention in docs.

An agent reading this rule has no concrete version to compare against. Two options to make it enforceable:

  1. Add rust-version = "..." to the workspace [workspace.package] (and inherit per-crate), then this rule has a single source of truth.
  2. Or amend the rule to point at the canonical reference, e.g. "check <file> for the MSRV" or name the version inline.

Without one of those, this rule is hard to follow consistently.

tests/terser rule (crates/swc_ecma_minifier/AGENTS.md)

Do not add new regression coverage to tests/terser. Use SWC-owned fixtures such as tests/fixture/issues instead.

Good clarification, and dropping tests/terser from preferred fixture roots is consistent. One small suggestion: a one-line why would harden the rule against future drift — e.g. that tests/terser mirrors upstream Terser fixtures and shouldn't be augmented with SWC-specific cases. Future agents (and humans) won't have to re-derive the rationale, and edge-case judgments get easier.

Other notes

  • Diff is clean, no formatting issues.
  • No code changes, so no test/perf/security implications.
  • The crate-local AGENTS.md edit is consistent with how other crate-local AGENTS.md files are structured.

Overall: useful guidance — recommend tightening the MSRV bullet so it's actually enforceable.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates repository guidance for automated and human contributors so future changes stay within SWC’s supported Rust compatibility range and add minifier regressions to the preferred fixture suites. It fits the codebase by refining the project’s existing AGENTS.md instructions rather than changing runtime behavior.

Changes:

  • Add a repository-wide instruction to respect the project’s Rust MSRV when writing new Rust code.
  • Clarify swc_ecma_minifier fixture guidance by removing tests/terser from preferred roots for new regression additions.
  • Direct new minifier regression coverage toward SWC-owned fixtures such as tests/fixture/issues.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
AGENTS.md Adds top-level contributor guidance to keep new Rust code compatible with the project MSRV.
crates/swc_ecma_minifier/AGENTS.md Refines crate-specific testing guidance so new regressions go into SWC-owned fixture suites instead of tests/terser.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants