Skip to content

python-math #18: feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) - #2646

Draft
jucor wants to merge 1 commit into
spr/edge/a85047a7from
spr/edge/9f45b733
Draft

python-math #18: feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B)#2646
jucor wants to merge 1 commit into
spr/edge/a85047a7from
spr/edge/9f45b733

Conversation

@jucor

@jucor jucor commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a prodclone extractor (Spec B) — a tool that exports feature-filtered private test datasets from a production database clone into the replay-data format. Built by a Sonnet agent from SPEC_B: scripts/prodclone_extract.py (click CLI with survey and extract commands) over polismath/replay/prodclone.py (pure SQL builders, feature classifiers, CSV writers, slug minting, path-safety guard).

Privacy invariants (reviewed)

  • The output path is resolved and asserted to live under real_data/.local/ (refuses anything else).
  • The directory prefix is a salted sha256 of the zid (the internal conversation id), never a real report id.
  • The comment-body column is present but ALWAYS empty (text redacted — the math pipeline never reads it).
  • The slug-to-zid map lives only in .local/prodclone_map.json (merge-updated).

The export mirrors the public dataset byte-layout: votes carry the full revote history (ORDER BY created, ctid — no dedup); comment agrees/disagrees are counted over all vote rows the way report.ts does.

Feature classes

modheavy / revote / banned (voters with participants.mod = -1) / meta / zerovote / smallmix / midmix (unremarkable-volume coverage).

Testing

52 passed — pure-function units (no DB) plus one integration test on the repo's require_polis_postgres throwaway-Postgres fixture, round-tripping survey → extract → load_export_votes. TDD (RED commit first in the agent's clone).

commit-id:9f45b733


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

This was referenced Jul 22, 2026
@jucor
jucor marked this pull request as draft July 22, 2026 00:52
@jucor jucor changed the title feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) feat(delphi): prodclone extractor — feature-filtered dataset export (… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/a85047a7 to edge July 22, 2026 02:01
@jucor jucor changed the title feat(delphi): prodclone extractor — feature-filtered dataset export (… feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) Jul 22, 2026
@jucor
jucor changed the base branch from edge to spr/edge/a85047a7 July 22, 2026 02:02
@jucor jucor changed the title feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) feat(delphi): prodclone extractor — feature-filtered dataset export (… Jul 22, 2026
@jucor
jucor changed the base branch from spr/edge/a85047a7 to edge July 22, 2026 02:10
@jucor jucor changed the title feat(delphi): prodclone extractor — feature-filtered dataset export (… feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) Jul 22, 2026
This was referenced Jul 27, 2026
@jucor
jucor force-pushed the spr/edge/a85047a7 branch from d5400c0 to ce026f3 Compare July 28, 2026 00:11
@jucor
jucor force-pushed the spr/edge/9f45b733 branch from 7e63768 to 7af0f1f Compare July 28, 2026 00:11
@jucor jucor changed the title feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) python-math #18: feat(delphi): prodclone extractor — feature-filtered dataset export (Spec B) Jul 28, 2026
… dataset export (Spec B)

## What

Adds a prodclone extractor (Spec B) — a tool that exports feature-filtered private test datasets from a production database clone into the replay-data format. Built by a Sonnet agent from SPEC_B: `scripts/prodclone_extract.py` (click CLI with `survey` and `extract` commands) over `polismath/replay/prodclone.py` (pure SQL builders, feature classifiers, CSV writers, slug minting, path-safety guard).

## Privacy invariants (reviewed)

- The output path is resolved and asserted to live under `real_data/.local/` (refuses anything else).
- The directory prefix is a salted sha256 of the zid (the internal conversation id), never a real report id.
- The comment-body column is present but ALWAYS empty (text redacted — the math pipeline never reads it).
- The slug-to-zid map lives only in `.local/prodclone_map.json` (merge-updated).

The export mirrors the public dataset byte-layout: votes carry the full revote history (`ORDER BY created, ctid` — no dedup); comment agrees/disagrees are counted over all vote rows the way `report.ts` does.

## Feature classes

modheavy / revote / banned (voters with `participants.mod = -1`) / meta / zerovote / smallmix / midmix (unremarkable-volume coverage).

## Testing

52 passed — pure-function units (no DB) plus one integration test on the repo's `require_polis_postgres` throwaway-Postgres fixture, round-tripping survey → extract → `load_export_votes`. TDD (RED commit first in the agent's clone).

commit-id:9f45b733
@jucor
jucor force-pushed the spr/edge/9f45b733 branch from 7af0f1f to b3e529b Compare July 28, 2026 01:10
@jucor
jucor force-pushed the spr/edge/a85047a7 branch from ce026f3 to c1dcdf5 Compare July 28, 2026 01:10
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.

2 participants