feat(analysis): bind joint posterior Laplace draws to an analysis-run profile - #408
feat(analysis): bind joint posterior Laplace draws to an analysis-run profile#408seonghobae wants to merge 1 commit into
Conversation
… profile GAP-004 remaining slice (ADR 0051): operators request cutoff-safe joint_posterior_draws_v1 which fits the CPU f64 TRSL-TM reference, builds the identified Gauss-Newton Laplace precision, and materializes Philox/ Box-Muller/Cholesky plausible values. Not MCMC, not Schwarz candidate-K (#404), not GPU, not topic birth/split/merge. Persistence remains later.
|
Warning Review limit reachedNext included review available in 24 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
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. Comment |
| if request.snapshot_id != snapshot_id { | ||
| return Err(AnalysisEngineError::SnapshotMismatch); | ||
| } | ||
| if request.knowledge_cutoff != knowledge_cutoff.to_rfc3339() |
There was a problem hiding this comment.
🔴 Input provenance is self-asserted
An input built from another snapshot or later cutoff passes execute_joint_posterior_draws_run when separate metadata matches the request. The artifact can include future evidence.
Prompt for agents
The new execute_joint_posterior_draws_run API accepts ReferenceTopicInput separately from snapshot_id and knowledge_cutoff, but ReferenceTopicInput does not retain either provenance value after construction. The executor therefore validates only caller assertions and can bind input built from a different snapshot or a later cutoff to the request. Redesign the boundary so the model input, or a validated wrapper around it, carries immutable snapshot identity and construction cutoff. Validate those retained values against AnalysisRunRequest before fitting, and add tests that build input under a later cutoff or different snapshot and verify rejection.
Was this helpful? React with 👍 or 👎 to provide feedback.
| Ok(JointPosteriorDrawsExecution { | ||
| artifact, | ||
| terminal_result, | ||
| }) |
There was a problem hiding this comment.
🔴 Generated draws are discarded
Every successful execute_joint_posterior_draws_run returns only draw metadata and a digest. Callers cannot retrieve or reconstruct the generated coordinates.
Prompt for agents
execute_joint_posterior_draws_run materializes a JointPosteriorDrawSet, extracts metadata, then drops the set and returns only JointPosteriorDrawsArtifact plus AnalysisRunTerminalResult. No persistence API or retrieval identifier backed by storage exists, so the requested coordinates are unavailable after success. Define the intended data boundary and either return the bounded JointPosteriorDrawSet with the execution, persist it through an explicit artifact store referenced by the terminal result, or include a reconstructible and available payload. Keep the digest binding and size limits, and test that a successful caller can obtain the exact generated coordinates.
Was this helpful? React with 👍 or 👎 to provide feedback.
| || !valid_identifier(&self.draw_set_id) | ||
| || self.draw_set_id.len() != 64 |
There was a problem hiding this comment.
🟡 Malformed draw digests pass validation
from_json accepts any 64-byte identifier as draw_set_id, including non-hex values. Corrupted artifacts therefore masquerade as SHA-256-bound draw sets.
| || !valid_identifier(&self.draw_set_id) | |
| || self.draw_set_id.len() != 64 | |
| || !valid_identifier(&self.draw_set_id) | |
| || self.draw_set_id.len() != 64 | |
| || !self | |
| .draw_set_id | |
| .bytes() | |
| .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte)) |
Was this helpful? React with 👍 or 👎 to provide feedback.
| #[test] | ||
| fn fitted_precision_emits_digest_bound_laplace_draws() { |
There was a problem hiding this comment.
Summary
GAP-004 leftover / ADR 0052. Bind existing
JointCoordinatePrecision::draw_joint_gaussian(Philox4x32-10, Box-Muller, Cholesky) to a cutoff-safejoint_posterior_draws_v1analysis-run profile (tepp.joint_posterior_draws.v1).f64TRSL-TM reference, builds the identified joint Gauss-Newton Laplace precision, and draws through the library already on protected main.draw_set_id, algorithm version, seed, draw/document/topic counts, approximationjoint_gauss_newton_laplace, and inference statusjoint_gaussian_laplace_plausible_values_not_mcmc.trsl_topic_lineage_v1/fitted_candidate_k_v1profile reuse fail closed.Not MCMC. Not Schwarz candidate-
K(#404 / ADR 0049). Not interpreter/verifier (#405 / ADR 0050). Not topic activity/dormancy (#407 / ADR 0051). Not GPU. Not topic birth/split/merge. Not implemented-main.Distinct from live slices
Does not duplicate #407 (topic activity), #406 (wait CLI), #405 (interpreter/verifier), #404 (fitted candidate-K), #403 (retry-lineage CLI), #398 (membership-posterior ICC), #376 (ESEM/DSEM), #374 (Rubin), #372 (CWC), #389 (irregular event-time), #364 (TDT/CHRONOS), #356/#358/#359 (GAP-003A), #351 (Leiden), or Driver p.16 std-family micro-PRs.
Verification
cargo test -p analysis_enginecargo clippy -p analysis_engine --all-targets -- -D warningspython3 scripts/validate_documentation.pyMerge gate
Two independent current-head APPROVEs required. Author/bot COMMENTED is not independent APPROVE. Exact-head Checks on this SHA only. Predecessor Checks do not transfer. Do not self-approve. Do not merge without two independent approvals.