Data Governance, Contracts, and Classification Questions
Governing data at scale: data contracts between producers and consumers, schema evolution/compatibility, data classification and sensitivity tagging, access control, and lineage/cataloging. Covers policy, ownership, and compliance-driven controls over data. The governance layer over the technical stack.
What does backward, forward, and full schema compatibility mean for a shared dataset or event stream, and what are three concrete strategies (for example only ever adding nullable/optional fields, never repurposing an existing field's type, and running compatibility checks in CI before a producer's change ships) that keep old and new consumers working as a schema evolves?
Sample Answer
Backward compatibility means a reader using the new schema can correctly read data written with the old schema. Forward compatibility means a reader using the old schema can correctly read data written with the new schema. Full compatibility requires both at once, so producers and consumers can each upgrade independently, in either order, without breaking. Three concrete strategies that keep old and new consumers working as a schema evolves are: only ever adding nullable or optional fields (never new required ones), never repurposing an existing field's type or meaning, and running automated compatibility checks in CI (continuous integration) before a producer's change ships.
The three compatibility modes
- Backward: new schema reads old data. This lets you evolve the schema and still process previously-written data without a rewrite.
- Forward: old schema reads new data. This lets producers roll out a new schema before every consumer has upgraded, because old consumers keep working against new-format data.
- Full: both hold at once. This is the strictest and safest mode for datasets with many, uncoordinated consumers, because it removes ordering assumptions entirely.
Strategy 1: only ever add nullable or optional fields
Adding a required field breaks any reader that does not know to populate or expect it. Adding an optional field with a sensible default (or that is simply absent when missing) is safe in both directions: old readers ignore it, new readers get a default when it is missing from old data.
Strategy 2: never repurpose an existing field's type or meaning
Changing a field's type (a string ID becoming an integer) or its semantics (a percentage field switching from a 0-1 scale to a 0-100 scale) while keeping the same name is the most dangerous class of change, because it can pass a naive type check while silently corrupting every consumer that assumed the old meaning. If the meaning must change, add a new field with a new name rather than mutating the old one in place.
Strategy 3: run compatibility checks in CI before a producer's change ships
A CI job on the producer's pull request calls the schema registry's compatibility-check endpoint with the proposed schema, evaluated against the subject's configured mode (backward, forward, or full), and fails the build on an incompatible change. This catches the break before merge instead of after a downstream job fails in production.
Parquet and Avro specifics, and where enforcement should live
Avro (a data serialization format commonly used for streaming events) resolves fields by name (with optional aliases) between a writer's schema and a reader's schema, so a rename without an alias breaks resolution even though the field's type is unchanged. Parquet (a columnar file format commonly used in data warehouses and data lakes) stores its own schema per file, so a partitioned table can end up with older files under an older schema footer sitting alongside newer ones; a query engine (or a table format like Iceberg or Delta Lake built for schema evolution) has to reconcile that at read time, and adding a nullable column works cleanly here because older files simply return null for it. Because of this, enforcement should not live only at one point: check it at ingestion (reject or quarantine malformed records), at the processing layer (the CI check above, run against the schema registry or the dbt/SQL model definition), and at the serving layer (the API or dashboard reading the table should not silently accept a shape it was not built for).
Worked example
An Avro event user_signup has fields id (string), email (string), country (string, optional). A developer proposes renaming country to country_code. Under a naive field-name match this is not backward compatible: a reader on the new schema looking for country_code finds nothing in old data and has no default to fall back on. Adding "aliases": ["country"] to the country_code field restores backward compatibility, because Avro's reader can resolve data written under the old field name through the alias. A CI job that runs the registry's compatibility check (in BACKWARD mode) against this change fails before the alias is added and passes after, which is exactly strategy 3 in action.
Trade-offs and pitfalls
Full compatibility is the safest choice for a dataset with many uncoordinated consumers, but it is also the most restrictive: a genuinely breaking change (splitting one field into two) cannot be done in place under full compatibility, and needs a new field or a new schema version alongside the old one rather than an in-place mutation. Backward-only compatibility is common and less restrictive, but it assumes consumers upgrade after producers, which is not always true. The compatibility checker itself only catches structural drift; it cannot catch a field that keeps its type but silently changes meaning, which is exactly why strategy 2 (never repurpose meaning) has to be a human-reviewed rule in the contract, not something automated tooling alone can enforce.
During a routine audit you discover PII sitting in analytics event logs that feed downstream dashboards, and it's been there a while. Draft your remediation and communication plan: what do you do immediately (quarantine, masking), who do you notify and in what order, what's a realistic timeline, and how do you verify the fix actually worked rather than just declaring victory?
Sample Answer
Direct answer. Treat this as an active incident, not a backlog item. Immediately cut off exposure by quarantining the raw data and masking the columns the dashboards read from, then work outward through a fixed notification order starting with whoever owns privacy/legal risk, set a timeline that separates "stop the bleeding" from "clean up the backlog" from "prevent recurrence," and only close the incident after an independent check confirms the fix, not when the code merges.
Immediate actions: quarantine and masking
- Quarantine: restrict read access to the raw events table or topic containing PII (personally identifiable information) right away. Revoke broad analyst and dashboard-service-account read grants, leave access only to incident responders, and stop any ingestion path that is still writing PII into the field if that is the root cause.
- Masking: without breaking the dashboards, insert a masked view or transformation layer between the raw table and the BI (business intelligence) tool. Replace direct identifiers (email, name, device ID) with a null, a one-way hash, or a redacted placeholder before the query layer the dashboards use ever sees them. This is deliberately faster than a schema migration: dashboards keep the same column names, just masked values, so they don't break while the real fix is in progress.
Notification order, and why that order
- Privacy/legal owner (data protection officer or equivalent) first, because they determine whether this is a reportable incident and what the notification clock is; many regimes start counting from discovery, not from when the root cause is fixed.
- Engineering lead who owns the ingestion pipeline, to start root-causing where the PII entered the log and stop new PII from landing.
- Downstream dashboard and data owners, so they know values changed and don't debug it as a data-quality bug.
- Leadership summary, once 1 through 3 are underway, not before, so you're not making commitments you'll have to walk back.
- Any external notification (regulator, affected users), only after legal has assessed scope, on the timeline legal sets, not engineering's guess.
Realistic timeline
- Day 0-1: quarantine and masking view live; privacy/legal and the engineering lead notified.
- Day 1-5: root cause identified in the ingestion code and a fix deployed behind a schema or contract check that would catch this class of leak in the future.
- Week 1-3: backfill remediation. Purge or irreversibly transform the PII already sitting in historical raw storage and any derived copies (exports, cached BI extracts), not just the live table.
- Week 3-4: verification and closure, plus a postmortem documenting how the PII got in and what now prevents recurrence.
Verifying the fix actually worked
- Re-run the same detection method that surfaced the issue (the audit's scan, regex, or classifier) against the remediated data and confirm zero hits, including in downstream copies, exports, and backups, not only the primary table.
- Have someone who was not involved in the fix independently query the masked view through the BI tool and confirm the raw identifiers are unreachable, not just absent from the default report.
- Add a recurring automated scan so the next occurrence is caught within hours, not at the next annual audit.
Worked example. A hypothetical company finds emails logged in an event property for 90 days across a table feeding 12 dashboards. If that 90-day window carried roughly 500,000 events at about 1 email per event, that is 500,000 raw PII rows to remediate (500,000 x 1 = 500,000), counted across the primary table plus any exports, not just wherever the audit first looked. The masking view swaps the email field for a hash the same day, so row counts and aggregations, which don't depend on the actual email value, keep working unchanged while the quarantine and backfill proceed.
Trade-offs and pitfalls
- Masking at the view layer is fast, but if analysts have direct table access outside the BI tool, the view alone doesn't close that hole; the underlying table access has to be locked down too.
- Rushing straight to deletion before legal weighs in can destroy evidence needed to scope the incident correctly, or delete data that's under a legal hold.
- The most common wrong turn is quietly fixing it and moving on without independent verification and a written record; "we don't have PII in analytics anymore" is exactly the claim the next audit checks.
What does data governance concretely mean for an organization building and deploying ML models on user data, beyond the general definition? Name two specific governance controls (not abstract principles) you'd push for to reduce risk when a model is trained on sensitive user data, and explain how each aligns with what legal and product would actually ask for.
Sample Answer
For ML on user data, governance means concrete controls over what data a model is allowed to be trained on, who is accountable if it causes harm, and how that can be proven after the fact, not just the general definitions of ownership, quality, and access control that apply to any dataset. The general definition is necessary but not sufficient: a model trained on well-governed input data can still create NEW risk (memorizing sensitive attributes, encoding a proxy for a protected class, or being impossible to audit after deployment) that generic data governance controls don't address on their own.
Two specific governance controls
- A data lineage and consent record tied to every training run, not just the raw dataset. Concretely: before a model trains, the pipeline checks that every row's consent status (was this user's data collected under terms that permit ML training, has it since been withdrawn via a deletion request) is current, and the training run logs which dataset SNAPSHOT and which consent state it used. This is what lets you answer "was this model trained on data it shouldn't have been" after the fact, and what makes a deletion request (a user exercising a right to be forgotten) actually actionable: without a snapshot record, you can't know which models need retraining when a user's data is deleted.
- A sensitive-feature and proxy review before a model ships to production, distinct from a generic PII (personally identifiable information) scan on the raw table. This means explicitly reviewing the model's actual FEATURES, not just the source data, for direct sensitive attributes (race, health status) and plausible proxies (zip code correlating with a protected class, a purchase category correlating with a medical condition), with the review documented and signed off before the model is approved for production use.
How each aligns with what legal and product actually ask for
- Lineage and consent tracking is close to a literal restatement of what legal asks for under most modern privacy regimes: the ability to demonstrate a lawful basis for processing and to honor a deletion or objection request in practice, not just on paper. Product cares because a model that has to be pulled and retrained after a compliance finding is a shipped-feature outage, not just a legal problem.
- Sensitive-feature and proxy review is what product and legal actually mean when they say "make sure the model is fair and defensible," phrased more usefully than the abstract principle: it's a concrete artifact (a signed-off feature review) legal can point to if the model's outcomes are later challenged, and product gets a documented reason to trust (or reject) a feature before it ships, rather than discovering the proxy problem after a public complaint.
Trade-offs and pitfalls
The common wrong turn is treating a general PII scan on the raw dataset as sufficient governance for an ML system; a feature like "distance from the nearest cancer treatment center," derived from otherwise non-PII location data, can encode sensitive information a column-level scan would never flag, because the sensitivity lives in the DERIVED feature, not the raw field. The other pitfall is doing the consent and lineage work once at initial training and never again: models get retrained on refreshed data regularly, and if the consent check only ran at v1, a v7 retrain can silently pull in data from users who withdrew consent between v1 and v7 unless the check runs on every training run, not just the first.
A team member who owned a set of important dashboards or datasets is leaving. Design a handoff process: what documentation and knowledge-transfer sessions are required, who takes temporary ownership, what access needs to change, and what checkpoints ensure nothing quietly breaks a month later when nobody remembers who to ask.
Sample Answer
Direct answer. Treat the departure as a forced deadline for something that should already be documented: assign a named temporary or permanent owner immediately rather than leaving it unassigned, run structured knowledge-transfer sessions before the departure date rather than relying on an exit interview, rotate every credential and access grant tied to that person, and schedule specific checkpoints after departure rather than assuming silence means success.
Documentation and knowledge-transfer sessions
- Have the departing owner produce, or validate if partial documentation already exists, a handoff document covering what each owned dashboard or dataset does and for whom, the data sources and any non-obvious transformation logic, known quirks or workarounds, the on-call or support pattern, and a list of scheduled jobs or automations tied to their account.
- Run at least one live walkthrough session with the incoming owner, not just a written document. A session surfaces the "oh, and one more thing" details that never make it into a doc written under deadline pressure, and lets the incoming owner ask questions while the source is still available.
- Record or take detailed notes during the session specifically for anything time-sensitive or judgment-based, for example a metric definition under active dispute with another team, since that's exactly the kind of context that's easy to lose and hard to reconstruct later.
Who takes temporary ownership. Assign a specific named person, not "the team," before the departure date, ideally someone who attended the knowledge-transfer session and has some existing context. If no one has context, temporary ownership defaults to the departing owner's manager or team lead as the accountable party, even if they delegate the day-to-day work, so there's always one name responsible.
What access needs to change
- Rotate or reassign any service-account credentials, API keys, or scheduled-job authentication running under the departing owner's personal identity, a common source of "quietly breaks a month later" incidents, since a personal account's access often silently continues working until it's deprovisioned, at which point everything tied to it fails at once.
- Grant the incoming owner the access levels actually needed to operate, not a blanket copy of the departing owner's full access, which is often broader than the role strictly requires.
- Revoke the departing owner's access on their actual last day, coordinated with IT or security offboarding, and confirm nothing was missed by checking for any resource still showing them as owner or admin.
Checkpoints ensuring nothing quietly breaks a month later
- Week 1 post-departure: confirm every scheduled job or pipeline that was tied to the departing owner's credentials ran successfully at least once under the new ownership.
- Weeks 2-4: the incoming owner handles a live incident or support question independently, or with light backup, as a practical test of whether the knowledge transfer actually took, rather than assuming it did because the sessions happened.
- 30-day checkpoint: an explicit review meeting confirming the handoff document is accurate against what was actually learned in the first month, closing out any open items from the original transfer.
- A calendar reminder, not memory, should own this cadence; the checks happen on schedule regardless of whether anything visibly went wrong, since the failure mode is exactly the quiet break nobody notices until it's overdue.
Worked example. A departing analyst owned 6 dashboards and 2 scheduled data pipelines that ran under their personal warehouse credentials. The handoff document lists all 8 assets with their data sources and known quirks; a 90-minute walkthrough session covers each; the incoming owner is assigned before the last day; the 2 pipelines are migrated from the departing analyst's personal credentials to a shared service account in the week before departure, not after, so any breakage from the migration is caught while the departing analyst can still help; access is revoked on the last day; and at the week-1 checkpoint, both pipelines are confirmed to have run successfully under the new service account.
Trade-offs and pitfalls
- The most common mistake is leaving scheduled jobs running under the departing person's personal credentials past their last day, which fails silently, running fine right up until credentials are revoked, then breaking all at once, often days or weeks after everyone's attention has moved on.
- Assigning temporary ownership to "the team" instead of one named person means the 30-day checkpoint has no one clearly accountable to run it, and it quietly doesn't happen.
- Treating the walkthrough session as optional when documentation already exists underestimates how much undocumented judgment, why a metric is defined the odd way it is, which stakeholder actually cares about which number, lives only in the departing owner's head.
Design a data governance and access-control architecture for an analytics platform operating across multiple regions with different privacy regimes (say, the EU and the US), covering product analytics, ML feature stores, and customer records. Cover data classification, PII detection and masking, role-based access control, lineage, audit trails, and how you'd structure a governance decision-making body, while keeping ML feature freshness and developer agility workable.
Sample Answer
Build one governance model with region-aware enforcement rather than two separate governance systems for the EU (European Union) and the US: a shared classification taxonomy and shared access-control mechanism, with region-specific rules (residency, retention, consent basis) expressed as policy parameters rather than as forked infrastructure, spanning product analytics, the ML (machine learning) feature store, and customer records.
Data classification
A single four- or five-tier classification (public, internal, confidential, restricted, and, given the regulatory scope here, a distinct regulated-PII sub-tier for data covered by GDPR (the EU's General Data Protection Regulation) or CCPA (the California Consumer Privacy Act) style rules) applies globally, with a region tag attached alongside the sensitivity tag. A customer record's sensitivity tier doesn't change between the EU and the US, but its region tag determines which residency and retention rules apply to it.
PII detection and masking
Automated PII (personally identifiable information) detection runs across all three domains, product analytics events, ML feature store inputs, and customer records, using a combination of schema-level tagging (known PII fields declared at ingestion) and pattern-based scanning (catching PII that lands in free-text or unexpected fields). Masking defaults follow the classification tier: confidential and restricted fields are masked by default in any cross-team or cross-region view, unmasked only for roles with an approved, region-appropriate business need.
Role-based access control
RBAC (role-based access control) roles are defined once, globally (analyst, ML engineer, finance, compliance), with region as an additional attribute checked alongside the role, effectively a lightweight attribute-based layer on top of RBAC rather than a fully separate ABAC (attribute-based access control) system: an EU-based analyst role and a US-based analyst role have the same permissions structure, but an EU analyst's access to EU customer records is subject to the residency rule that data doesn't leave the EU region's processing boundary, even for another employee with the same job title based in the US.
Lineage and audit trails
End-to-end lineage tracking (capturing how a customer record or an ML feature traces back to its source and forward to every derived dataset or model that consumes it) is essential here specifically because a right-to-erasure or data-subject-access request under GDPR requires being able to answer "everywhere this person's data went," not just where it started. Audit trails record every access, transformation, and cross-region data movement, since cross-region movement is itself a regulated event under most residency regimes, not just another access to log.
SOC 2 and consent-management framing
Beyond the GDPR/CCPA distinction, this architecture should also be evaluated against SOC 2 (System and Organization Controls 2, an audit standard for how a service organization manages customer data) trust-service criteria, since access control, change management, and monitoring requirements from a SOC 2 audit map directly onto the same RBAC, audit-logging, and lineage components described above; building governance to satisfy GDPR/CCPA residency rules largely satisfies SOC 2's security and confidentiality criteria as a byproduct, but SOC 2 additionally expects documented, tested incident-response and change-management processes around this infrastructure, which should be built explicitly rather than assumed.
Consent management is the piece that ties classification to actual legal basis: a customer's consent state (what they've agreed their data can be used for, which can differ between EU and US customers under different regimes) is stored as its own governed record linked to the customer's identifier, and the access-control layer checks consent state, not just role and region, before allowing a customer record into an ML feature pipeline. A pseudonymization/tokenization architecture variant supports this concretely: customer records feeding the ML feature store are pseudonymized (the raw identifier replaced by a stable token) at ingestion, with the reversible mapping held in a separate, tightly-restricted vault, so a consent withdrawal can be enforced by revoking or expiring that customer's token without needing to hunt down every derived feature-store row that used the raw identifier.
Governance decision-making body
A standing governance council, not a single owner, since region-specific legal obligations and cross-functional trade-offs (ML freshness versus residency, self-service speed versus compliance) need multiple perspectives represented:
- Chair: a data governance or privacy lead, owning the overall policy and cadence.
- Legal/privacy counsel for each covered region (EU and US), since the specific obligations differ.
- A security lead, owning encryption, key management, and the SOC 2 control set.
- An ML engineering representative, owning the feature-freshness and pseudonymization trade-offs.
- A product/business representative, ensuring policy decisions account for actual business need, not compliance in a vacuum.
This body meets on a regular cadence (for example monthly, with an expedited path for urgent decisions like a new region's regulatory change) to approve new classification categories, review flagged cross-region data movements, and adjudicate exception requests.
flowchart TB
subgraph EU[EU processing boundary]
EUDATA[EU customer records + features]
end
subgraph US[US processing boundary]
USDATA[US customer records + features]
end
EUDATA -->|pseudonymized token only, consent-checked| SHARED[Shared aggregate / model artifacts]
USDATA -->|pseudonymized token only, consent-checked| SHARED
CONSENT[(Consent record store)] --> RBAC[Region-aware RBAC layer]
RBAC --> EUDATA
RBAC --> USDATA
GOV[Governance council] -->|policy + exception review| RBAC
GOV --> CONSENT
Keeping ML feature freshness and developer agility workable
The residency and consent checks above add a lookup on the path from raw customer record to a live feature, which risks slowing feature-store updates if done naively. Keep it workable by:
- Checking consent and residency at write-time into the feature store (when a feature is computed), not at read-time on every serving request, so the low-latency serving path stays a simple key lookup with no per-request policy evaluation.
- Giving developers a self-service, pre-approved pattern (a feature-engineering template that already routes through pseudonymization and consent checks correctly) for the common case, so most new features don't require a governance council review individually, only genuinely new data sources or use cases do.
Trade-offs & pitfalls
The biggest risk in this design is a fast, informal "just this once" cross-region data copy for an urgent business need that bypasses the residency boundary; because the architecture makes the compliant path only slightly slower than the non-compliant one (pre-approved templates, write-time checks), there should be little practical incentive to skip it, but the governance council needs visibility into attempted or actual cross-region movements specifically to catch the cases where someone tries anyway.
Unlock Full Question Bank
Get access to all 31 Data Governance, Contracts, and Classification interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.