Skip to content

Learner data still reaches logs outside the four #1319 services: LDE, Orchestrator, Translator, error paths, Strawberry #1351

Closed

Description

@dereck-symmetry

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

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; DuplicateKeyError quotes the key).
  • Query Planner: query_planner_service/core.py:407, :411 (also re-logged at :232 and query_planner_restapi/core.py:233), :438. (query_planner_restapi/core.py:214 was 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 at semantic_search_service/core.py:432, :435, :450, :453).
  • Data source adapters: lif_to_lif_adapter/adapter.py:75, demo adapter.py:39.
  • GraphQL: type_factory.py:667 (date-conversion errors), :905, :1009 (Query Planner response.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

Acceptance criteria

Related

Activity

  1. added a commit that references this issue on Oct 5, 2026
  2. dereck-symmetry commented on Oct 5, 2026

    @dereck-symmetry
    ContributorAuthor

    Refreshed the body after today's merges:

    The scope is otherwise unchanged.

  3. dereck-symmetry commented on Oct 6, 2026

    @dereck-symmetry
    ContributorAuthor

    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}) and orchestrator_service/service.py:50 (Failed to submit job to ...: {e}). Both log the text of whatever post_job raised. On the Dagster path, a failed submission also passes through orchestrator_clients/dagster.py:111, whose logger.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_execution raises DagsterGraphQLClientError(<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 with validate_config against a typed schema, and the message read Value "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.
    • Everything else (PipelineNotFoundError, RunConflict, UnauthorizedError, PythonError, ...): the server's message. For a PythonError that is whatever the Dagster server's exception said.
    • Transport errors (connection refused, timeout) carry the URL, not the plan.

    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. A PythonError is 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 log type(e).__name__ and the result type only.

    Not covered here: :65 also returns str(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)").

  4. dereck-symmetry commented on Oct 6, 2026

    @dereck-symmetry
    ContributorAuthor

    The Translator's lines, from #1366. That PR fixes translator/core.py:70, :85 and translator_restapi/core.py:54 from section 1. It also fixes translator/core.py:64 from section 3, because measuring it showed a real leak: a JSONata $number() on a learner string raises could 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:

    • Schema violations don't reach it. _validate_against_schema raises ValueError, and so does pydantic's ValidationError. Both go to the 400 handler at :52, which the PR fixes.
    • What does reach it:
      • MDR client errors, which carry URLs and status codes.
      • jsonschema SchemaError, which quotes the schema, not the data.
      • TypeError/KeyError from deep_merge or convert_transformation_to_mappings, which name types or MDR transformation keys.
    • The unknown: an arbitrary exception whose text includes data. I haven't found a path that produces one, but I haven't proven there isn't one either.

    Not covered: the 400 response at :55 still 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.

  5. added 4 commits that reference this issue on Oct 10, 2026
  6. added a commit that references this issue on Oct 20, 2026
  7. bjagg commented on Oct 20, 2026

    @bjagg
    Contributor

    @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:

    • INFO: example_data_source_rest_api_to_lif_adapter/adapter.py:31 logs 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.
    • Error paths: lif_to_lif_adapter/adapter.py:75 and the demo adapter.py:39 log a source's errors in 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 this logger.error.
    • DEBUG: lif_to_lif_adapter/adapter.py:67 (the payload, which includes identifier), :97, and the demo adapter.py:43 log 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's capfd test can't catch these, because it stubs get_adapter_by_id. A test that runs the real adapter against a stubbed HTTP response would.

  8. added a commit that references this issue on Oct 22, 2026
  9. added 2 commits that reference this issue on Oct 23, 2026
  10. dereck-symmetry commented on Nov 1, 2026

    @dereck-symmetry
    ContributorAuthor

    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_summarize logs logger.exception(f"Background summarization failed for {username}"). The issue lists two concerns: the username, and the LLM exception in the traceback.

    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 raises Exception(f"GraphQL errors: {errors}"). Its own comment says the caller must not log or store that message, and the caller doesn't:

    • Searching the whole repo, run_lif_adapter in lif_job.py is the only caller of adapter.run().
    • On failure it logs 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.
    • If retries run out, the fan-in sends the Query Planner the fixed text "Pipeline did not run or failed.".
    • test_failed_adapter_logs_no_learner_data already 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 on main.

    Where #1351 stands

    One possible site is still untriaged: translator_restapi/core.py:38 logs pydantic's ctx for validation errors, and a custom validator's error text could end up there. I haven't measured it yet.

  11. dereck-symmetry commented on Nov 1, 2026

    @dereck-symmetry
    ContributorAuthor

    Following up on the one site my last comment left untriaged: translator_restapi/core.py:38 doesn't log learner data, so it needs no change.

    That line is the Translator's RequestValidationError handler. For each error it logs the location, pydantic's msg and its ctx, but not pydantic's input. 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 typed input_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:

    Request Logged message / context Sentinel in log?
    body is a list, a string, or a number Input should be a valid dictionary, {} no
    malformed JSON (two variants, one with the sentinel at the error position) JSON decode error, {'error': 'Expecting value'} (position only) no
    no body Field required, {} no
    non-JSON content type Input should be a valid dictionary, {} no

    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:

    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(), whose input is then the raw request bytes, which JSONResponse can'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.

  12. added 4 commits that reference this issue on Nov 1, 2026
  13. dereck-symmetry commented on Nov 3, 2026

    @dereck-symmetry
    ContributorAuthor

    #1452, #1457 and #1458 have all merged, so every site this issue lists is now fixed or triaged (see my comment above). Closing.

  14. added a commit that references this issue on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions