Adopt the rules-swift pin-and-codify strategy in snapshot mode (third_party/rules-swift @97dc70f + sha256), add codified gates, a conformance audit ledger, and .github/workflows/rules-swift.yml (corpus-pin integrity required, full gate report mode). Remove the docs/rules mirror it supersedes (repo-specific files kept under docs/). Style and leak gates exclude the vendored corpus.
7.8 KiB
rules-swift Audit
Date: 2026-06-30
This audit checks PureXML against the Swift rule set at
https://github.com/mihaelamj/rules-swift. It separates mechanical proof from
architecture findings. Fill every row before claiming conformance. A row left at
Gap or Partial keeps scripts/check-rules-swift.sh red, which is the
intended behavior until the repo actually conforms.
Current Verdict
| Area | Status | Evidence |
|---|---|---|
| Codified mechanical rules | Pass | scripts/check-rules-swift.sh wires leak, corpus-coverage, namespacing, validation-coverage, target pairing, and anti-pattern greps |
| Local mechanical gates | Pass | scripts/check-local-gate.sh runs the rules gate, style gate, build, and tests |
| Hook installation | Pass | .githooks/commit-msg and .githooks/pre-commit present; scripts/install-hooks.sh verifies rejection |
| Formatting and linting | Pass | .swiftformat and .swiftlint.yml committed; SwiftFormat runs before SwiftLint |
| Tests | Pass | Tests/ and PublicAPITests/ carry the parser, emitter, schema, and conformance suites |
| Validation coverage gate | Pass | scripts/check-validation-coverage.sh over docs/validation-coverage-registry.txt |
| Public CI backstop | Pass | .github/workflows/rules-swift.yml plus existing style and per-OS build workflows |
| Pre-UI layer | Not applicable | Headless library; no UI target |
| DocC documentation | Gap | DocC coverage not yet audited against documentation.md |
| Multi-renderer UI proof | Not applicable | No UI or renderer layer in this package |
Public Corpus Coverage
Rules corpus last read: 2026-06-30 (pinned snapshot 97dc70f).
Rules corpus file count: 68.
The local gate verifies that every Markdown or shell file in the public
rules-swift checkout selected by RULES_SWIFT_DIR is named in this section and
that the pinned snapshot digest matches docs/rules-swift-corpus.sha256. That
does not mean every rule is fully satisfied; it means no public rule source can
be silently omitted.
| Public rule source | Coverage |
|---|---|
.github/pull_request_template.md |
Vendored, pinned |
business-rules-and-constraints.md |
Vendored, pinned |
CHANGELOG.md |
Vendored, pinned |
code-style.md |
Vendored, pinned |
concurrency.md |
Vendored, pinned |
CONTRIBUTING.md |
Vendored, pinned |
CONVENTIONS.md |
Vendored, pinned |
core/brainstorming.md |
Vendored, pinned |
core/commits.md |
Vendored, pinned |
core/file-naming.md |
Vendored, pinned |
core/first-principles-analysis.md |
Vendored, pinned |
core/folder-grouping.md |
Vendored, pinned |
core/git-discipline.md |
Vendored, pinned |
core/no-shortcuts-first-principles.md |
Vendored, pinned |
core/oracle-first.md |
Vendored, pinned |
core/proof-discipline.md |
Vendored, pinned |
core/README.md |
Vendored, pinned |
core/round-trip-transformation.md |
Vendored, pinned |
core/rules.md |
Vendored, pinned |
core/self-improve.md |
Vendored, pinned |
core/systematic-debugging.md |
Vendored, pinned |
core/testing-discipline.md |
Vendored, pinned |
core/verification.md |
Vendored, pinned |
core/writing-plans.md |
Vendored, pinned |
cross-platform.md |
Vendored, pinned |
dependency-injection.md |
Vendored, pinned |
documentation-search.md |
Vendored, pinned |
documentation.md |
Vendored, pinned |
domain-first.md |
Vendored, pinned |
exp/app-target.md |
Vendored, pinned |
exp/build-performance.md |
Vendored, pinned |
exp/common-mistakes.md |
Vendored, pinned |
exp/critical-rules.md |
Vendored, pinned |
exp/dependency-management.md |
Vendored, pinned |
exp/implementation-patterns.md |
Vendored, pinned |
exp/migration.md |
Vendored, pinned |
exp/package-swift.md |
Vendored, pinned |
exp/README.md |
Vendored, pinned |
exp/testing.md |
Vendored, pinned |
exp/verification.md |
Vendored, pinned |
exp/when-to-create.md |
Vendored, pinned |
formatting-and-linting.md |
Vendored, pinned |
framework-policy.md |
Vendored, pinned |
linux-server.md |
Vendored, pinned |
namespacing.md |
Vendored, pinned |
openapi-generated.md |
Vendored, pinned |
package-architecture.md |
Vendored, pinned |
package-import-contract.md |
Vendored, pinned |
package-structure.md |
Vendored, pinned |
parsing-rules.md |
Vendored, pinned |
README.md |
Vendored, pinned |
scripts/check-namespacing.sh |
Vendored, pinned |
scripts/leak-gate.sh |
Vendored, pinned |
shared-protocols.md |
Vendored, pinned |
testing.md |
Vendored, pinned |
ui/appkit-views.md |
Vendored, pinned |
ui/colors.md |
Vendored, pinned |
ui/components.md |
Vendored, pinned |
ui/flowspec.md |
Vendored, pinned |
ui/fonts.md |
Vendored, pinned |
ui/native-per-platform.md |
Vendored, pinned |
ui/pom.md |
Vendored, pinned |
ui/pre-ui-layer.md |
Vendored, pinned |
ui/swiftui-views.md |
Vendored, pinned |
ui/three-renderers.md |
Vendored, pinned |
ui/uikit-views.md |
Vendored, pinned |
ui/view-models.md |
Vendored, pinned |
validation-rules.md |
Vendored, pinned |
Rule Matrix
| Rule file | Applies | Status | Evidence or gap |
|---|---|---|---|
core/no-shortcuts-first-principles.md |
yes | Pass | scripts/check-rules-swift.sh greps Sources/ and Tests/ for shortcut patterns |
namespacing.md |
yes | Pass | scripts/check-namespacing.sh: one public type per file under PureXML |
package-architecture.md |
yes | Pass | target/test-target pairing enforced in scripts/check-rules-swift.sh |
package-structure.md |
yes | Pass | root Package.swift, root Sources/, root Tests/ |
cross-platform.md |
yes | Pass | macOS, Linux, Windows, WASI build workflows under .github/workflows/ |
validation-rules.md |
yes | Pass | scripts/check-validation-coverage.sh over the coverage registry |
framework-policy.md |
yes | Pass | banned-stack octal scan in scripts/check-rules-swift.sh |
testing.md |
yes | Pass | parser, emitter, schema, and W3C conformance suites under Tests/ |
documentation.md |
yes | Gap | DocC coverage not yet audited |
ui/* |
no | Not applicable | headless library, no UI layer |
exp/package-swift.md |
no | Not applicable | single-target package, no exp closure manifest |
Required Remediation
- Audit DocC coverage against
documentation.mdand resolve thedocumentationrow. - The public leak gate (
scripts/leak-gate.sh) flags the repo's pre-existing Antigravity onboarding content (GEMINI.md,docs/onboarding-antigravity.md, and the Antigravity references inAGENTS.md). These are owner-managed and out of scope for this additive adoption; resolve with the maintainer whether to whitelist them in the gate or relocate the content. - Repoint the two remaining
docs/rules/links indocs/onboarding-antigravity.md(owner-managed) tothird_party/rules-swift/anddocs/research-first.md.
Until those items are complete, state the honest status: PureXML has strict rule
enforcement wired in, and that enforcement correctly fails while the repo does
not yet fully conform to the entire rules-swift corpus.