Repository navigation
Description
Context & Rationale
The failures found by hand this release were nearly all boundary cases in parsing and path handling: Path.relative_to accepting .., fnmatch reading [host]:port as a character class, lstrip("./") stripping a character set, porcelain output shifted by one stripped space. Each was found by reading code. Each is the kind of input a property test generates in seconds.
Scope & Deliverables
- Context & Rationale*: The failures found by hand this release were nearly all boundary cases in parsing and path handling:
Path.relative_toaccepting..,fnmatchreading[host]:portas a character class,lstrip("./")stripping a character set, porcelain output shifted by one stripped space. Each was found by reading code. Each is the kind of input a property test generates in seconds. - Deliverable*: Property-based tests over the parsing surfaces — ignore rules,
known_hostsentries, service URLs, SARIF documents, git porcelain output, review JSON — asserting the invariants those parsers claim rather than specific outputs. Generated corpora persist so a discovered failure becomes a regression case. - Constraint*: A property test that asserts what the implementation does rather than what the format requires passes forever and finds nothing. Each property has to come from the specification: gitignore(5), the
sshdmanual, SARIF 2.1.0.
Strategic Alignment
- Milestone:
v0.2.23(Foundational Architectural Guardrails & Project Hygiene) - Roadmap Reference:
docs/ROADMAP.md
Update 2026-10-08: refinement
Hypothesis is already a dev dependency (pyproject.toml:84). Per #1307 Q21 this item fuzzes parsers; URL and ignore rules go to #1333, URL parsing to #1112, and #1114 deletes known_hosts. It keeps SARIF (security/sarif.py:238, :474, :508), the git parsers (core/cleanup.py:76-88, ci/cache.py:164-185, argo/gitops.py:228-233) and review JSON; each failure found stays as an @example.
- Docstrings cite the specification clause; the tests add at most 1 s.
Proposed design
Problem statement
The project's parsing code for SARIF documents, git porcelain output, and review JSON has boundary-case bugs (e.g. fnmatch misreading [host]:port, lstrip stripping a character set, porcelain output shifted by one space) that were only found by manual code reading. Property-based tests grounded in the relevant specifications (SARIF 2.1.0, git's documented porcelain format, the review JSON schema) would find such bugs automatically in seconds and persist each discovered failure as a regression case, rather than relying on a developer to notice the edge case by reading the code.
Acceptance criteria
- Criterion 1: Property-based tests exist for the SARIF parsing surface (security/sarif.py lines 238, 474, 508) with every property derived from a clause of the SARIF 2.1.0 specification.
Verification: Run pytest on the new SARIF property test file; each test function's docstring names the SARIF 2.1.0 section it encodes, and the test uses hypothesis strategies to generate SARIF documents and assert the invariant stated in that section. - Criterion 2: Property-based tests exist for the git porcelain parsing surfaces (core/cleanup.py lines 76-88, ci/cache.py lines 164-185, argo/gitops.py lines 228-233) with properties derived from git's documented porcelain output format.
Verification: Run pytest on the new git-parser property test files; each test's docstring cites the git(1) or git porcelain documentation clause, and the test generates porcelain-shaped strings and asserts the parser's invariant. - Criterion 3: Property-based tests exist for the review JSON parsing surface with properties derived from the review JSON schema.
Verification: Run pytest on the new review-JSON property test file; the test generates JSON documents and asserts the schema invariants the parser claims. - Criterion 4: Every property test docstring cites the specific specification clause (SARIF 2.1.0 section, git porcelain format, or review JSON schema field) that the property encodes.
Verification: Grep the new test files for docstrings; each@givenor@example-decoratedfunction has a docstring containing a specification reference (e.g. 'SARIF 2.1.0 §3.2.7', 'git porcelain v2', 'review JSON schema field X'). - Criterion 5: Any failure discovered during fuzzing is preserved as an
@exampledecorator on the corresponding property test so it becomes a permanent regression case.
Verification: If a hypothesis failure is found during development, the test file contains an@exampledecorator with the failing input; running pytest reproduces the failure deterministically. - Criterion 6: The new property tests add at most 1 second to the total test suite runtime.
Verification: Run the full test suite with and without the new tests (e.g. pytest --durations=0); the difference in total wall-clock time is ≤ 1 s. - Criterion 7: The new test files are placed in directories mirroring the source tree (tests/security/, tests/core/, tests/ci/, tests/argo/, tests/review/) per the project's test conventions.
Verification: List the new test files; each sits in the tests/ subdirectory that mirrors the src/ package it tests, consistent with the convention in test(cli): tests double only process edges and mirror the source tree #1307.
Key questions
- Which parsers are in scope for this item?: SARIF parsing (security/sarif.py:238, :474, :508), git porcelain parsing (core/cleanup.py:76-88, ci/cache.py:164-185, argo/gitops.py:228-233), and review JSON parsing. URL parsing, ignore rules, and known_hosts are explicitly excluded to fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112, test(cli): Use edge fakes and real git; drop test rebind hooks #1333, and fix(git): GitHub clones trust GitHub's published host keys through OpenSSH, so junk known_hosts lines and a failed key scan no longer skip pinning #1114 respectively. [sources: docs/agent/tasks/task-416-structured-fuzzing-of-parsers-and-schema-boundaries.md]
- What specifications ground the properties?: SARIF 2.1.0 for the SARIF parser, git's documented porcelain output format for the git parsers, and the review JSON schema for the review JSON parser. A property that merely asserts what the implementation does rather than what the format requires is rejected. [sources: docs/agent/tasks/task-416-structured-fuzzing-of-parsers-and-schema-boundaries.md]
- How are discovered failures persisted as regression cases?: Each failure found during fuzzing is added as an
@exampledecorator on the corresponding property test, so the failing input is replayed deterministically on every subsequent test run. [sources: docs/agent/tasks/task-416-structured-fuzzing-of-parsers-and-schema-boundaries.md] - What is the time budget for the new tests?: At most 1 second added to the total test suite runtime. [sources: docs/agent/tasks/task-416-structured-fuzzing-of-parsers-and-schema-boundaries.md]
- Where do the new test files live?: In directories mirroring the source tree (tests/security/, tests/core/, tests/ci/, tests/argo/, tests/review/), following the convention established in test(cli): tests double only process edges and mirror the source tree #1307 that tests mirror the source tree and double only process edges. (proposed) [sources: docs/ROADMAP.md]
- Is Hypothesis already available as a dependency?: Yes. Hypothesis is listed as a dev dependency at pyproject.toml line 84, so no new dependency needs to be added. [sources: pyproject.toml:84]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Sep 30, 2026
Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.
dan-petty commentedon Oct 3, 2026
Drop
known_hostsentries from the fuzzing targets once #1114 lands. #1114 deletes the in-process known_hosts parser and key fingerprinting (crypto/known_hosts.py, 272 lines, andcrypto/host_keys.py, 163 lines, at dcafadf). It writes GitHub's published known_hosts lines to~/.ssh/known_hostsand leaves every known_hosts decision to OpenSSH, so no parser of ours is left to fuzz. The sshd(8) manual then leaves the list of specifications this item's properties come from, unless another target still needs it.dan-petty-bot commentedon Oct 10, 2026
Status set to Ready at 69c99cf (see proposed design in issue body).
feat(cli): structured fuzzing of parsers and schema boundaries (#416) (…
feat(release): v0.2.35 (#1581)