Repository navigation
Description
Describe the bug
#1319 removes learner data from the INFO/WARNING logs of GraphQL, the Query Cache, the Advisor and semantic search. The repo-wide sweep it required found more learner data reaching logs outside those four services, and on error paths inside them. This issue holds that remainder so #1319's PR stays scoped. LOG_LEVEL defaults to INFO (components/lif/logging/core.py), so the INFO and WARNING lines below run on the normal request path.
How this was found
An AST walk over every logging call in bases/ and components/ (on main at 1d816e4; line numbers refreshed to 86049e8 on 2026-10-05): 714 live calls, 583 of which interpolate a variable. Every non-DEBUG call that interpolates was classified as learner data, safe, or uncertain. A sample of the lines below was re-read by hand to confirm them. It does not cover orchestrators/dagster/ or uvicorn access logs (see the end).
1. Learner data at INFO or higher, outside the #1319 services
| File:line | Level | Logged | Learner data | Service |
|---|---|---|---|---|
bases/lif/learner_data_export_api/learner_data_export_endpoints.py:60 |
INFO | learnerId: %s |
learner identifier | Learner Data Export |
bases/lif/orchestrator_restapi/core.py:59 |
INFO | Received job request: {job_request} |
query plan with person_id |
Orchestrator |
components/lif/orchestrator_service/service.py:41 |
INFO | Job definition created: {job_definition} |
same query plan | Orchestrator |
components/lif/orchestrator_clients/dagster.py:103 |
INFO | Submitting Dagster job with config: ... |
query-plan parts with person_id (already has a TODO: Change to debug) |
Orchestrator |
components/lif/translator/core.py:70 |
WARNING | Skipping non-object fragment: %r |
a mapped learner value | Translator |
components/lif/translator/core.py:85 |
WARNING | Discarding fragment due to target schema violation: %s |
the jsonschema message quotes the offending value | Translator |
bases/lif/translator_restapi/core.py:54 |
WARNING | Value error ...: {exc} |
the source-schema ValueError quotes the learner value |
Translator |
components/lif/translator_client/core.py:55 |
ERROR | response.text |
a Translator 422 echoes the posted record (pydantic input) |
Learner Data Export |
components/lif/query_planner_client/core.py:57 |
ERROR | response.text |
a Query Planner 422 echoes the posted query (identifier) | Learner Data Export |
components/lif/composer/core.py:178 |
ERROR | Input should be a valid dictionary: {new_item} |
a raw learner value | Query Cache |
components/lif/demo_data_source_adapters/example_data_source_rest_api_to_lif_adapter/adapter.py:31 |
INFO | source_url |
the URL embeds the person identifier | Dagster (all 3 dagster_* projects) |
bases/lif/example_data_source_rest_api/core.py:116, :125 |
INFO | user_id |
user identifier (demo source) | Example Data Source |
bases/lif/example_data_source_rest_api/core.py:181 |
INFO | Filters: + str(filters) |
name and age search values (demo source) | Example Data Source |
2. Error paths inside the #1319 services
strawberry.executionlogs the GraphQL document at ERROR when a resolver raises. graphql-core's error text includes a snippet of the query source. The semantic search service builds its queries with the filter inlined as a literal, so the identifier is logged. Reproduced against the Learner PII still logged at INFO outside the Query Planner: GraphQL, Query Cache, Advisor, semantic search (the rest of #1269) #1319 branch with a mutation whose resolver raises.- Query Cache
logger.exceptionatquery_cache_service/core.py:264and:337logs exceptions whose messages embed the filter::261(No matching record after update: {filter_dict}) and:315(multiple records found for the given filter: {lif_query_filter}). - GraphQL
dict_to_dataclassraisesTypeError(... {data})(type_factory.py:609,:629). Learner PII still logged at INFO outside the Query Planner: GraphQL, Query Cache, Advisor, semantic search (the rest of #1269) #1319 stops the list-item WARNING from logging that text, but the exception can still reach other handlers.
3. Uncertain: error paths that echo a downstream body or str(e)
These can carry learner data depending on what fails:
- Query Cache:
query_cache_service/core.py:179,:291(PyMongo errors;DuplicateKeyErrorquotes the key). - Query Planner:
query_planner_service/core.py:407,:411(also re-logged at:232andquery_planner_restapi/core.py:233),:438. (query_planner_restapi/core.py:214was fixed by Issue #1340: fix: keep internal error text out of the Query Planner's 500 responses #1354, which now logs only the result's type.) - Orchestrator:
orchestrator_restapi/core.py:64,orchestrator_service/service.py:50. - GraphQL client:
graphql_client/core.py:47,:77,:111(re-logged atsemantic_search_service/core.py:432,:435,:450,:453). - Data source adapters:
lif_to_lif_adapter/adapter.py:75, demoadapter.py:39. - GraphQL:
type_factory.py:667(date-conversion errors),:905,:1009(Query Plannerresponse.text). - Translator:
translator/core.py:64,translator_restapi/core.py:76. - Example data source:
example_data_source_rest_api/core.py:156,:185,:213. - Advisor:
advisor_restapi/core.py:315(username plus the LLM exception).
4. DEBUG (off by default; would log learner data if enabled)
learner_data_export_endpoints.py:133 (the full export), lif_to_lif_adapter/adapter.py:67, :97, demo adapter.py:43, translator/core.py:61, :108.
Not covered by the sweep
- Uvicorn access logs record query strings and paths. That includes the LDE
learnerIdquery parameter and the Identity Mapper's/persons/{id}paths (the latter is Identity Mapper logs learner person identifiers at INFO on every request (same class as #1269) #1318). - Python under
orchestrators/dagster/. Now tracked in Dagster LIF job logs learner records at INFO (adapter output, translation input/output, job results) #1359 (the LIF job'scontext.logcalls).
Acceptance criteria
- Section 1: no learner identifiers or field values at INFO or higher. Keep the operational signal (counts, status codes, field names).
- Section 2: fixed or explicitly accepted.
- Section 3: each line triaged, then fixed or recorded as safe.
- A log-capture test per changed service, as in Learner PII still logged at INFO outside the Query Planner: GraphQL, Query Cache, Advisor, semantic search (the rest of #1269) #1319, that fails on
main.
Related
- Learner PII still logged at INFO outside the Query Planner: GraphQL, Query Cache, Advisor, semantic search (the rest of #1269) #1319: the four services (fixed by Issue #1319: fix: keep learner data out of the GraphQL, Query Cache, Advisor and semantic search logs #1352)
- Dagster LIF job logs learner records at INFO (adapter output, translation input/output, job results) #1359: the Dagster LIF job, split out of this issue's "not covered" list
- Query Cache API returns exception text in its 500/404 responses, including learner document fields #1360: the Query Cache's
str(e)in HTTP responses (the response-side sibling of section 3's Query Cache lines) - URGENT: learner PII (identifiers and field values) is logged at INFO on every query #1269 / Issue #1269: fix: keep learner person data out of the Query Planner logs #1270: the Query Planner
- Identity Mapper logs learner person identifiers at INFO on every request (same class as #1269) #1318: the Identity Mapper
- Capture query statistics for usage pattern analysis #341: the must-never-be-logged constraint
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Issue #1319: fix: keep learner data out of the GraphQL, Query Cache, …
dereck-symmetry commentedon Oct 5, 2026
Refreshed the body after today's merges:
query_planner_restapi/core.py:214) to log only the result's type. I've struck it from section 3.type_factory.py,query_cache_service/core.py,advisor_restapi/core.pyandquery_planner_restapi/core.pymoved with Issue #1319: fix: keep learner data out of the GraphQL, Query Cache, Advisor and semantic search logs #1352, Issue #1229: fix: answer 422 when /update targets a field inside an entity #1356 and Issue #1340: fix: keep internal error text out of the Query Planner's 500 responses #1354. I've updated them tomainat86049e8. Every other cited line still matches, and nothing else in sections 1–4 was fixed.orchestrators/dagster/), which this issue listed as not covered, is now Dagster LIF job logs learner records at INFO (adapter output, translation input/output, job results) #1359. I've linked it, and linked Query Cache API returns exception text in its 500/404 responses, including learner document fields #1360 as the HTTP-response side of the Query Cache lines in section 3.The scope is otherwise unchanged.
dereck-symmetry commentedon Oct 6, 2026
Triage of the Orchestrator lines in section 3, from #1365. That PR fixes the three Orchestrator lines in section 1 and leaves these two unchanged.
The lines:
orchestrator_restapi/core.py:64(Failed to submit job: {e}) andorchestrator_service/service.py:50(Failed to submit job to ...: {e}). Both log the text of whateverpost_jobraised. On the Dagster path, a failed submission also passes throughorchestrator_clients/dagster.py:111, whoselogger.exception("Dagster submission failed")logs the same exception with its traceback. That line isn't in the table above, but it gets the same verdict.What the exception text can hold. On a failed launch,
DagsterGraphQLClient.submit_job_executionraisesDagsterGraphQLClientError(<result type>, <detail>), and its text is both parts:RunConfigValidationInvalid: the detail is Dagster's config errors, and they do quote the offending value. I checked withvalidate_configagainst a typed schema, and the message readValue "SENTINEL-ID-4471" of type "<class 'str'>" is not valid for expected type "Int".InvalidStepError/InvalidOutputError: a step key or output name. No learner data.PipelineNotFoundError,RunConflict,UnauthorizedError,PythonError, ...): the server'smessage. For aPythonErrorthat is whatever the Dagster server's exception said.Why it's low risk: the LIF job's config is
lif_query_plan_parts: List[dict](orchestrators/dagster/lif-orchestrator/src/lif_orchestrator/defs/lif_job.py:32). Dagster doesn't check what's inside each dict, so the only error that quotes values can't fire on a learner value. APythonErroris the remaining unknown. I haven't seen one at launch, and I haven't checked whether its message could include run config, so this is low risk, not proven safe.Verdict: recorded as low risk and not changed. If the job's config ever gets a typed schema (for example, typing
person_id), these three lines become real leaks and should logtype(e).__name__and the result type only.Not covered here:
:65also returnsstr(e)in the 500 response body. That's the response side, and it's on #1360's list of related sites ("the orchestrator API (:65,:75)").dereck-symmetry commentedon Oct 6, 2026
The Translator's lines, from #1366. That PR fixes
translator/core.py:70,:85andtranslator_restapi/core.py:54from section 1. It also fixestranslator/core.py:64from section 3, because measuring it showed a real leak: a JSONata$number()on a learner string raisescould not convert string to float: 'Marigold', and the line logged that text.The remaining Translator line in section 3,
translator_restapi/core.py:76(the 500 handler,... Error occurred ...: {exc}), is low risk and unchanged. This is reasoned from the code, not measured:_validate_against_schemaraisesValueError, and so does pydantic'sValidationError. Both go to the 400 handler at:52, which the PR fixes.SchemaError, which quotes the schema, not the data.TypeError/KeyErrorfromdeep_mergeorconvert_transformation_to_mappings, which name types or MDR transformation keys.Not covered: the 400 response at
:55still returns the schema message, value included, to the caller who sent it. That's the response side, the same kind of issue as #1360. Since #1365, the LDE no longer logs that body.Issue #1351: fix: keep learner identifiers out of the LDE and Orchest…
Issue #1351: fix: keep learner values out of the Translator's logs (#…
Issue #1351: fix: keep learner values out of base_test's ValueError l…
Issue #1351: fix: keep user identifiers and search values out of the …
Issue #1359: fix: keep learner data out of the Dagster LIF job's logs…
bjagg commentedon Oct 20, 2026
@dereck-symmetry an update now that #1406 has merged (
37497cc). The Dagster job's own log lines are clean, but the adapters it calls still log learner data. I re-checked them on main after the merge, and the lines this issue lists are unchanged:example_data_source_rest_api_to_lif_adapter/adapter.py:31logs the request URL, which ends in the person identifier. That adapter is the one in the job's default config, and its stderr goes to Dagster's compute logs and CloudWatch.lif_to_lif_adapter/adapter.py:75and the demoadapter.py:39log a source'serrorsin full before raising. If a source echoes the query variables back, the identifier goes with them. Dagster LIF job: exceptions raised out of an op are stored with their message and traceback in Dagster's step events #1407 covers the raise but not thislogger.error.lif_to_lif_adapter/adapter.py:67(the payload, which includesidentifier),:97, and the demoadapter.py:43log full payloads and responses.I checked every module in both adapter packages, and these are the only lines that log learner data. The one other interpolating call,
data_source_adapters/core.py:50, logs credential key names, not values. #1406'scapfdtest can't catch these, because it stubsget_adapter_by_id. A test that runs the real adapter against a stubbed HTTP response would.Issue #1351: docs: say at each adapter raise that the caller must wit…
Issue #1351: fix: keep learner data out of the data source adapters' …
Issue #1407: fix: keep learner data out of the exceptions Dagster sto…
dereck-symmetry commentedon Nov 1, 2026
Closing out the last two error-path items from §3. Neither needs a code change, and here's why.
Advisor:
advisor_restapi/core.py:325(listed as:315)_safe_summarizelogslogger.exception(f"Background summarization failed for {username}"). The issue lists two concerns: the username, and the LLM exception in the traceback.get_demo_personas_as_dicts()). Issue #1319: fix: keep learner data out of the GraphQL, Query Cache, Advisor and semantic search logs #1352 deliberately kept it on the summary line just above (:321), which logs it at INFO on every logout. So:325doesn't expose anything that isn't already logged on the normal path.ToolErrorcarries GraphQL's error text, and that text can quote a learner value: graphql-core'sString cannot represent value: [...], see Issue #1351: fix: keep learner data out of the downstream error logs #1458. Butlangchain_mcp_adaptersraises it as aToolException, and the agent'sToolNodecatches it.create_react_agentbuildsToolNode(tools)with the defaulthandle_tool_errors=True(langgraph-prebuilt 0.2.3). I measured it: a tool raisingToolException("... String cannot represent value: [\"Marigold\"]")comes back as aToolMessagewithstatus="error", and nothing is raised. So the error goes to the LLM as a tool result, not out ofask_agentinto thisexcept.:325: LLM-provider errors, MCP connection errors and LangGraph's recursion limit. I couldn't produce a provider error locally, so I can't rule out that some provider quotes prompt content in an error message. But I found no path that does, so I'm not changing the line on speculation. If one turns up, the fix is the one Issue #1351: fix: keep learner data out of the Query Cache's error logs #1452, Issue #1351: fix: keep learner data out of GraphQL's error logs #1457 and Issue #1351: fix: keep learner data out of the downstream error logs #1458 use: log the type and stack, not the message.Dagster adapter:
lif_to_lif_adapter/adapter.py:80(listed as:75)When a source answers with GraphQL
errors, the adapter logs only their count and raisesException(f"GraphQL errors: {errors}"). Its own comment says the caller must not log or store that message, and the caller doesn't:run_lif_adapterinlif_job.pyis the only caller ofadapter.run().run_lif_adapter failed ...: {type(e).__name__}and raises_withheld(...) from None(Dagster LIF job: exceptions raised out of an op are stored with their message and traceback in Dagster's step events #1407), so Dagster stores neither the message nor the original traceback."Pipeline did not run or failed.".test_failed_adapter_logs_no_learner_dataalready pins this. Its adapter raises with the person identifier and a source value in the message, and the test checks Dagster's stored events, the run's logs and stdout. It passes onmain.Where #1351 stands
type_factory): Issue #1351: fix: keep learner data out of GraphQL's error logs #1457.graphql_client, semantic search): Issue #1351: fix: keep learner data out of the downstream error logs #1458.:325and adapter:80: no change, per above.:76and the example data source were triaged as low risk earlier (the 10-06 comment, and Issue #1351: fix: keep user identifiers and search values out of the Example Data Source logs #1378's body).One possible site is still untriaged:
translator_restapi/core.py:38logs pydantic'sctxfor validation errors, and a custom validator's error text could end up there. I haven't measured it yet.dereck-symmetry commentedon Nov 1, 2026
Following up on the one site my last comment left untriaged:
translator_restapi/core.py:38doesn't log learner data, so it needs no change.That line is the Translator's
RequestValidationErrorhandler. For each error it logs the location, pydantic'smsgand itsctx, but not pydantic'sinput. So it could only leak if some validation error's message or context quoted the request's data. The endpoint's only inputs are two string path parameters and a body typedinput_data: dict, and there are no custom validators. That leaves only FastAPI's own errors.I sent the real app seven bad requests, with a sentinel identifier placed wherever it could be echoed:
Input should be a valid dictionary,{}JSON decode error,{'error': 'Expecting value'}(position only)Field required,{}Input should be a valid dictionary,{}So the request body never reaches the log, only pydantic's fixed messages and the JSON decoder's position-only errors.
That closes the triage of every site this issue lists. Once #1452, #1457 and #1458 merge, nothing here is left open:
type_factory): Issue #1351: fix: keep learner data out of GraphQL's error logs #1457.graphql_client, semantic search): Issue #1351: fix: keep learner data out of the downstream error logs #1458.:325and the Dagster adapter:80: no change, see my previous comment.:38: no change, per above.:76and the example data source: triaged as low risk earlier.All three PRs use
Refs #1351, so merging them won't close it. I'd close it by hand after the last one merges.One unrelated thing turned up along the way: a request with a non-JSON content type gets a 500 instead of a 422. The handler returns
exc.errors(), whoseinputis then the raw request bytes, whichJSONResponsecan't serialize, so the global handler answers 500. It's response-side, not a log, and the Translator's only caller (the Orchestrator) always sends JSON. So I haven't filed it, but I can if you'd like it tracked.Issue #1351: fix: keep learner data out of GraphQL's error logs (#1457)
Issue #1351: fix: keep learner data out of the downstream error logs (#…
Issue #1351: fix: keep learner data out of the Query Cache's error lo…
Issue #1360: fix: answer the Query Cache API's 404s and 500s with fix…
dereck-symmetry commentedon Nov 3, 2026
#1452, #1457 and #1458 have all merged, so every site this issue lists is now fixed or triaged (see my comment above). Closing.
Issue #1461: Translator returns 422 (not 500) for non-JSON bodies, wi…