Skip to content

refactor: drop the package name check - #42

Merged
fey merged 1 commit into
masterfrom
refactor/drop-package-name-check
Sep 10, 2026
Merged

fey merged 1 commit into
masterfrom
refactor/drop-package-name-check

Conversation

@fey

@fey fey commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Что

Снимает checkPackageName — проверку, которая отказывала проекту, если имя в манифесте студента отличалось от зафиксированного для его языка (hexlet-code / hexlet/code / @hexlet/code).

Почему

Там, где имя что-то значит, его резолвит по имени сам харнесс проекта и падает раньше и понятнее. Там, где не значит, проверка требовала имя, которое не читает ничто.

php-библиотеки. Корневой composer.json требует hexlet/code из path-репозитория. Composer резолвит path-пакет по имени, поэтому чужое имя роняет composer install. Так в 11 каталогах проектов.

python-библиотеки. Корневой pyproject.toml объявляет hexlet-code = { path = "code" } в [tool.uv.sources]. Проверено на стенде: uv sync отказывает с Package metadata name wrong-namedoes not match given namehexlet-code``. Так в 15 каталогах.

javascript — исключение. Харнесс объявляет зависимость как "@hexlet/code": "file:code", и npm ставит path-зависимость по этому ключу независимо от того, как пакет назвал себя сам. Проверено и на npm install, и на npm ci: пакет с именем wrong-name встаёт в node_modules/@hexlet/code, и import … from "@hexlet/code" резолвится. Там имя — конвенция, и утверждать её должны тесты самого проекта; это делается отдельно, в репозиториях проектов.

Тот же вывод уже лежал комментарием в удаляемом тесте:

in some languages, verification is not needed, since the package name is verified when installing the dependencies

Что в диффе

  • src/packageChecker.js, __tests__/packageChecker.test.js, __fixtures__/package_files/ — удалены
  • вызов в check() снят, сигнатура сузилась до { projectSourcePath }
  • ini выброшен из зависимостей — импортировался только чекером
  • AGENTS.md — раздел архитектуры описывает отсутствие проверки и её причину, ссылка в разделе команд переставлена с удалённого файла теста

Проверки

make lint и npx jest зелёные локально.

🤖 Generated with Claude Code

The action refused a project whose manifest carried a name other than the
one fixed for its language. The rule is enforced by the projects themselves
wherever it means anything, so the check only added a second, earlier and
less legible failure.

Where the name is load-bearing: the php library projects, whose root
composer.json requires `hexlet/code` from a path repository. Composer
resolves a path package by name, so a wrong name fails `composer install`
with a message that names the package.

Where it is not: for javascript the harness declares the dependency as
`"@hexlet/code": "file:code"`, and npm installs a path dependency under
that key whatever the package calls itself — verified on a stand, a package
named `wrong-name` installs and imports as `@hexlet/code`. For python
nothing reads the distribution name at all: the console scripts of every
project have names of their own.

__tests__/packageChecker.test.js already carried the same conclusion in a
comment: "in some languages, verification is not needed, since the package
name is verified when installing the dependencies".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fey
fey merged commit 5e70401 into master Sep 10, 2026
3 checks passed
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.

1 participant