From a687cdd22614a187f97f5bcdb57600c8d135467d Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Fri, 30 Oct 2026 13:38:01 -0400 Subject: [PATCH 1/2] test: guard that every ichava/* constraint admits 0.1.0 At release every ichava repository becomes one commit tagged v0.1.0, so a constraint that excludes 0.1.0 cannot resolve. SiblingConstraintsTest reads require and require-dev and fails on such a constraint, and on finding none to check. --- CHANGELOG.md | 2 + composer.json | 1 + docs/release.md | 6 +++ tests/Unit/SiblingConstraintsTest.php | 56 +++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 tests/Unit/SiblingConstraintsTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 44a367b..d345906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to `ichava/icon-sets-flag` follow [Keep a Changelog](https:/ ### Added - **The pack declares its SVG kind.** `config.json` sets `package.kind` to `icon`, the kind ichava/core resolves for every category that names none of its own (core reads it from ichava/core#148; an older core ignores the key). `tests/Feature/SvgKindTest.php` fails on a kind core would not recognise, on a category that resolves none, and, against a core that has `IconRegistry::kindFor()`, on any category core resolves differently. `RetiredCopiesTest` also pins a non-empty description for every label core loads. +- **`SiblingConstraintsTest` keeps every `ichava/*` constraint on the released line.** At release every ichava repository becomes one commit tagged `v0.1.0`, so 0.1.0 is the only version of any sibling. The test reads `require` and `require-dev` in `composer.json`, fails on any `ichava/*` constraint that 0.1.0 does not satisfy (checked with `composer/semver`, now a direct dev requirement), and fails when it finds no constraint to check. ### Changed @@ -15,6 +16,7 @@ All notable changes to `ichava/icon-sets-flag` follow [Keep a Changelog](https:/ - **`sync-upstream.yml` commits as the github-actions bot's noreply address** instead of a personal GitHub login, matching packs scaffolded since icon-sets-package-scaffolder#60 and icon-sets-sync's default. The personal-contact guard now also reads `.github/` and `.dev/`. - **The package author is Simtabi LLC, not a person.** `composer.json` named a personal maintainer and mailbox as author; it now names `Simtabi LLC` with the role address `ichava@simtabi.com` (no personal contact is published, decided 2026-10-28). `NoPersonalContactTest` reads `composer.json`, `README.md`, `LICENSE`, `docs/` and `src/`, fails on a personal name or address, and fails when it reads fewer files than it did when written. - **`sync-upstream.yml`'s header describes what the workflow runs.** It said the image bundles Python and that a release ships to Packagist. The image is icon-sets-sync's Go binary with git, gh and Node, built from the toolkit's `main`, and a release is the GitHub release that release-please and `release.yml` make; nothing is published to Packagist. Comments only: the workflow runs the same steps. +- **CI tests against `ichava/core`'s `main`.** Every job that installs dependencies first aliases core's `main` into the 0.1 line (`composer require "ichava/core:dev-main as 0.1.99" --no-update`), prints the commit it resolved, and restores `composer.json` after the install, so the committed constraint is unchanged and the tests read it. Against that core, `SvgKindTest`'s comparison with `IconRegistry::kindFor()` runs instead of skipping. ### Removed diff --git a/composer.json b/composer.json index 0caba63..2205ccd 100644 --- a/composer.json +++ b/composer.json @@ -49,6 +49,7 @@ } ], "require-dev": { + "composer/semver": "^3.4", "orchestra/testbench": "^11.0", "pestphp/pest": "^4.6 || ^5.0", "phpstan/phpstan": "^2.1", diff --git a/docs/release.md b/docs/release.md index 3630993..1001fdf 100644 --- a/docs/release.md +++ b/docs/release.md @@ -43,6 +43,12 @@ raising it alone, which would trap consumers who stay on the older series. - **Raise the floor** when core ships a security fix in code this pack runs -- the old constraint still resolves the vulnerable release otherwise. +Until the first release, 0.1.0 is the only core version that exists, so a raised floor such as +`^0.1.2` cannot resolve. `tests/Unit/SiblingConstraintsTest.php` fails on any `ichava/*` constraint +that 0.1.0 does not satisfy. CI still tests against core's `main`: each job aliases it into the 0.1 +line before the install and restores `composer.json` afterwards, so the committed constraint never +changes. + Check before doing either: ```bash diff --git a/tests/Unit/SiblingConstraintsTest.php b/tests/Unit/SiblingConstraintsTest.php new file mode 100644 index 0000000..5c36fdf --- /dev/null +++ b/tests/Unit/SiblingConstraintsTest.php @@ -0,0 +1,56 @@ + "section.package" => constraint + */ +function siblingConstraintsInComposerJson(): array +{ + $path = dirname(__DIR__, 2) . '/composer.json'; + $composer = json_decode((string) file_get_contents($path), true, flags: JSON_THROW_ON_ERROR); + + $found = []; + foreach (['require', 'require-dev'] as $section) { + foreach ($composer[$section] ?? [] as $package => $constraint) { + if (str_starts_with((string) $package, 'ichava/')) { + $found["{$section}.{$package}"] = (string) $constraint; + } + } + } + + return $found; +} + +it('admits 0.1.0 in every ichava/* constraint', function (): void { + $constraints = siblingConstraintsInComposerJson(); + + $this->assertNotEmpty($constraints, 'composer.json names no ichava/* constraint, so nothing was checked.'); + + foreach ($constraints as $where => $constraint) { + $this->assertTrue( + Semver::satisfies('0.1.0', $constraint), + "{$where} is '{$constraint}', which the released 0.1.0 does not satisfy.", + ); + } +}); From 88d4914c4bd9d4c9266ed854ae2efb56874618df Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Fri, 30 Oct 2026 13:38:01 -0400 Subject: [PATCH 2/2] ci: test against the siblings' main branches Each job that installs dependencies aliases the siblings' main into the 0.1 line before the install, prints the commits it resolved, and restores composer.json afterwards, so the committed constraints never change and the tests read them. --- .github/workflows/code-quality.yml | 36 ++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 12 ++++++++++ .github/workflows/tests.yml | 12 ++++++++++ 3 files changed, 60 insertions(+) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index dee36fd..2cac9f1 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -26,9 +26,21 @@ jobs: extensions: dom, curl, libxml, mbstring, zip coverage: none + - name: Test against the siblings' main + # The committed constraints stay on the 0.1 line the released 0.1.0 satisfies + # (SiblingConstraintsTest). CI aliases the siblings' main into that line so + # this repository is tested against what it will ship beside, and restores + # composer.json after the install so tests read the committed constraints. + run: composer require "ichava/core:dev-main as 0.1.99" --no-update --no-interaction + - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction + - name: Report the resolved siblings and restore composer.json + run: | + for p in ichava/core; do composer show "$p" | grep -E '^(name|versions|source) '; done + git checkout -- composer.json + - name: Run Laravel Pint run: composer pint @@ -48,9 +60,21 @@ jobs: extensions: dom, curl, libxml, mbstring, zip coverage: none + - name: Test against the siblings' main + # The committed constraints stay on the 0.1 line the released 0.1.0 satisfies + # (SiblingConstraintsTest). CI aliases the siblings' main into that line so + # this repository is tested against what it will ship beside, and restores + # composer.json after the install so tests read the committed constraints. + run: composer require "ichava/core:dev-main as 0.1.99" --no-update --no-interaction + - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction + - name: Report the resolved siblings and restore composer.json + run: | + for p in ichava/core; do composer show "$p" | grep -E '^(name|versions|source) '; done + git checkout -- composer.json + - name: Run PHPStan run: composer analyse @@ -70,9 +94,21 @@ jobs: extensions: dom, curl, libxml, mbstring, zip coverage: none + - name: Test against the siblings' main + # The committed constraints stay on the 0.1 line the released 0.1.0 satisfies + # (SiblingConstraintsTest). CI aliases the siblings' main into that line so + # this repository is tested against what it will ship beside, and restores + # composer.json after the install so tests read the committed constraints. + run: composer require "ichava/core:dev-main as 0.1.99" --no-update --no-interaction + - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction + - name: Report the resolved siblings and restore composer.json + run: | + for p in ichava/core; do composer show "$p" | grep -E '^(name|versions|source) '; done + git checkout -- composer.json + - name: Security Audit run: composer audit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 91b7963..c1da79a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,8 +31,20 @@ jobs: php-version: '8.4' coverage: none + - name: Test against the siblings' main + # The committed constraints stay on the 0.1 line the released 0.1.0 satisfies + # (SiblingConstraintsTest). CI aliases the siblings' main into that line so + # this repository is tested against what it will ship beside, and restores + # composer.json after the install so tests read the committed constraints. + run: composer require "ichava/core:dev-main as 0.1.99" --no-update --no-interaction + - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction + - name: Report the resolved siblings and restore composer.json + run: | + for p in ichava/core; do composer show "$p" | grep -E '^(name|versions|source) '; done + git checkout -- composer.json + - name: Assert the docs shape run: vendor/bin/pest --filter=DocsShapeTest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8d4a12e..53282f9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,10 +42,22 @@ jobs: echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Test against the siblings' main + # The committed constraints stay on the 0.1 line the released 0.1.0 satisfies + # (SiblingConstraintsTest). CI aliases the siblings' main into that line so + # this repository is tested against what it will ship beside, and restores + # composer.json after the install so tests read the committed constraints. + run: composer require "ichava/core:dev-main as 0.1.99" --no-update --no-interaction + - name: Install dependencies run: | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: Report the resolved siblings and restore composer.json + run: | + for p in ichava/core; do composer show "$p" | grep -E '^(name|versions|source) '; done + git checkout -- composer.json + - name: Execute tests run: vendor/bin/pest