Skip to content

instrument(parser): establish strategy/work receipt foundation (#9444) - #7332

Draft
EffortlessSteven wants to merge 1 commit into
agent/6982-stored-lexer-checkpointsfrom
agent/7072-truthful-incremental-work-receipts
Draft

instrument(parser): establish strategy/work receipt foundation (#9444)#7332
EffortlessSteven wants to merge 1 commit into
agent/6982-stored-lexer-checkpointsfrom
agent/7072-truthful-incremental-work-receipts

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Aug 12, 2026

Copy link
Copy Markdown
Member

Train position

Parser implementation train: #8700 — work-receipt W01
Controlling issue: #9444
Parent receipt controller: #7072

Restack ruling

This draft currently sits on the historical #6982 stored-checkpoint branch. Preserve its useful receipt work, but restack the W01 semantic slice off that dependency after #7292 and the live parser-work authority #8757/#8786 are current.

The restacked PR must not include #6982 checkpoint implementation merely because it is in this branch’s ancestry. Checkpoint-specific work moves to #7758. This PR is the shared receipt/invocation foundation needed by conservative fresh_full_parse as well as later incremental strategies.

Claim

Canonical parser operations carry one versioned per-strategy work receipt that records real parser invocations and authoritative live parser-work fields, with every other strategy-specific plane explicitly not_applicable, partial, or not yet instrumented rather than fabricated as zero.

Current correction

Review of the first candidate found false precision:

  • final AST population was used as nodes_constructed;
  • clone/patch/comparison fields were reported as zero without observing those operations;
  • checkpoint invalidation/decision fields could default to zero without a complete denominator;
  • unchanged-result observation/clone work was not represented.

The restack must remove those claims. #7757 completes AST work; #7758 completes checkpoint/no-op/observation work.

Intended changes

Boundary

This PR does not implement:

A fresh_full_parse receipt may be complete while checkpoint fields are non-applicable. That is required so parser reliability does not wait on incremental checkpoint work.

Validation

Use current equivalents of:

cargo fmt --all -- --check
cargo test --locked -p perl-parser-core --all-targets
cargo test --locked -p perl-parser --features incremental --all-targets
python3 scripts/ci/run_parser_integration.py
cargo clippy --locked -p perl-parser-core -p perl-parser --all-targets -- -D warnings
git diff --check

Closes #9444
Refs #7072
Refs #7757
Refs #7758
Refs #8171
Refs #7045

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 244673ec-e438-4a48-a8cd-a5219c795324

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: not ready as work/benchmark authority. The receipt vocabulary separates the right categories, but several populated values are inferred constants or final-state sizes rather than observations of performed work. That is more dangerous than leaving them unknown because #7099 and claim cleanup will treat the receipt as ground truth. Instrument the actual construction, cloning, checkpoint-selection, and validation sites—or make unsupported fields explicitly unavailable—before publication.

pub(crate) fn refresh_parse_output(&mut self) -> ParserInvocationReceipt {
let mut parser = Parser::new(self.source());
let parse_output = parser.parse_with_recovery();
let nodes_constructed = parse_output.ast.count_nodes();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] ast.count_nodes() measures the size of the final retained tree, not how many nodes the parser constructed. Recovery/backtracking may construct and discard additional nodes, so this value cannot support a performed-work claim. The next line also clones the full AST into the compatibility mirror, while the receipt later reports nodes_cloned = 0. Instrument construction and publication cloning at their actual sites, or rename these to final-tree size and make clone work explicit/unknown.

nodes_patched: 0,
nodes_compared_only: 0,
checkpoints_restored,
checkpoints_invalidated: 0,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] This field is documented as rejected or invalidated checkpoint candidates but is hard-coded to zero. The selection loop can reject multiple stored checkpoints for source identity, timeout sensitivity, edit overlap, or restore validity before choosing an earlier one or falling back. Count those decisions with stable reason tokens and carry them into the receipt; otherwise the fallback/eligibility envelope is systematically understated.

0,
state.source().len(),
state.tokens().len(),
state.parse_output().ast.count_nodes(),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] The Unchanged path walks the entire AST to compute final_node_count, and then clones ParseOutput for the returned result, yet the receipt says zero analysis/validation work and zero cloned nodes. A no-op edit should either reuse stored counts and return an identity-backed snapshot, or account for this traversal and clone. As written, the supposedly zero-work path can be O(AST size) while reporting no work.

@EffortlessSteven EffortlessSteven changed the title instrument(parser): add incremental strategy and work receipts (#7072) instrument(parser): establish strategy/work receipt foundation (#9444) Aug 14, 2026

Copy link
Copy Markdown
Member Author

Read-only stale-PR preparation (live base fdfe5f1): disposition PREREQUISITE_BOUND. The receipt concept remains relevant, but required parser authorities and consumers are not all landed; the current head also retains challenged zero/inferred measurements. Reconcile prerequisites and split the receipt ownership before rebuilding this slice. No mutation was made.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Disposition (campaign #11869 stale-queue sweep, 2026-08-21): REPAIR_EXISTING_CANDIDATE

Idle >3h → reclaimable per umbrella #11869 queue policy.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Disposition: REPAIR (campaign #11869 stale-PR sweep, 2026-08-21). Stacked on #7324 (itself conflicting with main); advancing standalone would build on a stale stack. Wake event: #7324 rebased and green; then rebase this slice.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Disposition (campaign #11869 stale-queue sweep, 2026-08-22): REPAIR_EXISTING_CANDIDATE (stack-gated) — reconciles the two 2026-08-21 packets; dependency states re-verified.

source basis: head 0dc07e77 (+442/−126 across 7 files) vs current main
claim checked: parser strategy/work receipt foundation (#9444, open)
current disposition: REPAIR_EXISTING_CANDIDATE - repair in place via the recorded restack ruling once its gates open
current-main interaction: none superseding - no merged implementation owns strategy/work receipts (searched); restack is explicit stack-prerequisite movement
unique value: versioned per-strategy receipt vocabulary with per-plane applicability/completeness, real invocation counting at actual entry points, not_applicable/partial/not-yet-instrumented honesty rules, #8786 counter reuse instead of duplication
concrete defects/blockers: mergeable CONFLICTING on historical #6982 ancestry it must shed; false-precision fields recorded in body must be removed in the W01 slice; gate authorities #8757 and #8786 both still open (verified 2026-08-22), as are accounting leaves #7757/#7758
proof run: none this sweep (read-only)
review currentness: standing review current; restack refreshes affected dimensions only
base-reconciliation reason: deferred until gates land - then restack off checkpoint ancestry per the recorded ruling rather than rebasing the contaminated stack
merge/close rationale: none - truthful receipt substrate absent from main; issue open
follow-up: resume when #7324 is reconciled AND #8757/#8786 land; then deliver the narrowed W01 slice without checkpoint implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant