Skip to content

Bundle W5: open data checks (E1 fixes, B1-B5) and the investigation visibility guard (TR-147) - #1130

Merged
dwolfson merged 29 commits into
mainfrom
claude/bundle-w5-2026-11-24
Nov 24, 2026
Merged

dwolfson merged 29 commits into
mainfrom
claude/bundle-w5-2026-11-24

Conversation

@dwolfson

Copy link
Copy Markdown
Owner

One signed merge of the open data line (claude/tr54-b5-questions-wired, 93c9b68) and one of a test fix on the TR-147 branch (02a9531) onto main c3cef6e. Every commit is signed and carries Signed-off-by. The branch tip is 8d3e245.

What is in it, by branch

Branch Commits
E step 1 and E1 fixes bde0029, bcbd25a, 50eaa8e
B1 c2e406f, merge 8742412
B2 afbd075, 322630a, 82cce9d, merge 8614175 (the E1 fix-up into B2's base)
B3 e78dc26, 3ceb283, f130fe1
B4 ddf69d7, afe2f98, 01c89e8, 41b6aff, 8dbf470
TR-147 7fd5d6a, merge ee05eef, cee628d, test fix 02a9531
B5 d9e8f6c, d071cc0, 0d9a60b, 2533e76, 93c9b68
Bundle merges 36f89e7 (the open data line into main), 8d3e245 (the TR-147 test fix)

Resource Explorer: open data

  • E step 1 and E1 fixes. Recorded fixtures now say what the DCAT and CKAN adapters reach on ArcGIS Hub, Socrata, OpenDataSoft and DKAN. A licence a portal states is read as text, not as an id, through one accessor that also gives its words. rights is read. A DKAN url is built correctly. A CKAN probe that finds the portal is not CKAN moves on to DCAT and says so.
  • B1. One queue kind, open_data_analysis_run, and a runner for one analysis of one dataset. A result is stored, never published. The price route says a mistyped analysis id is a 400, not a price (W-B1-1).
  • B2: od_licence_usable. Reads the stored licence and says what it requires: attribution, share-alike, commercial use. A licence the table does not know, or one stated only in words, is "not judged"; RE gives no legal advice. The stored result holds dataset facts only. How the licence fits a purpose is worked out for each reader when they look, from the licence needs stated by the investigations that reader can see; it is never stored.
  • B3: od_cadence_kept. Says whether a dataset is kept to the update cadence its publisher states, from stored refresh history only, with no portal call. One refresh is "not enough history", and a dataset that states no cadence is "not judged". Lateness is judged per look, not between the modified dates RE happened to observe. A dataset that lapsed once but is current now says both.
  • B4. Scout, profile and refresh are queued per-dataset runs, and od_profile is built. A run already queued or running is not queued twice. The old inline work-list loops are removed; their tests cover the per-dataset path. A work list's run view no longer reads "never run" for a run buried under other entries.
  • B5. Each built check is wired to its question. A question row says what the stored result says: answered, partial, nothing found, not run yet, no reader yet, or not established. It is read from the stored result, never from the Activity status. The built checks can be scheduled the way other queued analyses are. Q-0113 ("usable for our purpose, and what does it require of us") is answered only for a reader whose investigations state a licence need, with the requirements and that reader's own fit. With no stated purpose it is partial and not counted, and with no signed-in reader it says the fit was not judged. The catalogue text for Q-0113, Q-0114 and Q-0115 no longer says the question is not yet wired.

Resource Explorer: TR-147 (security, medium)

An investigation's data request, and a work list linked to an investigation, are now visible only to people who can see that investigation. Before, any signed-in user could read, or replace, another person's data request, and the work-list routes never asked whether the caller could see the list's investigation. Now: nobody signed in gets 401, never the shared identity that sees every investigation by design; then the investigation is read as that caller, and one the caller cannot see is a 404 with the same words as one that does not exist. This covers the data-request routes, lens terms, fit, the work-list routes, and the open data presses and run view that act on a list.

Tested

All on a clean tree, SQLite, no shared Postgres, each tree importing its own packages. Counts on the branch tip (8d3e245) against main (c3cef6e):

  • The selection (test names containing schedul, automate, subscription, tr54, open_data, question, catalog, investigation, work_list, declared, analysis or run_queue), with EGERIA_USER unset and with EGERIA_USER=someoneelse:
    • branch tip 8d3e245, in a venv synced from uv.lock: 3,577 passed, 181 skipped, 0 failed, in both modes;
    • main c3cef6e: 3,307 passed, 181 skipped, 0 failed, in both modes. The 270 more passes are the new tests.
  • The tests outside that selection that reference one of the 27 changed source files (205 test files, 2,878 tests), both modes:
    • branch tip, in a venv synced from uv.lock: 2,656 passed, 222 skipped, 0 failed, in both modes;
    • main: 2,655 passed, 222 skipped, 1 failed, test_reader_seam_host.py::test_re_serves_exactly_the_reads_the_library_declares (see the register notes). On the shared dev venv the branch tip fails that same test and no other, so the two failing lists are identical by name.
  • The skips are the opt-in requires_pgvector tier; they need a Postgres and were not run here.
  • One test outside the selection failed on the first pass, test_csv_in_out.py::test_export_routes_name_their_files: it called a work-list export with nobody signed in, which TR-147 now refuses. The fix, 02a9531, signs in a real caller and also asserts that an anonymous call is 401, serves nothing and changes nothing. The old test fails on its parent with 401, and the new one fails on code without the guard.
  • The 17 test files that call a guarded route pass (353 tests); no other test calls one with nobody signed in.

Register notes

  • Venv skew. In a worktree, the shared dev venv's editable installs (23: 13 packages and 10 step packages) resolve to the main checkout, so a test can pass against main's code and prove nothing about the branch. A worktree test run must put the worktree's own packages first, or use a per-worktree uv sync --frozen.
  • Reader seam. test_reader_seam_host.py::test_re_serves_exactly_the_reads_the_library_declares fails on main in the shared dev venv: RE serves 13 reads and the installed library (0.4.0) declares 12; RE requires egeria-trellis-analytics>=0.5,<0.6 and uv.lock pins 0.5.0. It passes in a venv synced from the lockfile. RE's list is the current one.
  • 401 on export.csv. GET /api/work-lists/{slug}/export.csv for a list linked to an investigation now needs a signed-in reader who can see that investigation. This is intended (TR-147).

Changes in behaviour

  • TR-147: the routes above refuse nobody-signed-in with 401 and an investigation the caller cannot see with 404. Scripts that read a work list linked to an investigation must sign in.
  • Questions page: Q-0113, Q-0114 and Q-0115 now show what the stored result says, and Q-0113 depends on the reader.

Deploy notes

  • No schema change and no new package. The new queue kind is a name, so a deployed worker needs the new code before it can run these runs.
  • The open data checks run only when someone presses them or schedules them; deploying starts nothing.
  • An environment that tests from a worktree should use a per-worktree venv (see the register notes).

🤖 Generated with Claude Code

… reach on ArcGIS Hub, Socrata, OpenDataSoft and DKAN

Read-only GETs on 2026-11-23, the portal's real answers, head-cut mechanically (envelope plus first entries verbatim; README says
how, and which portal, size and count each is). 16 tests characterise what the existing adapters do with them TODAY:

  ArcGIS Hub     reads. A site with a licence URL (Minneapolis: 248 of 285) is read in full but for size; a site whose `license` is a
                 free-text HTML disclaimer (Tucson: 153 of 153) is PARTIAL: the disclaimer becomes licence_id and the flags say not_reported.
  Socrata        partial: title, publisher, modified, formats are read; the feed states NO licence (0 of 1142) or size.
  OpenDataSoft   fails at the root (/data.json streams 77.9 MB, over RE's 64 MiB limit: refused, not truncated) and on its DCAT export
                 (RDF/XML only, the probe says so; no JSON-LD). Its own Project Open Data export reads, partial: the licence is in
                 `rights` ("Licence Ouverte (Etalab)"), which the adapter ignores.
  DKAN 2         the CKAN adapter fails (HTTP 404, no /api/3/action, never read as nothing found); the DCAT adapter reads its data.json,
                 partial: no landingPage so no url, a licence on 106 of 347 entries and a URL RE's table lacks.

No adapter changes: where a family fell short the fixture shows what a native adapter would have to add (the ArcGIS licence text, the Socrata
licence, OpenDataSoft's `rights` and its native catalog API, DKAN's landing page), and that is for the next step.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…a DKAN url; a CKAN probe that moves on to DCAT

What the W4 fixtures showed, each fixed with a fixture-based test (the Architect's rulings, 2026-11-23):

(a) A licence field that is neither a URL nor an id is STATED TEXT. licences.classify_licence() separates an id (a URL, an id in RE's
    table, or a bare token such as OGL-Canada-2.0) from text (a sentence, a name with spaces, an HTML disclaimer). The DCAT adapter
    puts text in the new row field licence_text and sets licence_id to not_reported; the flags are not judged. ArcGIS Hub's 2 KB
    disclaimer no longer lands in licence_id. No new column: the text is kept with the stored record as `_licence_text`, RE's own
    underscore-prefixed annotation like `_licence_note`, so a stored dataset keeps it without a schema change.
(b) OpenDataSoft's Project Open Data export states its licence as `rights` text: read as licence_text (and the note says it came from
    `rights`), only when the entry has no `license`.
(c) DKAN's usa.gov licence URLs stay the id and are not judged (RE's table does not map them): pinned, never "usable".
(d) With no landingPage the url is the entry's own IRI, an identifier that is a URL, or a distribution's ACCESS URL (never a download
    URL), else not reported.
(e) CkanAdapter.probe: a 404/410 or a non-JSON answer at /api/3/action is NotCkan ("not a CKAN portal (no /api/3/action here)"), and
    registering a portal typed as CKAN then tries DCAT (the activity entry records typed_as); both refusing says both, in words. A 503 or
    a timeout is raised as it is, never read as "not CKAN". Once a portal is registered as CKAN a 404 stays a raised error. No transport,
    no probe call, as before.
Also: the DKAN 404 fixture is trimmed to the status and a minimal body (it carried the portal's admin e-mail address).
Changed on purpose: the W4 characterisation test that pinned the disclaimer-as-id; the seeds test's fake transport now answers the
www.demo.ckan.org probe a typed URL triggers.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Every dataset check runs on the queue path, per dataset, from the start (nothing built inline and rebuilt). No analysis logic here:
B2-B4 register their runners.

- run_queue: kind open_data_analysis_run (registry.RUN_KINDS) and _handle_open_data_analysis_run, the twin of the file-system handler.
- workflows.analysis.run_open_data_analysis / execute_and_record_open_data_analysis: one stored result per (dataset slug,
  analysis_id) in step_annotations (entity type open_data, run = the activity id); an Activity entry finished ok or error; published is
  None: stored, never published, no Egeria write. A runner that raises ends the activity in error with its words and stores nothing.
- open_data/analyses.py: the runner registry (register(analysis_id, run, calls)), the refusals in words (an id that is not an
  open data analysis names the declared ones; a declared analysis with no runner says "declared but has no reader yet"; the three
  inline ones say they run from a work list press today), the price line (the portal calls one run makes; "not priced", never 0, when
  there is no reader yet), and the stored annotation record (result states: measured, not_measured, not_permitted, not_applicable,
  nothing_found).
- Routes: POST /api/open-data/datasets/{slug}/analyses/{analysis_id}/run (signed in; 404 for a missing dataset, 400 in words for an
  unknown or unbuilt analysis, before anything is queued) enqueues, writes the 'running' activity row first and returns
  {status, activity_id, run_id, price}, so the checklist's pollActivity always has an id; the run is attributed to requested_by, the
  person who pressed. GET .../price shows the call count before the press.
Tests (14, temp SQLite, no network, no Egeria): the kind and handler exist; the handler stores one result and finishes the activity;
a second run is its own run and the latest is read; a runner that raises; a missing dataset; an unknown and an unbuilt analysis; the
three price cases; the route enqueues with an activity_id and records who pressed, refuses in words before queueing, needs sign-in.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…words

The Architect accepted licence_text in dataset["record"]["_licence_text"] (no DDL) on two conditions.
1) Exactly one reader: open_data.licence_text(dataset) -> str | None (None = not reported), in licences.py, which alone knows the key
   (LICENCE_TEXT_KEY; the adapter writes through the constant). E1's own tests read through it now; a test scans the production code and
   fails if anything else touches the key.
2) When licence_id is not reported and text is present, the UI and API say "licence stated in words, not identified", never "no
   licence": licences.licence_statement(dataset) gives identified / stated_in_words / not_stated with those words; the dataset question
   row uses them (so a text-only licence is no longer dropped as nothing), and GET /api/open-data/datasets/{slug} carries
   licence_statement.
A real column is a later item.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Reads the dataset's stored licence (no portal call) and reports the declared measure licences_read plus a judgement of what the
licence requires (attribution, share-alike, commercial use), against the purpose the dataset's investigation states.
- Judged only from the licence identifier, through RE's table of SPDX / Creative Commons / ODC ids (an IRI RE maps counts as its id).
- Any other id: "not judged: licence <id> is not in RE's table", never "usable". A licence stated only in words: read, not judged,
  "licence stated in words, not identified". None stated: nothing_found, never "not usable".
- A purpose is the licence need an investigation the dataset belongs to has stated; with none, the requirements are listed and no fit
  is judged. A fit is fits / does_not_fit / could_not_check (the existing fit cell).
- Runs on B1's queue path; the runner is found by id (analyses.BUILT_IN), a registered stand-in still wins. Stored, never published.
- analysis_catalog.yaml: od_licence_usable built: true (only it); answers_questions stays false until B5.
- Q-0113 (Architect ruling): the GAP row would trip the generator guard now the analysis exists, so it is PARTIAL with the
  ruled words, mechanism "Direct Field + Analysis", history note dated 2026-11-23; question_catalog.yaml regenerated.
- E1-1 (Architect nit): "None", "Unknown", "Other", "N/A", "TBD" ... read as no licence, not as an id; the adapter keeps the raw
  word in _licence_note.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Two tests that run licence_usable.purposes_for, and a whole queued run, inside run_queue._run_as_requester (the wrapper every
queued open data run executes in, which sets the presser as current_caller before acting as Daemon(RUN_QUEUE)). The presser's own
creator-only investigation is found and its need is judged; another person's run finds none and the result carries nothing of it.
Test only: no production change.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…t is computed per reader at read time

step_annotations keeps ONE result per (dataset, analysis) with no user column, and open data is shared, so a result that carried the
presser's investigation titles and fit verdicts put private content in a shared row (and in the Activity summary).
- judge(dataset) is pure and stores facts only: state, licence id or words, requirements, licences_read, judged. No investigation
  slug, title or fit; the summary reads "cc-by-sa-4.0: attribution required; share-alike required; commercial use allowed".
- run() reads no per-user data at all, so a pressed run and a scheduled one (no presser) store the same result.
- fit(measures, purposes) is pure and computed from the STORED requirements; view(registry, store, dataset) gives a reader the shared
  facts plus the fit to the purposes THIS reader's investigations state, through the registry's per-user scoping. A reader with no
  identity gets no fit ("fit not judged: no signed-in reader"): the shared identity would see every investigation.
- GET /api/open-data/datasets/{slug} carries licence_check = view(...), None until the check has run.
- purposes_for's docstring now says what it reads and for whom.
Tests: the stored annotation and the Activity entry of A's press hold no slug or title; a read as A shows A's fit, as B shows the
same requirements and no fit; a reader with no identity gets none; a scheduled run reads no investigation or data request.
The per-user pinning test of 322630a stays.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…sher states

Compares the stated cadence (accrualPeriodicity in the stored record) with the modified dates RE OBSERVED over the dataset's refresh
history: each kept external_change look is one observation. Stored history only: no portal call. Stores dataset facts only, nothing
per-user (the result is one shared row, as W-B2-2 requires).
- cadence.parse_cadence reads the three forms portals use: an ISO 8601 duration (P1M, R/P1M), a Dublin Core frequency IRI, a plain
  word; a month is a twelfth of 365 days rounded, a quarter 91, a year 365. A cadence that is not an interval (irregular, continuous,
  as needed, unknown, or a word RE does not know) is kept as stated and not judged.
- Fewer than two observations: not_measured, "not enough history (1 refresh)" (or "no refresh yet"), never "kept". No cadence stated:
  nothing_found, never "not kept". Otherwise "late" when the latest modified date is older than the cadence allows at the last look
  (half as much again, at least a day), or two modified dates RE saw were further apart than that; else "kept".
- analysis_catalog.yaml: od_cadence_kept built: true (only it, besides B2's); answers_questions stays false until B5.
- Q-0114 (Architect's constraints): PARTIAL with the absence rules in words, mechanism "Direct Field + Analysis", dated history note;
  question_catalog.yaml regenerated, its diff touches Q-0114 only.
- B1's "no runner" test and B2's "still unbuilt" assertions now use od_profile, the one still unbuilt until B4.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ied dates RE observed

RE sees a modified date only when it looks. If it looks less often than the cadence, consecutive OBSERVED dates are at least a look
interval apart even when the publisher updated on time in between; the old rule reported that sampling as the publisher's lateness
(stated P1M, looks every ~91 days with dates 2-3 days old, read "late: two modified dates were 92 days apart").
- late = some look saw a modified date older than the cadence allows (max over looks of looked_at - modified); the words name that look.
- When the median interval between RE's own looks is longer than the allowance, "kept" says so ("kept in the looks RE has; RE looked
  every ~N days, longer than the cadence, so a late update between looks cannot be seen"); never a bare "kept". looks_interval_days stored.
- longest_gap_days stays as a fact, said to be between the modified dates RE observed, and is not a lateness test.
- "3 refreshs" -> "3 refreshes".
- A placeholder in the cadence field (unknown, none, n/a, tbd, null ...) reads as no cadence stated (nothing_found), the raw word
  noted, like E1-1's licence words; it is no longer a stated non-interval.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…profile is built

A work-list press now enqueues ONE open_data_analysis_run per dataset (B1's queue kind) and returns what it queued and what it costs;
nothing is done in the request. The old inline response shape ({scouted, rows, profiled, first_look ...}) is not kept.
- open_data/queued.py: runners external_data_scout (service.scout_dataset, 1 call), external_data_refresh (refresh.refresh_dataset, 2
  calls), external_data_profile and od_profile (profile.profile_dataset; the same runner, od_profile reached from one dataset; up
  to 6 calls, an upper bound). Each wraps the per-dataset function the inline press looped over, so what a run reads is unchanged;
  the profile still keeps its step_run for the work-list profile view.
- A portal that does not answer fails THAT run only: analyses.RunnerFailed ends its activity in error, "<dataset>: could not read from
  <portal>: <why>; the earlier values were kept", stores no result and leaves the dataset's columns alone. The other runs finish.
  GET /work-lists/{slug}/runs?analysis_id= says which dataset failed and why.
- od_profile result: measured with distributions_profiled / distributions_listed / not_read (what was not read, by file and why);
  no distributions listed is nothing_found; none profiled is not_measured, never 0 rows.
- analysis_catalog.yaml: the three work-list entries inline -> queued; od_profile built: true; answers_questions stays false (B5).
- Q-0115: PARTIAL with the absence rules in words, mechanism "Value Profiling" (an existing value; there is no Direct Field to show),
  dated history note; question_catalog.yaml regenerated, its diff touches Q-0115 only.
- scout_work_list, refresh_work_list and profile_work_list stay as library helpers (the tests use them); no route does.
- No per-user data is stored by any run. The earlier tests that took od_profile as the unbuilt example now take its runner away.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
A "late" verdict came from a look that saw an old modified date; when the last look found the dataset within the allowance the summary
said only "late". It now adds "; current now (last modified X, N days before the last look)". A dataset still lapsed at the last look
is not called current.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
The inline profile press refused a second press (AlreadyRunning, 409). B4 removed that, so a double click or two people pressing
queued a second full set of runs: up to 6 downloads per dataset, twice.
_enqueue_dataset_run now goes through registry.enqueue_run_once (the atomic check-and-insert survey_definition_run uses): if a run of
the same (dataset slug, analysis_id) is queued, claimed or running, nothing is enqueued and the existing run's activity_id and run_id come
back with already_queued. A claimed or running run with no sign of life (a dead worker) does not block; a finished run does not block;
a different analysis or dataset is not blocked. A refused press opens no activity entry.
- The work-list answer counts them ("queued N, already_queued M") and prices only what was newly queued: "0 datasets · 0 portal calls ·
  3 already queued, not priced again".
- The per-dataset run route answers status "already queued" with the existing ids and no new price.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…e is built

The row said "Until the question is wired to it, the row shows no answer from the publisher's record and reads 'no reader yet'." od_profile
IS built now, so "no reader yet" was false. The Architect's replacement: "Until the question is wired to it, the row gives no answer:
od_profile's result is not read by this question yet, and the publisher's record holds nothing that answers it."
The CSV is the source; question_catalog.yaml is regenerated from it (its diff is Q-0115's note only). A new test asserts the sentence, that
"no reader yet" is not in the cell, the mechanism, and the dated history note.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…r the per-dataset path

B4 made scout, refresh and profile queued per-dataset runs, so the functions that looped over a whole work list inline were dead code that
invited reuse. Removed: service.scout_work_list, refresh.refresh_work_list, profile.profile_work_list, and open_data.profile's
AlreadyRunning, NothingToProfile, CLAIM_STALE_SECONDS and ALREADY_RUNNING_WORDS (the file-system modules have their own classes of the
same names; they are untouched). The catalog comment that named scout_work_list now says the press queues one run per dataset.
The tests that still cover per-dataset behaviour moved onto the real per-dataset path:
- profile tests run the queued runner (queued.run_profile) per dataset and read back through the work-list view; a portal that will not
  list distributions now fails that run (RunnerFailed, "the earlier profile was kept") and stores nothing;
- refresh and scout tests loop refresh_dataset and scout_dataset, as the queued runs do.
Deleted the two tests that covered only the removed behaviour (an empty work list, a second press refused by a claim): the route 404 and
W-B4-1's already-queued tests cover what a press does now.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ed under other entries

work_list_runs read a dataset's newest 50 activity entries of any kind, so a dataset that was run but had more than 50 later entries
read "never run". It now asks only for analysis-run entries and scans the newest RUN_SCAN_LIMIT (500) of them; when the limit is reached
with no run of that analysis in them it says status "unknown" and "no run among the last 500 entries", never "never run". The count
"unknown" is added to the answer.
New tests/test_tr54_b4_work_list_runs.py (4 tests; two failed before the fix): a run under 70 later entries is found, the newest run wins,
a dataset truly never run says so, and a reached scan limit says so.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…e only to who can see the investigation

Found by the TR-145 audit and confirmed on main 4867b7b (security, medium). PUT /api/open-data/investigations/{slug}/data-request checked only
that someone was signed in, then replaced the row keyed on the investigation slug alone (DELETE + INSERT), so any signed-in user could REPLACE
another person's request. The GET checked nothing at all. `lens-terms` and the work-list `fit` read the stored request of any slug, the import
routes added datasets to any investigation or list named, and no work-list route asked whether the caller could see the investigation the list
is linked to.

One guard, web/visibility.py, with two rules in this order:
1. A signed-in caller FIRST. No caller is a 401, never the shared identity "" (which sees every investigation by design).
2. Then registry.get_investigation(slug, user_id=<that caller>). None is a 404 with the SAME words the route uses for a slug that does not
   exist, so it never confirms that a private investigation (or a list linked to one) is there.

Applied to:
- GET and PUT /investigations/{slug}/data-request; POST /lens-terms?investigation=; POST /work-lists/{slug}/fit?investigation=;
- the import routes' `investigation` and `work_list_slug`;
- every open-data work-list route (scout-price, scout, profile GET/POST, refresh-price, refresh, fit), each in its own missing-list words
  (profile says "This work list holds no open data to profile." for a missing list, so the guard says that);
- every /api/work-lists route with a {slug} (one router dependency), POST / with an investigation, and POST /runs/batch with a work_list_slug;
- GET /api/work-lists/runs/sets/{set_id} (Architect ruling): a set id is a capability, not a permission (it leaks through logs, history,
  shared links) and the progress names a list's datasets. WorkLists.batch_set_owner resolves a set to its list and its requester; a set run
  over a visible list is as visible as that list, and an invisible list reads as an UNKNOWN set id (same words). A set with no work list is
  readable only by whoever queued it; one queued with no requester (a daemon or a script) by no web caller;
- WorkLists.list_all leaves out lists whose investigation the caller cannot see. A list with no investigation stays visible to everyone; the
  shared identity (a daemon, a script) still sees all.
The PUT's edit rule stays visibility: a shared investigation's members may edit its request, a creator-only one only its owner.

Tests (tests/test_tr147_investigation_visibility_guard.py, 21, through the web layer with real tokens for A, B and an anonymous caller): B gets
404 on GET, PUT, lens-terms and fit for A's creator-only investigation, in the words of a missing slug, and B's PUT WRITES NOTHING (the row is
unchanged); A gets 200 and can replace their own; shared and ownerless (legacy, no owner) investigations are visible to both; an anonymous
caller gets 401; the guard refuses a missing caller before it asks the registry; list_all as B omits A's private list; the work-list and open-data
work-list routes answer B in a missing list's words. B importing into A's private investigation or list (and from a repository) gets the
missing-target 404 and writes nothing: dataset rows, investigation members, list members and the lists are asserted unchanged, and A succeeds;
B creating a list linked to A's private investigation gets 404 and no list appears. B holding A's set id gets 404 (A 200, anonymous 401), a
set on a list with no investigation stays readable by all, a set with no list is readable only by its requester. 14 of the 21 fail on
main (the other 7 are positive controls). Three older test files authenticated with a stub or not at all; they now use a real caller
(test_open_data_scout, test_work_list_investigation_routes, test_work_lists_batch_entity_type).
Against main: the same 2 failures and 1 error, none new; 1280 passed against 1266.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ne at the B4 tip

TR-147 is its own branch off main 4867b7b and is not on main yet, so it is merged here as the branch, not as main. Merge base is main.

One conflict, in web/routes/open_data.py. B4 rewrote the scout, profile and refresh presses to queue one run per dataset
(_press_work_list); TR-147 had put its guard on the old inline versions of the same three routes. Resolution: B4's presses are kept as they
are, and TR-147's guarantee is carried onto the new code instead of being dropped:
- _press_work_list asks _guard_list(request, slug) after sign-in and before it reads or queues anything, so a press on a work list linked to
  an investigation the caller cannot see is a 404 in a missing list's words and queues nothing (one place, so scout, profile and refresh
  cannot drift apart);
- GET /work-lists/{slug}/runs takes the request and asks the same guard first.
The old inline press bodies and their special-cased "missing list" words are gone with the inline press itself.
Everything else (visibility.py, the work-list routes, list_all, batch_set_owner, the test updates) merged without change.
Tests on the merged tree: 321 passed (TR-147's 21, B1-B4, the open-data suites, the work-list route suites).

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…sts)

The guard itself arrived with the TR-147 merge (ee05eef): _press_work_list and GET /work-lists/{slug}/runs ask _guard_list first, because B4
rewrote the routes TR-147 had guarded and the resolution had to carry the guarantee over. This commit pins it on B4's new routes.

tests/test_tr54_w5_b4_routes_guarded.py (9), through the web layer with real tokens for A, B and an anonymous caller, on TR-147's fixtures:
- B pressing scout, refresh or profile on A's private data list gets 404 in the words of a list that is not there, and NOTHING is queued: the
  count of open_data_analysis_run rows and of open-data activity entries is unchanged;
- A pressing on their own private list queues its one run;
- an anonymous press is a 401 and queues nothing;
- B reading /runs?analysis_id= of A's private list gets 404 in a missing list's words with nothing about the list's datasets, A gets 200 with
  the run row, and nobody signed in gets 401;
- a list with no investigation is pressed and read by anyone signed in.
Bite: 4 of the 9 fail on the B4 tip 8dbf470 (B's three presses queue runs, and B reads the runs view); the other 5 are positive controls.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
GET /datasets/{slug}/analyses/{analysis_id}/price answered an analysis id that is not declared at all with 200 and "not priced · <id> has
no reader yet", which is true only of an analysis that IS declared and has no runner. The run route already refused the same id with a 400 and
the refusal's own words ("'x' is not an open data analysis: the ones declared for a dataset are ..."). The price route now does the same:
an undeclared id is a 400 with analyses.refusal(id). A declared analysis with no runner is still "not priced" (never 0), and an unknown
dataset is still a 404.
tests/test_tr54_b1_price_route_refuses_typos.py (4): the typo is a 400 whose words equal the run route's; a built analysis is still priced;
a declared analysis with its runner taken away is still not priced; an unknown dataset is still a 404. The typo case fails before the fix.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…row says what the stored result says

Until now a question row was either "no reader yet" or partial from the record, and `answered` was a hard 0. The three checks exist (B2, B3,
B4), so the rows follow them. The amended three states (Architect, 2026-11-23), plus the rule from W-B1-2:
(1) the lead analysis is not built (a fixture catalogue says so)    -> "no reader yet", or partial where the record states a field, as before;
(2) built, `answers_questions` not true (the state after B2)        -> partial from the publisher's record (or "no reader yet" with nothing in
    the record), and the words say the check is NOT counted as this question's answer;
(3) built and wired (answers_questions true)                        -> the STORED result decides:
    - never run: ○ not run on a bare record, ◐ partial where the record states a field, "Not run on this dataset yet" in the words either way;
    - run, measured, and judged (measures.judged is not False): ✓ answered, has_data true, the stored summary as the answer;
    - run, measured but not judged (a licence the table does not know, one stated in words, a cadence that is not an interval): ◐ partial,
      "read and not judged", NOT counted;
    - nothing_found: ∅ nothing found, the catalogue's own absence sentence; not_measured / not_permitted / not_applicable: ? not established,
      with the stored words (e.g. "not enough history (1 refresh)"). Neither is counted.
The Activity status is never consulted: a run that measured nothing, found nothing or judged nothing ends its Activity "ok" (W-B1-2).
`answered` and each stage's `answered` are counts of has_data rows; nothing prints a bare zero.

- analysis_catalog.yaml: `answers_questions: true` on od_licence_usable, od_cadence_kept, od_profile (the work-list entries keep false).
- analysis_catalog_reader: AnalysisCatalogEntry.answers_questions (True/False/None), read from the YAML, not in to_dict; `declaration.answers`
  is still generated from the question catalogue's bindings, and only `false` suppresses that, so True changes nothing there.
- dataset_questions.build(d, registry=None, declared=None): the registry is where the stored results are read, `declared` the catalogue to judge
  built and wired against (the real one by default; a test passes its own). GET /datasets/{slug}/questions passes the store's registry.
- open-data-questions.js: the count line and stage strip say answered and in part and not run yet in words (stageWords); the glyphs are the
  shared table's (answered, nothing, partial, unrun, no_reader, not_established), none new.
Tests: tests/test_tr54_b5_questions_wired.py (20): the three states on fixture catalogues, has_data after a run for licence, cadence and
profile; an unknown licence, no licence and one refresh each ran "ok" and are not answers; an Activity that says ok with no stored result is not
an answer; a later failed Activity does not undo a stored answer; the route serves the stored result and only known states; every state has a
glyph; the page text; the catalogue flags. 19 of the 20 fail on the parent (the one that passes is the glyph-table control).
The older question tests keep testing the record-derived rows through a "not built" fixture catalogue, the route test expects the new real
states, and the B2/B3/B4 catalogue tests that said answers_questions stays unset until B5 now say it is true.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ueued analyses are

A dataset can now carry a schedule for any open data analysis that has a runner (the three checks, and scout, refresh and profile), through
the same /api/schedules routes and the same timer as a repository or a database.
- web/routes/schedules.py: "open_data" is a schedulable resource kind (its dataset must exist: 404 "No open_data 'x'" otherwise). A schedule
  is refused at creation, in the run route's own words, for what could never fire: an analysis that is not declared (a typo), one with no
  runner, or a Survey Definition (422). An open data check is stored and never published, so creating a schedule, and "run now", ask for
  no Egeria write right (the publish and start_action checks the other kinds need are skipped for this kind only).
- scheduler._execute: an open_data branch runs the same run_open_data_analysis a press queues, in the scheduler's own thread, as whoever
  _as_schedule_creator made the caller (or nobody, for a schedule with no creator). It stores the same shared dataset facts and reads NO
  per-user data (no investigation, no data request): the test makes list_investigations and get_data_request fail if touched. A dataset that is
  gone, an analysis that cannot run, or a runner that fails (a portal that does not answer) is an error in the schedule's words, never a quiet
  ok, and stores nothing.
- The timer path is tested end to end: a due schedule runs, its Activity entry is written, the schedule records ok, and the question row then
  reads the stored result (✓ answered), as it does after a press. "Run now" runs it and does not advance the next slot.
tests/test_tr54_b5_schedulable.py (7): all seven failed before the change.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
The question is "usable for OUR purpose, and what does it require". The stored check answers the second half; the purpose is the reader's own. For od_licence_usable the questions route now reads licence_usable.view under the request's caller: a reader whose investigations state a licence need gets answered, with the requirements and that reader's fit words; none stated gives partial, not counted (usable for your purpose: no purpose stated by your investigations); no identity gives partial (fit not judged: no signed-in reader). Nothing is stored; one reader never sees another's investigation.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…wired

B5 wired the three questions to their checks, so the sentence beginning 'Until the question is wired to it' was false. Each now says whose answer the row is: Q-0113 the stored check with its fit to the reader's own investigations' stated licence needs, Q-0114 the stored check, Q-0115 the stored profile. The kind stays PARTIAL. The YAML was regenerated from the CSV and its diff touches only those three entries.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…and its guard tests, into main c3cef6e

Merges claude/tr54-b5-questions-wired (93c9b68), which stacks: E1 fixes bcbd25a and 50eaa8e; B1 c2e406f; B2 afbd075, 322630a, 82cce9d; B3 e78dc26, 3ceb283, f130fe1; B4 ddf69d7 with afe2f98, 01c89e8, 41b6aff, 8dbf470; TR-147 7fd5d6a with its merge ee05eef and guard tests cee628d; B5 d9e8f6c, d071cc0, 0d9a60b, 2533e76, 93c9b68. Built on main c3cef6e (tree 071174c); no conflicts.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…d pins that nobody signed in gets 401 and nothing changes

test_csv_in_out.py::test_export_routes_name_their_files called GET /api/work-lists/{slug}/export.csv with no token for a list linked to an investigation. Since TR-147 that is a 401 (Sign in to continue.), which is the intended behaviour: the route stays, nobody signed in is refused, a signed-in person who can see the investigation gets the CSV. The test now signs in 'importer' (who created the investigation) with a real access token, and adds that the anonymous call is 401, serves nothing of the list and leaves the stored list unchanged. Test-only. Found by the check of tests outside the -k selection that reference the changed files; no other test calls a guarded route with no caller (17 files that name one: 353 passed).

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ns in a real caller

Brings in 02a9531 on top of 7fd5d6a (already in this bundle). Test-only: the work-list export test now signs in the investigation's creator with a real token and pins that anonymous gets 401 and changes nothing. Found by the check of tests outside the -k selection.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
open-data-questions.js (born in d071cc0) said 'none of N answered yet · not run yet' when no check had run. The house wording is 'not yet run' (F23); the render harness test f23-not-yet-run.test.mjs forbids 'not run yet' in every string /next shows, and it failed in CI on PR 1130. One string changes, and the two assertions in test_tr54_b5_questions_wired.py that pinned the old words change with it. The Python suites do not run the JS harness; the harness is 2147 of 2147 with this commit, and was 2146 of 2147 without it.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
@dwolfson
dwolfson merged commit 142bd78 into main Nov 24, 2026
4 checks passed
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.

1 participant