Repository navigation
feat(profiling): the read API — a profile over HTTP, with its values gated (PR E) - #426
Merged
Merged
Conversation
athvin
force-pushed
the
bm/profile-p5-read-api
branch
2 times, most recently
from
November 3, 2026 04:42
119c31e to
e0dba23
Compare
athvin
force-pushed
the
bm/profile-p5-read-api
branch
6 times, most recently
from
November 5, 2026 01:56
5a3fc94 to
c742876
Compare
…gated (PR E)
Two routes over the profile a job already writes:
GET /v1/orgs/{org}/datasets/{ds}/profile?subject=&source=&tier= viewer
POST /v1/orgs/{org}/datasets/{ds}/profile steward -> 202
The GET answers `{"profiled": false}` rather than 404 for a corpus nobody has
profiled, on `quality`'s precedent: the dataset exists and the question is fair,
the answer is just "not yet".
A profile is statistics — except where it is not. `top_values` is a column's
most frequent REAL values; `lex_min`/`lex_max` are the lexically smallest and
largest; `num_min`/`num_max` the numeric extremes. On an email column those are
real addresses; on a salary column, one person's pay.
This gate first shipped covering `top_values` alone, and said so in three
places — the handler's doc comment, the read's doc comment, and the statement's
description — each calling it "the one field in a profile that carries personal
data". It was not. The other four went to every viewer, and nothing failed,
because the failure mode of a value reaching the wire is **silence**.
So the classification is no longer prose:
- `VALUE_BEARING_COLUMN_FIELDS` and `DERIVED_COLUMN_FIELDS` are exhaustive,
and `DERIVED` is listed out rather than inferred as "everything else" —
a column added to the entity lands in NEITHER list and fails the gate test,
which is the point: the failure asks a question that has to be answered.
- The test reads `entities/column_profile/entity.yaml` as embedded in the
binary, so it sees a new column without anyone remembering to tell it.
- Membership is "could a reader recover a datum", not the column's type:
`num_max` is a number and is gated, `num_avg` is a number and is not, because
an average over many rows is nobody's value. Drawing the line at
verbatim-or-not keeps it one sentence; drawing it at which types feel
sensitive is how `lex_min` was missed.
Values are **nulled in place, never removed**, so the response shape does not
depend on who asked — a consumer renders "—" for a null it expected and throws
on a key that vanished. `top_values` keeps its counts, shares and ranks and
loses only each entry's value: that the top value covers 3.1% of rows is the
point of a skew finding, and which value it is adds nothing to it.
Steward is the bar because a steward can already read records. It is not a bar
a viewer routes around: `GET …/records` takes explicit keys, capped at 50, and
will not enumerate — so a column's most frequent values are not otherwise
reachable by someone who cannot already name the rows they want.
PR D measured what each column would cost as a blocking key and persisted the
ranking; nothing could read it. That was a gap this PR split created, and a
profile screen without it would omit the most actionable thing in the profile.
`candidate_key/read/for_run` projects it cheapest-first — `ORDER BY
expected_pairs` IS the ranking, so a reader takes the top row rather than
re-deriving which key is most selective.
`key_columns` is stored chr(31)-joined because the lake has no list type; it is
split back into an array at the handler so no consumer has to know that, and so
a composite key renders as two names rather than one string with a control
character in it. Nothing in a candidate key is a value — a key is named by
COLUMN names and described by counts — so unlike the column shapes it needs no
gating.
- `er-entity verify`: 17 lint rules over 48 entities, no errors; 132 generated
files current; every statement plans and passes the E0xx rules, the new read
included.
- The gate test **observed failing**: unclassifying one field reports
`column_profile gained 'entropy_bits' and nothing says whether it echoes a
stored value`, and exits 101.
- Three unit tests over the redaction: a steward's row is byte-identical to the
input; a viewer's contains none of the three planted addresses anywhere in
its serialized form (an assertion that does not depend on knowing which field
holds one); every derived statistic and the whole distribution shape survive.
- `cargo clippy -p er-server --all-targets -- -D warnings` clean; `cargo fmt
--all --check` clean.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
bm/profile-p5-read-api
branch
from
November 5, 2026 02:26
c742876 to
8165b83
Compare
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.
Two routes over the profile a job already writes:
The GET answers
{"profiled": false}rather than 404 for a corpus nobody has profiled, onquality's precedent: the dataset exists and the question is fair, the answer is just "not yet".The value gate covers five fields, not one
A profile is statistics — except where it is not.
top_valuesis a column's most frequent real values;lex_min/lex_maxare the lexically smallest and largest;num_min/num_maxthe numeric extremes. On an email column those are real addresses; on a salary column, one person's pay.This gate first shipped covering
top_valuesalone, and said so in three places — the handler's doc comment, the read's doc comment, and the statement's description — each calling it "the one field in a profile that carries personal data". It was not. The other four went to every viewer, and nothing failed, because the failure mode of a value reaching the wire is silence.So the classification is no longer prose:
VALUE_BEARING_COLUMN_FIELDSandDERIVED_COLUMN_FIELDSare exhaustive, andDERIVEDis listed out rather than inferred as "everything else" — a column added to the entity lands in NEITHER list and fails the gate test. That is the point: the failure asks a question that has to be answered.entities/column_profile/entity.yamlas embedded in the binary, so it sees a new column without anyone remembering to tell it.num_maxis a number and is gated,num_avgis a number and is not, because an average over many rows is nobody's value. Drawing the line at verbatim-or-not keeps it one sentence; drawing it at which types feel sensitive is howlex_minwas missed.Values are nulled in place, never removed, so the response shape does not depend on who asked — a consumer renders
—for a null it expected and throws on a key that vanished.top_valueskeeps its counts, shares and ranks and loses only each entry's value: that the top value covers 3.1% of rows is the point of a skew finding, and which value it is adds nothing to it.Steward is the bar because a steward can already read records. It is not a bar a viewer routes around:
GET …/recordstakes explicit keys, capped at 50, and will not enumerate — so a column's most frequent values are not otherwise reachable by someone who cannot already name the rows they want.Candidate keys reach the wire
PR D measured what each column would cost as a blocking key and persisted the ranking; nothing could read it. That was a gap this PR split created, and a profile screen without it would omit the most actionable thing in the profile.
candidate_key/read/for_runprojects it cheapest-first —ORDER BY expected_pairsis the ranking, so a reader takes the top row rather than re-deriving which key is most selective.key_columnsis stored chr(31)-joined because the lake has no list type; it is split back into an array at the handler so no consumer has to know that, and so a composite key renders as two names rather than one string with a control character in it. Nothing in a candidate key is a value — a key is named by column names and described by counts — so unlike the column shapes it needs no gating.Verification
er-entity verify: 17 lint rules over 48 entities, no errors; 132 generated files current; every statement plans and passes the E0xx rules, the new read included.column_profile gained 'entropy_bits' and nothing says whether it echoes a stored value, and exits 101.cargo clippy -p er-server --all-targets -- -D warningsclean;cargo fmt --all --checkclean.er-mcp/tools.jsonandenvelopes.jsonregenerated for the two new routes;needs_body: falseon the POST is correct — it means "takes a body this manifest could not describe", and mine is described.🤖 Generated with Claude Code