Repository navigation
PDFCLOUD-6418: Upgrade repository quality scaffolding #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
db9f1d3
64edcf1
c4c5d31
357dde1
bfa6af5
f29fe21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # CIT quality tooling | ||
|
|
||
| This directory contains vendored contributor tooling, separate from project | ||
| source. It is maintained and tested in `cloud-innovation-team/cit-codex-skills`. | ||
| Executing the local copy requires no GitHub authentication or source-repository | ||
| access. | ||
|
|
||
| ## Provenance | ||
|
|
||
| - Installed file: `.cit-quality/vendor/check_nfc_filenames.py`. | ||
| - Upstream file: | ||
| `skills/cit-repository-quality-scaffolding/scripts/check_nfc_filenames.py`. | ||
| - Source revision: `2dbf02d13b73799d2fcf1d3c7bab0a8371fd82ee`. | ||
| - Source SHA-256: | ||
| `83d3bb79ebf3a5d6cb4f213f3af4421bd258693057514637ce87f3fc00a79056`. | ||
| - Upstream suite: | ||
| `skills/cit-repository-quality-scaffolding/scripts/test_scaffolding.py`. | ||
|
|
||
| The upstream behavioral suite tests rejection of non-NFC tracked filenames, | ||
| acceptance after a byte-preserving rename, and normalization collisions. It also | ||
| exercises the installed copy through the generated pre-commit hook. This | ||
| provenance identifies the source; rendering alone does not establish a passing | ||
| test run. Record the source revision and actual upstream validation in the PR. | ||
|
|
||
| ## Upstream validation | ||
|
|
||
| On 2026-10-07, three focused upstream tests passed: | ||
|
|
||
| - `test_vendored_checker_is_separate_from_project_source` (includes the | ||
| installed hook). | ||
| - `test_normalization_collision_is_reported_without_renaming`. | ||
| - `test_non_nfc_tracked_name_fails_hook_until_byte_preserving_rename`. | ||
|
|
||
| Command: | ||
| `uv run --script <skill>/scripts/test_scaffolding.py -v -n 2 -k "vendored_checker_is_separate or normalization_collision_is_reported or non_nfc_tracked_name_fails_hook_until_byte_preserving_rename" --durations=5`. | ||
|
|
||
| Result: `3 passed` on Python 3.13.11; rerun during this refresh. This is focused | ||
| validation, not a claim that the entire upstream suite or all checker failure | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Keep regression coverage in a publicly verifiable location This note acknowledges that the focused validation did not exercise every checker failure path, and this repository still contains no durable tests for the required quality gate. The cited upstream suite is not available to public contributors or reviewers. Please add local tests, or point to a public pinned source with equivalent tests, covering clean paths, non-NFC paths, normalization collisions, invalid UTF-8, unavailable/failed Git invocation, CLI exit codes, and diagnostics. |
||
| paths were exercised. | ||
|
|
||
| ## Review and updates | ||
|
|
||
| Review source provenance, updates, and the repository's hook integration. | ||
| Implementation tests are maintained upstream; duplicate project tests are not | ||
| required for an unchanged, upstream-tested copy. Local behavior changes require | ||
| normal implementation review and appropriate regression coverage. | ||
|
|
||
| Update the checker and this provenance note together from the scaffolding skill. | ||
| Preserve the copied bytes; contribute fixes upstream instead of editing the | ||
| vendored copy. Keep this directory out of project source, test discovery, | ||
| coverage, and distribution inputs where those tools would otherwise traverse it. | ||
| The `linguist-vendored` attribute classifies the code; it does not disable | ||
| GitHub review requirements. | ||
|
|
||
| Run the installed hook from the repository root: | ||
|
|
||
| ```shell | ||
| uvx --from pre-commit==4.6.2 pre-commit run check-nfc-filenames --all-files | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # /// script | ||
| # requires-python = ">=3.11" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Keep the required hook compatible with Python 3.10 The repository targets Python 3.10–3.14, and this script does not use any Python 3.11-only syntax or APIs. Declaring
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The SDK compatibility baseline and the contributor tooling baseline are different here. At this PR's head, I also verified that direct execution under Python 3.10 succeeds; explicitly selecting 3.10 through uv succeeds with the metadata warning you described. Lowering the requirement would be a reasonable portability improvement, but a 3.10-only contributor environment is outside the currently configured development baseline. I would treat this as a non-blocking suggestion rather than an SDK compatibility defect, and retain the current declaration and README wording. |
||
| # /// | ||
| """Reject tracked Git paths that are not UTF-8 NFC, including collisions.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import subprocess | ||
| import sys | ||
| import unicodedata | ||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
||
|
|
||
| def tracked_filename_report(root: Path) -> dict[str, Any]: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Add automated coverage for the checker’s failure paths This function is now part of the required quality gate, but the PR does not add regression tests for non-NFC paths, normalization collisions, invalid UTF-8, missing Git, or a failed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on the coverage gap: there are no automated tests for this checker in the current PR, and the manual validation does not provide lasting regression protection. Focused pytest cases for clean paths, non-NFC names, normalization collisions, invalid UTF-8, missing Git, and a failed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The NFC checking script is now injected in a location that is marked for not needing review. It's tested in the skill repository. |
||
| """Inspect raw index paths, not filesystem names or quoted Git status text.""" | ||
| process = subprocess.run( | ||
| ["git", "ls-files", "--cached", "-z"], | ||
| cwd=root, | ||
| check=False, | ||
| capture_output=True, | ||
| ) | ||
| if process.returncode != 0: | ||
| return { | ||
| "checked": False, | ||
| "error": process.stderr.decode("utf-8", errors="replace").strip(), | ||
| "issues": [], | ||
| "collisions": [], | ||
| } | ||
|
|
||
| paths: list[str] = [] | ||
| invalid_utf8: list[str] = [] | ||
| for raw_path in process.stdout.split(b"\0"): | ||
| if not raw_path: | ||
| continue | ||
| try: | ||
| paths.append(raw_path.decode("utf-8")) | ||
| except UnicodeDecodeError: | ||
| invalid_utf8.append(raw_path.decode("utf-8", errors="backslashreplace")) | ||
|
|
||
| by_nfc: dict[str, list[str]] = {} | ||
| for path in set(paths): | ||
| by_nfc.setdefault(unicodedata.normalize("NFC", path), []).append(path) | ||
| collisions = [ | ||
| {"nfc_path": normalized, "paths": sorted(originals)} | ||
| for normalized, originals in sorted(by_nfc.items()) | ||
| if len(originals) > 1 | ||
| ] | ||
| issues = [ | ||
| { | ||
| "path": path, | ||
| "nfc_path": normalized, | ||
| "collides_with": sorted(other for other in originals if other != path), | ||
| } | ||
| for normalized, originals in sorted(by_nfc.items()) | ||
| for path in sorted(originals) | ||
| if path != normalized | ||
| ] | ||
| return { | ||
| "checked": True, | ||
| "issues": issues, | ||
| "collisions": collisions, | ||
| "invalid_utf8": sorted(invalid_utf8), | ||
| } | ||
|
|
||
|
|
||
| def main() -> int: | ||
| """Print actionable failures for a local pre-commit hook.""" | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--repo", type=Path, default=Path.cwd()) | ||
| args = parser.parse_args() | ||
| report = tracked_filename_report(args.repo) | ||
| if not report["checked"]: | ||
| print(f"Cannot inspect tracked filenames: {report['error']}", file=sys.stderr) | ||
| return 2 | ||
| for issue in report["issues"]: | ||
| print(f"Non-NFC tracked path: {issue['path']!r} -> {issue['nfc_path']!r}") | ||
| if issue["collides_with"]: | ||
| print(f" Normalization collision with: {issue['collides_with']!r}") | ||
| for path in report["invalid_utf8"]: | ||
| print(f"Tracked path is not UTF-8: {path!r}") | ||
| return 1 if report["issues"] or report["invalid_utf8"] else 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "Version": "v3.4.0", | ||
| "Version": "v3.11.1", | ||
| "Verbose": false, | ||
| "Debug": false, | ||
| "IgnoreDefaults": false, | ||
|
|
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Remove private-source disclosure from the public repository
Current
mainrequires source, documentation, PR descriptions, and review comments to avoid naming or linking private components and repositories. This provenance block identifies an internal repository and internal implementation paths. Please replace it with public, self-contained provenance. Because the details also appear in this PR's commits and description, clean those surfaces too rather than only deleting the final-tree text.