Repository navigation
chore: harden repository and package distribution - #25
Conversation
gachakra
left a comment
There was a problem hiding this comment.
Independent review
Please address the two inline findings before merging. The Git distribution has the expected contents. The Composer distribution includes repository infrastructure on a clean checkout and admits local files on a dirty checkout.
- [P1] The Composer root exclusion misses dot-prefixed paths (
composer.json:38). The clean archive contained 25 files, including.gitattributes,.gitignore, and.github/workflows/ci.yml. Synthetic, previously unknown root dotfiles and dot-directories were also included. - [P2] Composer collects untracked and ignored files inside
src/(.github/workflows/ci.yml:186). The current regression only adds fresh untracked files at the root, so it does not exercise this case.
Verification
- Reviewed head
943fb2582313c98826c14b667dcf3755dd5fd570against base881c8383c09aa16c8736c43f5764b19bcf2347bc. The diff is limited to the four infrastructure files. Library source, documentation, Docker configuration, dependency constraints, and thecomposer.lockblob are unchanged. The lockfile remains tracked and unignored. - Generated the Git TAR and downloaded the GitHub source ZIP for the reviewed SHA. Both contained the same 22 allowed files with identical contents. The clean Composer 2.11.3 TAR excluded
composer.lockand matched the contents of all 22 allowed files, with the three additional paths listed above. - Ran the exact synthetic step in an isolated directory. The forced-tracked Git fixtures were excluded, while the Composer comparison failed on the three infrastructure paths. The temporary fixture directory was removed by the exit trap. Separate synthetic probes confirmed that recognized nested exclusions, including
.env,auth.json, IDE data, and*.log, exclude those paths from Composer archives. composer validate --strict,git diff --check, anddocker compose config --quietpassed independently. The existing check names are preserved. On the reviewed SHA, the two PHP jobs passed PHPUnit, examples, and Git Archive, then failed at Verify Composer archive after tests. The Docker check passed. These job results were read from GitHub.
| "/vendor", | ||
| "/.phpunit.result.cache", | ||
| "/.phpunit.cache" | ||
| "/*", |
There was a problem hiding this comment.
[P1] Exclude dot-prefixed paths in the Composer allowlist
Composer 2.11.3 translates the * in /* to a glob that skips leading dots. A clean composer archive includes .gitattributes, .gitignore, and .github/workflows/ci.yml even though the Git archive excludes them. A synthetic .local-metadata file and .review-config/notes.txt also entered the archive. Cover hidden root files and directory trees with Composer-compatible exclusions and add previously unknown hidden paths to the regression fixture.
There was a problem hiding this comment.
Addressed in 49b3bad: Composer now explicitly excludes dot-prefixed root paths with /.*, and the independent raw Composer archive fixture includes previously unknown hidden root files and directories. Real Composer verification is required in the new CI run; I could not run Composer in the implementation environment.
| diff -u "$RUNNER_TEMP/expected-files.txt" "$RUNNER_TEMP/fixture-git-files.txt" | ||
|
|
||
| # Composer Archive also sees untracked and ignored working-tree files. | ||
| printf '{}\n' > "$fixture/untracked-local.txt" |
There was a problem hiding this comment.
[P2] Exercise untracked and ignored source files
The fixture adds its fresh untracked files at the root. Composer traverses the working tree below the allowed src/ directory as well. In an isolated checkout, src/local-tool.php entered the archive while untracked, and src/local-ignored.txt entered it even after git check-ignore confirmed the path was ignored. Add both cases to the distribution test and generate the supported Composer release artifact from a tracked-only staging tree, or reject a dirty source tree before it can be packaged.
There was a problem hiding this comment.
Addressed in 49b3bad: added a commit-based Composer archive helper that validates the Git export and resulting Composer archive against the tracked public file list, and compares their extracted contents before moving the final artifact to its destination. The regression now includes arbitrary ignored, untracked, and staged source files plus a modified tracked file. Raw Composer filtering is still tested separately. The local Git isolation and mock-Composer orchestration checks passed; actual Composer execution remains to be verified by CI and re-review.
gachakra
left a comment
There was a problem hiding this comment.
Independent follow-up review
Both findings from the previous review are resolved on 49b3bad6623abcbf4e2782b3bc182b1ced796941. I found no remaining actionable issues and recommend merging.
- P1 — Composer root exclusions. Composer 2.11.3 excluded the previously reported infrastructure files as well as synthetic root dotfiles and a hidden directory. The Git TAR, GitHub source ZIP, and clean Composer TAR contained the same 22 files with identical contents. The lockfile remained tracked and unignored.
- P2 — Dirty source trees. The commit-based helper produced the same 22 files with identical contents when the checkout contained untracked, ignored, and staged files under
src/and a staged edit toREADME.md. Directcomposer archivestill included those working-tree files, so the commit-based helper is the release entry point. The CI fixture now exercises that boundary. - Independently passed
composer validate --strict,git diff --check,bash -n, anddocker compose config --quiet. The helper cleaned its temporary directory and rejected an existing output file. The library source, dependency constraints,composer.lock, documentation, and Docker configuration are unchanged. - Verified that PHP 8.4, PHP 8.5, and Docker development environment succeeded on the reviewed SHA. Both PHP jobs also passed the synthetic exclusions and commit-based packaging checks.
Summary
src/,composer.json,LICENSE,README.md, andREADME-ClassBased.mdonly. Explicitly cover dot-prefixed root paths in Composer's filters and exclude known local artifacts within allowed directories.composer.locktracked for development reproducibility while excluding it from distributions.src/.Creating a Composer archive
From a repository checkout, with Composer installed and an existing output directory outside the checkout:
The helper packages the selected commit rather than the index or working tree. Raw
composer archiveis not a tracked-only operation.Validation
Scope
Only repository infrastructure and distribution checks are changed. Existing PHP and Docker check names, library code, public API, dependency versions, lockfile contents, documentation, and published releases/tags are unchanged.