Repository navigation
Description
exporter/packet-emitter: map FileFactShard -> ripr-perl-facts-v1 packet
Campaign: #1379 (Campaign 31)
Work item: exporter/packet-emitter (Lane 1 — producer / perl-lsp side)
Tracker: .ripr/goals/perl-repair-routing.toml
Repo: EffortlessMetrics/perl-lsp (active dev tree: perl-lsp-swarm)
Branch: exporter/perl-ripr-facts-emitter
Depends on: exporter/schema-file, exporter/launch-action
Problem
perl-lsp already produces a serde-serializable FileFactShard (crates/perl-workspace/src/workspace/workspace_index.rs:1138-1169, assembled in crates/perl-workspace/src/semantic/facts.rs:68-77) containing anchors, entities, occurrences, edges, import specs, provenance, dynamic-boundary occurrences, and per-category change hashes (PRODUCER_SCHEMA_VERSION=1). This is mature substrate.
But there is no code that maps this internal fact model into the ripr-perl-facts-v1 packet shape ripr consumes. The exporter action from exporter/launch-action currently stubs to a not-yet-implemented error.
Scope (perl-lsp repo)
Implement the emitter body: take the parsed/indexed Perl workspace facts and produce a ripr-perl-facts-v1 packet matching the schema from exporter/schema-file.
Mapping (FileFactShard -> ripr-perl-facts-v1)
The packet shape ripr consumes (per its perl.rs:157 PerlFactPacket and the reference expected packet) needs these arrays with closed-vocabulary enums:
files— from FileFactShard file metadata; assignFileRole(Source/Test/Helper/Generated/Config/Unknown)..tfiles → Test;.pm/.pl→ Source;Makefile.PL/Build.PL/cpanfile→ Config.owners— from entity facts; map toOwnerKind(Package/Sub/Method/Script/ModuleInitializer/TestSub/Unknown). Includes package/name + byte range.changes— derive from the diff (base..head) intersected with owner ranges; assignBehaviorHint(PredicateBoundary/ReturnValue/ExceptionPath/HashOrObjectField/OutputObserver/WarnObserver/LogObserver/CallEffect/Unknown) by inspecting the changed AST node.tests— from test-discovery facts; assignTestFramework(Test::More/Test2::V0/Test2::Suite/Test::Exception/Test::Fatal/unknown) andRunnerHint.oracles— from test-body assertion extraction; assignOracleKind+OracleStrength. This is the hardest mapping; start with what perl-lsp already extracts and map conservatively (unknown > wrong).relations— from edge facts (call/reference/proximity); assignRelationKind+ReachabilityHint.dynamic_boundaries— from the existing dynamic-boundary occurrences (eval_sub_extractor.rs,queries.rs:173-204); assignBoundaryKind(14 closed values).verify_commands— derive from detected runner (prove/yath/carton/dzil) + test paths.limitations— emit one per dynamic boundary or extraction gap.provenance— from FileFactShard provenance withProvenanceSourcemapping.
Top-level packet fields
schema_version = "ripr-perl-facts-v1"packet_id— deterministic hash of inputs (root + base + head + fact_classes + content hashes).packet_status— Complete/Partial/Unavailable.packet_fingerprint— content hash for freshness checks (ripr'singestion/integrity-checkswill verify this).producer— name="perl-lsp", version, capabilities (the fact_classes actually emitted).root,input— repo-relative, no host/drive paths.
The load-bearing test
The packet perl-lsp emits from ripr's sample input (fixtures/perl_lsp_facts_exporter/input/lib/My/App.pm + input/t/app.t) must match (or be a strict superset of) ripr's hand-authored expected/ripr-perl-facts-v1.json. This is the integration contract. If the live packet diverges meaningfully from the hand-authored one, coordinate with the ripr consumer side — either the hand-authored packet was aspirational (update it in a coordinated ripr PR) or the emitter is wrong (fix the emitter).
Failing fixture / proof
# perl-lsp repo
cargo test -p perl-lsp-rs-core
cargo test -p perl-workspaceAdd a perl-lsp integration test that:
- Runs the emitter on the sample input (vendor a copy of
fixtures/perl_lsp_facts_exporter/input/into perl-lsp's test fixtures to avoid cross-repo runtime deps). - Validates the output against
schemas/ripr-perl-facts-v1.json. - Diffs against the reference expected packet — assert field-by-field equivalence on the closed-vocabulary fields, or document and coordinate any intentional divergence.
Run the actual binary:
perl-lsp --ripr-facts --schema ripr-perl-facts-v1 --root <sample> --out facts.json
cat facts.json # inspectAcceptance
- Emitter produces a schema-valid
ripr-perl-facts-v1packet from real Perl source. - The sample-input packet matches the reference expected packet (or divergence is documented + coordinated).
-
cargo test -p perl-lsp-rs-core,cargo test -p perl-workspacepass. - PR description shows the actual emitted packet (not just "tests pass").
- Cross-links to
consumer/productionize(ripr side) for the joint integration.
Dependencies
- Depends on
exporter/schema-file+exporter/launch-action. - Unblocks
verification/end-to-end-mini-repoon the ripr side once ripr's consumer is also productionized.
Non-goals
- Changing ripr's expected packet unilaterally (coordinate).
- Perfect oracle extraction (start conservative;
OracleKind::Unknownis acceptable where extraction is unsure — ripr's strict-actionability validator will fail closed on unknown oracles, which is the safe direction). - Supporting every Perl construct (fail closed with limitations for unsupported syntax).
Risk
This is the highest-skill work item in Lane 1. The oracle/relation/behavior mapping requires real Perl semantics. Pair with consumer/productionize reviewer to make sure the emitted shapes are consumable. If a mapping is too hard for v1, emit a LimitationFact and let ripr fail closed — never fabricate a confident fact.
Activity
EffortlessSteven commentedon Jun 21, 2026
Superseded by the restructured Campaign 31 plan. This issue was scoped under the original plan, which violated ADR 0019 by keeping the Perl-local
PerlStrictActionabilityas the actionability flip authority (ADR 0019 line 83-86 explicitly forbids parallel/mirror validators and language-localrepair_packet_readybooleans). The restructured plan routes Perl through the sharedGapRecord+validate_agent_gap_record_packetauthority, mirrors the TypeScript projection pattern (typescript_gap_record_for+validator_parity_*tests), and upgrades the target from "preview loop" to "usable alpha" across 4 phases / 18 PRs.See the refreshed umbrella #1379 and the new planning PR for the phased issues. The substantive content of this issue is preserved and folded into the appropriate new phased issue.