feat(registry): Phase 3 — bucket-resident remote aggregation (stacked on #80) - #81
Merged
GondekNP merged 1 commit intoAug 4, 2026
Conversation
Implements REGISTRY_PROVENANCE.md §8 on top of Phase 2, stacked so it can be integration-tested against the real .env bucket before merging to main. - get_output_uris(label_or_hash, output_type, current_only) + OutputURI: the registry's own, jar-free index of export URIs (run_outputs ⋈ job_runs ⋈ job_configs), currency-filtered. - query_remote(variable, agg, group_by, ...): aggregate a variable straight from the bucket CSVs in one scan, NO ingest into cell_data. Provenance is attached by joining on the registry-supplied filename, never by parsing the path; stale files from superseded/bad runs are excluded for free. - check_remote_consistency(): bucket-aware sibling of check_consistency — missing_remote_output / remote_count_mismatch / orphan_remote_output. Prerequisite fix: run_outputs.file_path stored only the object key for remote exports (ExportFileInfo.path drops the bucket), so _register_job_outputs now stores the full minio://host/key URI — the jar-free path §8a assumed. URIs normalize minio://→s3:// at read time. Verified against a REAL S3-compatible bucket via .env (tests/test_remote_aggregation_integration.py): full URIs stored, query_remote aggregates with cell_data untouched, currency exclusion, orphan + missing detection; objects cleaned up with a stdlib SigV4 DELETE (no boto3). Unit tests cover the helpers + local-file paths. Full suite 1233 passed; 0 net-new ruff/mypy. Version 0.0.9.26. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Stacked on #80 (Phase 2). Base branch is
feat/registry-provenance-phase2, notmain— so the more-invasive remote/bucket work can be deeply integration-tested against the real.envbucket here before any of it reachesmain. Merge #80 first, then retarget this tomain.Implements REGISTRY_PROVENANCE.md §8 — aggregate a sweep's bucket-resident CSV outputs without ingesting them into
cell_data.What's in it
get_output_uris(label_or_hash=None, output_type="patch", current_only=True)→OutputURI— the registry's own, jar-free index of export URIs (run_outputs ⋈ job_runs ⋈ job_configs), currency-filtered. No filename regex, no hand-maintained label→hash dict.query_remote(variable, agg, group_by, current_only, where, cache, ...)— one scan over exactly the current runs' CSVs; provenance attached by joining on the registry-suppliedfilename, never by parsing the path. Nothing touchescell_data.check_remote_consistency()— bucket-aware sibling ofcheck_consistency:missing_remote_output/remote_count_mismatch/orphan_remote_output.The prerequisite fix (why this is a touch more invasive)
run_outputs.file_pathstored only the object key for remote exports —ExportFileInfo.pathdrops the bucket, so it wasn't a usable URI (the memo's §8a "jar-free from run_outputs" assumed it was)._register_job_outputsnow stores the fullminio://host/key. Local paths are unchanged; URIs normalizeminio://→s3://at read time. This is the one change that touches the write path, hence the stacked-PR caution.Deep integration testing against the real
.envbuckettests/test_remote_aggregation_integration.pyruns a tiny Josh model with the real JAR, exports straight to the bucket (fromMINIO_*in.env), and verifies — all passing against real GCS:minio://bucket/...URIs stored;query_remoteaggregates withcell_dataleft empty (theload_results=Falseread path);orphan_remote_outputandmissing_remote_outputdetection.Objects are written under an isolated
joshpy-phase3-test/<uuid>/prefix and deleted on teardown via a stdlib SigV4DELETE(no boto3 in the env). The test skips cleanly when creds are absent, so it's CI-safe.Also
Unit tests for the helpers + local-file paths;
llms-full.txt, memo §8/§10,objects.json+ reference page forOutputURI. Full suite 1233 passed; 0 net-new ruff/mypy. Version → 0.0.9.26.Notes as-built vs. spec: one
job_runper job (not per replicate), so replicate is filename-derived / taken from the CSV's own column; theSweepManager.remote_export_urijar fallback proved unnecessary sincerun_outputsis always populated.🤖 Generated with Claude Code