Repository navigation
dev: add fuzzing profiles - #328
Open
DecimalTurn wants to merge 17 commits into
Open
DecimalTurn wants to merge 17 commits into
DecimalTurn wants to merge 17 commits into
Conversation
Benchmark comparisonThis branch measured against Fixture Benchmark ResultsTime per iteration. Lower is better. Parse, smol-toml spec example (toml-spec-example.toml)
Parse, smol-toml 5MB mixed (5mb-mixed.toml)
Parse, iarna spec example v0.4.0 (0A-spec-01-example-v0.4.0.toml)
Stringify, smol-toml spec example (toml-spec-example.toml)
Stringify, smol-toml 5MB mixed (5mb-mixed.toml)
Stringify, iarna spec example v0.4.0 (0A-spec-01-example-v0.4.0.toml)
|
There was a problem hiding this comment.
🟡 Changes recommended
Format inconsistencies and scaffold-generation defects prevent reliable reproduction of fuzz failures.
5 open issues
Resolve generated imports relative to the output directory · New Preserve Date values when serializing generated mutations · New Generate property deletion for delete-key mutations · New Deep-clone mutation plan payloads when recording · New Disable randomized format generation for the AOT runner · New
What changed in this PR
Refactors patch fuzzing into composable profiles and adds focused arrays-of-tables coverage.
Changes:
- Extracts configurable generation, mutation, formatting and comparison strategies.
- Adds numbered runners, profile inspection and regression scaffolding.
- Adds deterministic tests and updates documentation and CI.
| File | Description |
|---|---|
src/__tests__/inspect-fuzz-seed.ts |
Adds profile inspection. |
src/__tests__/fuzz5.test.ts |
Tests structural seeds. |
src/__tests__/fuzz1.test.ts |
Tests baseline seeds. |
src/__tests__/fuzz-profiles.ts |
Defines composable profiles. |
src/__tests__/fuzz-patch5.ts |
Adds structural generation and mutations. |
src/__tests__/fuzz-patch4.ts |
Migrates date-focused configuration. |
src/__tests__/fuzz-patch3.ts |
Migrates layout configuration. |
src/__tests__/fuzz-patch2.ts |
Migrates dotted-key configuration. |
src/__tests__/fuzz-patch1.ts |
Adds numbered baseline entry point. |
src/__tests__/fuzz-patch.ts |
Extracts shared runner and metadata. |
src/__tests__/fuzz-composable.test.ts |
Checks composition and determinism. |
scripts/fuzz-run5.ts |
Adds structural seed sweeps. |
scripts/fuzz-run1.ts |
Adds numbered baseline sweeps. |
scripts/fuzz-run.ts |
Removes unnumbered runner. |
scripts/distill-profile.ts |
Generates regression scaffolds. |
package.json |
Updates fuzz commands. |
docs/PLAN-Composable-Fuzz-Harness.md |
Records architecture and migration plan. |
docs/Fuzz-Testing.md |
Documents variants and profiles. |
.github/workflows/test-and-build.yml |
Uses numbered baseline command. |
Review effort: Balanced
…ecture and migration strategy
DecimalTurn
force-pushed
the
dev-fuzz5
branch
from
October 24, 2026 15:54
b3a5164 to
c6bbcbf
Compare
DecimalTurn
marked this pull request as ready for review
October 29, 2026 19:48
There was a problem hiding this comment.
🟡 Changes recommended
Unrelated edits can trigger quadratic document scans, while array reconstruction can delete existing comments or apply incorrect formatting.
7 open issues
Avoid quadratic scans of unrelated AOT scopes · New Include source and patched TOML in successful results · New Dispatch variant 5 to fuzzOne5 with its default mutation count · New Propagate inlineTableStart through TomlDocument.patch · New Preserve comments when rebuilding existing AOT entries · New Scope style precedents to the owning AOT entry · New Cache converted CST data across Add operations · New
5 resolved since last review
Review effort: Balanced
Comment on lines
+1596
to
+1597
| for (const entry of original.items.filter(isTableArray)) { | ||
| const sections = findAotEntryScopeItems(original, entry).filter(item => isTable(item) || isTableArray(item)); |
| }; | ||
| } | ||
|
|
||
| return result; |
Comment on lines
+16
to
+29
| import { runProfile, type FuzzProfile } from './fuzz-profiles'; | ||
|
|
||
| const requestedProfile = process.argv.includes('--profile') | ||
| ? process.argv[process.argv.indexOf('--profile') + 1] | ||
| : process.argv.includes('--variant') && process.argv[process.argv.indexOf('--variant') + 1] === '5' | ||
| ? 'aot' | ||
| : undefined; | ||
|
|
||
| if (requestedProfile) { | ||
| const profile = requestedProfile as FuzzProfile; | ||
| const mutationIndex = process.argv.indexOf('--mutations'); | ||
| const profileMutationCount = mutationIndex >= 0 ? Number(process.argv[mutationIndex + 1]) : 3; | ||
| const profileSeed = Number(process.argv[2] || '42'); | ||
| const result = runProfile(profileSeed, profile, profileMutationCount); |
| indentWidthExplicit = false, | ||
| trailingCommaExplicit = true | ||
| trailingCommaExplicit = true, | ||
| inlineTableStartExplicit = false |
Comment on lines
+1645
to
+1646
| for (const section of oldSections.reverse()) { | ||
| removeMember(original, original, section); |
Comment on lines
+1703
to
+1705
| const tableArrayKey = parent_path.filter((part): part is string => typeof part === 'string'); | ||
| const aotStyle = aotStylePathsByKey.get(JSON.stringify(tableArrayKey)); | ||
| const preserveScopedSections = is_table_array && !inlineTableStartExplicit && !!aotStyle; |
| const tableArrayKey = parent_path.filter((part): part is string => typeof part === 'string'); | ||
| const aotStyle = aotStylePathsByKey.get(JSON.stringify(tableArrayKey)); | ||
| const preserveScopedSections = is_table_array && !inlineTableStartExplicit && !!aotStyle; | ||
| const updated_js = toJS(updated.items, '', { temporal }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Add composable fuzz profiles for
patch()and use structure-first generation to cover AOT layouts that the general TOML generator rarely produces. The new profiles exposed nested AOT formatting and mixed-array append cases, which this PR also fixes.Changes
aot,aot-format,aot-generalandgeneral-formatprofiles, plus a structure-first AOT generator and runner.Datevalues, replay key deletion, and snapshot recorded mutation plans.