- README, roadmap: XSTS status quad and gates table now read the enforced 0/43/0/31 (Tests/XSTSSuiteTests.swift); test count 986/169 to 1448/258; encoding list and the remaining-work section reflect shipped reality; check-all expansion lists the validation and changelog gates - GEMINI.md, onboarding-antigravity.md: valid-schemas-rejected 1 to 0 and the pinned baselines updated to current - SECURITY.md: complete the reporting address - Parsing.InputEncoding: doc comment lists the full shipped encoding set - Schema.XSDParserUnion: guard the localName interpolation with ?? "" to match the same line and silence an optional-interpolation warning (internal dedup key, behavior preserving) - CHANGELOG: Unreleased entries for the above
3.8 KiB
GEMINI.md, always-on rules for Antigravity agents in PureXML
These rules are always in effect. The full, step-by-step procedure is in
docs/onboarding-antigravity.md, read it before your first change. When a
rule here and a guideline elsewhere conflict, this file wins.
The prime directive
PureXML is an XML/XSD validator. Never reject a valid schema or a valid
document. In the conformance counts this is valid-schemas-rejected; it is
0 and must never rise. Under-rejecting (missing an invalid schema) is
acceptable; over-rejecting (rejecting a valid one) is a failure and must not be
merged. When unsure, do less.
Hard constraints (never violate)
- No external SwiftPM dependencies. No C/C++/Objective-C/JavaScript/generated runtime. Pure Swift only.
- Public API stays under the
PureXMLnamespace tree. - Must build on macOS, Linux, and WASI.
- Reference implementations are for reading only, never copying (clean-room).
- Tests import only
Foundation,Testing, and@testable import PureXML.
Per-change procedure (do every step; details in the onboarding doc §6)
- Measure first: read
/tmp/xsts-failures.txt, pick a family, read the actual.xsdfiles before coding. Do one rule per change. - Implement conservatively in
Sources/Schema/; return[String]errors; wire into an aggregator inSchemaIDAttribute.swift. - Add unit tests (one rejected case + several accepted cases). Write the test file before launching the release XSTS run.
- Run all gates (build,
swiftformat --lint,swiftlint --strict,check-style.sh,check-namespacing.sh,swift test,check-wasm.sh). - Run the conformance differential:
XSTS_ROOT=/private/tmp/xsts/xmlschema2006-11-06 swift test -c release --filter XSTS.invalid-schemas-acceptedmust go DOWN and no other bucket may rise. - Run an adversarial critic that tries to construct a valid schema your change rejects. Fix any false positive before merging. (Mandatory.)
- Update the pinned baseline in
Tests/XSTSSuiteTests.swift, add aCHANGELOG.mdentry, updatedocs/schema-validity-burndown.md. - Branch off
main, commit,git merge --ff-only, push to GitHub.
The traps that recur (onboarding doc §8)
- Namespace conflation: resolve a name's namespace with
XSDNode.referenceNamespace(ref, bindings); never just strip the prefix. A built-in (xs:*) or imported component must not be confused with a same-local-name user one. This has caused false positives 7+ times. - swiftformat vs swiftlint brace conflict: extract a multi-condition
ifinto aBoolhelper; turn a longfor ... whereintoguard ... continue. - Limits: file ≤ 400 lines, type body ≤ 250, cyclomatic ≤ 10, params ≤ 5, line ≤ 180. Split into new files/helpers; bundle args into a labeled tuple.
- Read schema attributes unprefixed (
prefix == nil); skip foreign-namespace nodes andxs:appinfo/xs:documentation.
Commit discipline (never violate)
- Commit format:
type(scope): summary. No em dashes anywhere. - No AI attribution of any kind in commits, PRs, branches, code, or docs (no
"Generated with", no "Co-Authored-By", no mention of Gemini/AI/agent). All work
reads as human-authored. (
docs/onboarding-antigravity.mdis the sole exception, explicitly requested.) - Never push to a GitLab remote. GitHub remotes only; check the URL first.
- Merge to
main--ff-only. The pre-push hook runsswift testand a commit-message check.
Definition of done
All gates green; conformance differential shows invalid-accepted down and no other bucket up (valid-rejected still 0); the critic found zero false positives; baseline/CHANGELOG/burndown updated. If you rejected even one valid schema, the change is wrong regardless of how many invalid ones it caught.