classGenerationTrace
final class GenerationTrace
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Retains only the latest generation's occurrence paths and diagnostic attempt boundaries.
Type Aliases§
Event = array{generationId: int, attemptId: int, nodeId: int, parentNodeId: int|null, rhsPosition: int|null, ruleId: string, productionId: string, selectionReason: string}Attempt = array{id: int, events: list<Event>, status: string, error: string|null, sqlHash: string|null}Trace = array{generationId: int, root: string, planSummary: array<string, int|string|bool|null>, attempts: list<Attempt>, lexicalEvents: list<string>, features: array<string, list<string>>, candidateSources: array<int, list<string>>, candidateConditions: array<int, array{left: array{allowed: int, rules: list<string>}|null, boundaries: array<int, array{allowed: int, rules: list<string>}>}>, candidateRejections: list<array{index: int, candidate: string, rules: list<string>}>, rewriteOperations: list<Rewrite>, rewrites: list<string>, spacingEvents: list<array{candidate: string, separator: string, allowed: int, rules: list<string>}>, status: string, reachedIds: list<string>, emittedIds: list<string>}Rewrite = import from LexicalObservationProperties§
public Trace $valueMethods§
public function __construct(int $id, string $root, array<string, int|string|bool|null> $plan)Begins a fresh trace without consuming Faker randomness.
Parameters
$id | int | |
$root | string | |
$plan | array<string, int|string|bool|null> |
Test cases 8
GenerationTraceTest::testBeginAttemptStartsWithNoSelectionscoversGenerationTraceTest::testCommitIncludesOnlyTheSuccessfulAttemptcoversGenerationTraceTest::testCommittedTraceSurvivesEndAndDeduplicatesRepeatedProductionscoversGenerationTraceTest::testDiscardRetainsFailedSelectionsAndTheirErrorcoversGenerationTraceTest::testEndFinalizesAnInterruptedGenerationcoversGenerationTraceTest::testEndingBeforeAnyAttemptDoesNotInventAnAttemptOrProductioncoversGenerationTraceTest::testRecordDistinguishesSiblingOccurrencesWithTheSameRulecoversGenerationTraceTest::testTraceAndEventsRetainThePublicDiagnosticIdentitycovers
Calls 1
- function-call
is_stringline 36
public function beginAttempt(int $id): voidOpens a diagnostic attempt; the standard generator makes one attempt per call.
Parameters
$id | int |
Test cases 7
GenerationTraceTest::testBeginAttemptStartsWithNoSelectionscovers and callsGenerationTraceTest::testCommitIncludesOnlyTheSuccessfulAttemptcovers and callsGenerationTraceTest::testCommittedTraceSurvivesEndAndDeduplicatesRepeatedProductionscovers and callsGenerationTraceTest::testDiscardRetainsFailedSelectionsAndTheirErrorcovers and callsGenerationTraceTest::testEndFinalizesAnInterruptedGenerationcovers and callsGenerationTraceTest::testRecordDistinguishesSiblingOccurrencesWithTheSameRulecovers and callsGenerationTraceTest::testTraceAndEventsRetainThePublicDiagnosticIdentitycovers and calls
public function record(
int $node,
?int $parent,
?int $position,
string $rule,
string $production,
string $reason,
): voidRecords a selection before its occurrence is expanded.
Parameters
$node | int | |
$parent | ?int | |
$position | ?int | |
$rule | string | |
$production | string | |
$reason | string |
Test cases 5
GenerationTraceTest::testCommitIncludesOnlyTheSuccessfulAttemptcovers and callsGenerationTraceTest::testCommittedTraceSurvivesEndAndDeduplicatesRepeatedProductionscovers and callsGenerationTraceTest::testDiscardRetainsFailedSelectionsAndTheirErrorcovers and callsGenerationTraceTest::testRecordDistinguishesSiblingOccurrencesWithTheSameRulecovers and callsGenerationTraceTest::testTraceAndEventsRetainThePublicDiagnosticIdentitycovers and calls
Calls 1
- function-call
countline 52
public function discard(string $error): voidMarks a failed attempt without losing its reached paths.
Parameters
$error | string |
Test cases 4
GenerationTraceTest::testCommitIncludesOnlyTheSuccessfulAttemptcovers and callsGenerationTraceTest::testDiscardRetainsFailedSelectionsAndTheirErrorcovers and callsGenerationTraceTest::testEndFinalizesAnInterruptedGenerationcoversGenerationTraceTest::testEndingBeforeAnyAttemptDoesNotInventAnAttemptOrProductioncovers and calls
Called from 1
Calls 1
- function-call
countline 67
public function commit(string $hash, list<int>|null $nodes = null): list<string>Credits emitted productions only to the attempt returning SQL.
Parameters
$hash | string | |
$nodes | list<int>|null | Source occurrences preserved in the output |
Returns
list<string>Test cases 3
public function end(): voidFinalizes failed generations, including failures before lexical realization.
Test cases 3
Calls 2
- function-call
countline 106 - method-call GenerationTrace::discard() line 108
Private surface 1§
Implementation details, listed for orientation only.
private array<string, true> $reached = []Test cases 15§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
GenerationTraceTest::testBeginAttemptStartsWithNoSelectionscovers and callsGenerationTraceTest::testCommitIncludesOnlyTheSuccessfulAttemptcovers and callsGenerationTraceTest::testCommittedTraceSurvivesEndAndDeduplicatesRepeatedProductionscovers and callsGenerationTraceTest::testDiscardRetainsFailedSelectionsAndTheirErrorcovers and callsGenerationTraceTest::testEndFinalizesAnInterruptedGenerationcovers and callsGenerationTraceTest::testEndingBeforeAnyAttemptDoesNotInventAnAttemptOrProductioncovers and callsGenerationTraceTest::testRecordDistinguishesSiblingOccurrencesWithTheSameRulecovers and callsGenerationTraceTest::testTraceAndEventsRetainThePublicDiagnosticIdentitycovers and calls
Other tests reaching this symbol 7
ByteChoicesTestcallsCoverageSnapshotStoreTestcallsGrammarCoverageInventoryTestcallsGrammarCoverageTestcallsSnapshotValidationTestcallsDerivationNodeTestcallsSqlGeneratorTestcalls