Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ jobs:
- name: Verify installed caller trial-table experiment
run: python -m tools.verify_installed_experiment dist/opensmell-0.1.0-py3-none-any.whl --evidence-directory dist/experiment-proof

- name: Verify passive installed trial observation analysis
run: python -m tools.verify_installed_trial_analysis dist/opensmell-0.1.0-py3-none-any.whl --output dist/experiment-proof/analysis

- name: Retain portable caller experiment proof
if: always()
uses: actions/upload-artifact@v7.0.2
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,10 @@ The active direction covers the installed SDK/CLI, interoperable data, reusable
adapters and a reproducible ESP32 bench. Local Explorer remains a demo client.
See [the deliverables and exit criteria](docs/development-status.md#active-direction--developer-kit-and-concrete-prototype-2026-11-10).

The installed [`analyze-experiment` entry](docs/trial-analysis.md) joins explicit
caller observation IDs to trial receipts and exports loss-preserving JSON/CSV for
external analysis. Execution completion never creates a measurement.

The installed [`run-experiment` entry](docs/run-experiment.md) consumes one verified
prepared dossier in caller order, with explicit software transport selection and
retained trial IDs/receipts. It also exposes a transport-neutral SDK entry.
Expand Down
2 changes: 2 additions & 0 deletions docs/autonomous-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ this protocol before changing project files. Read-only inspection needs no lease
Create a tree containing only `state.json`, then a commit whose parent is the
observed control head. Move the branch with an **expected-head-SHA check** and
`force=false`. The GitHub `update_ref` tool supports `expected_sha`.
Initialize coordination functions in the current run; fail on missing helpers.
Confirm acquisition from a newly fetched remote state, never the local object.
3. A rejected lease means another session won: stop, rather than retrying with a
newer SHA. Re-read state and verify ownership before making project changes.
4. Do not extend the lease. The initial 240-minute maximum supports the increased
Expand Down
17 changes: 17 additions & 0 deletions docs/development-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ The broader roadmap remains in the [README](../README.md#roadmap).
Operational checkpoints and the short session log live in `state.json` on the
`automation/control` branch; follow its pending PR before starting new work.

## Trial observation analysis — 2026-11-25

The first installed dossier execution path (#46) is closed. The next concrete
data/SDK slice is [passive trial observation analysis](trial-analysis.md): explicit
caller bindings connect separately supplied observation IDs to retained receipts,
with loss-preserving JSON and CSVs for external analysis. Reuse existing perceptual
projection; never infer a measurement from completion or invent trial observations.

Exit: installed prepare/run/analyze outside checkout, relocated dossier and removed
originals, distinct trial IDs in caller order, explicit synthetic imported data,
Pandas CSV consumer, exact bytes/provenance/unknown data retained; missing/zero/unit
semantics preserved; uncertain/unrecorded receipts, ambiguous/unmatched bindings,
stale report and collision behaviors demonstrated. Close this first analysis slice
after CI. Next choose an independent integration/data need from the whole kit,
not endless receipt diagnostics or scheduler/retry extensions. Physical board and
independent adoption evidence remain unobserved.

## Prepared dossier execution — 2026-11-24 evening

The reusable sequence core/manual serial slice (#44/#45) is closed. The next
Expand Down
111 changes: 111 additions & 0 deletions docs/trial-analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Analyze trial observations (experimental)

`analyze-experiment` passively joins a selected prepared dossier, its retained
`run-experiment` receipt report and **separately supplied** observation data.
Explicit CSV bindings select `trial_id,observation_id`; neither equal names nor
execution completion infer a measurement. No transport is constructed or opened.

## Installed entry

Prepare/run a dossier through [run-experiment](run-experiment.md), then supply a
Generic ResourceGraph0.1 containing your observations and a UTF-8 binding CSV:

```csv
trial_id,observation_id,caller_note
first,EXPLICIT_OBSERVATION_ID_A,declared association
second,EXPLICIT_OBSERVATION_ID_B,declared association
```

Use the **observation resource ID**, not a stimulus, subject or molecule ID. CSV
order does not reorder trials. Additional columns remain opaque caller context.
IDs are explicit nonblank strings up to128 characters. A trial can have several
observations; each observation can bind exactly once. Repeated observation IDs,
including duplicate pairs, are ambiguous: all competing associations are retained
in diagnostics and excluded from joined measurement/category rows. No first/last
winner or averaging is chosen.

```sh
opensmell analyze-experiment experiment --report execution-report.json \
--observations supplied-observations.osmell --bindings associations.csv \
--output-directory new-analysis
```

Original preparation inputs need not exist; the dossier can be relocated. The
whole dossier is reverified. The report must retain that exact dossier manifest,
inputs, caller order and per-step plans. A stale/different dossier, altered plan
snapshot or contradictory step/execution state refuses before output creation.
This checks declared consistency, **not authenticity of a receipt**. A report
without sequence receipts is retained as `unrecorded`, never `not_attempted` or
`completed`. Accepted/running/future states and unfinished reports remain partial.

Outputs in a new exclusive directory:

| File | Content |
| --- | --- |
| `analysis.json` | Exact input snapshots, complete observation projection/context, explicit bindings, joined numeric/category rows and coverage issues |
| `trials.csv` | Caller order, original record, receipt state/IDs, selected observation IDs and result counts |
| `measurements.csv` | Joined known perceptual0.1 numeric rows with trial, receipt state, source path/digest, scale/unit and binding context |

Unknown observation contracts, invalid/unmeasured results, unmatched IDs and
ambiguous bindings stay in the original snapshots/context and coverage diagnostics.
They are never guessed, skipped silently or coerced to numeric rows. Recognized
observation categories stay opaque in JSON, separate from numeric CSV. Semantic
annotations are not observation measurements and are not joined by coincident ID.

`status=joined` means complete coverage **within this projection**; it does not
mean successful scientific design, authenticated data or reproduced odor. Partial
coverage still produces usable tables and complete retained input. Exit0 joined;
3 partial;1 invalid;2 filesystem error/collision. Invalid input creates no output;
a write failure after exclusive creation leaves an incomplete marker. Existing
directories/reports are never overwritten. Analysis never rewrites its inputs.

Units and scales are not converted. Zero remains zero, absent measurements produce
no row, and absent/null unit fields have distinct `unit_presence` values. Mixed
units are not pooled. Integer values are not converted to floats. CSV exports raw
caller strings (including opaque fields); choose appropriate types and spreadsheet
import settings. For a loss-preserving Pandas consumer:

```python
import pandas as pd
rows = pd.read_csv("new-analysis/measurements.csv", dtype="string", keep_default_na=False)
# Select explicit property/unit/scale groups before any caller-chosen conversion.
```

## SDK

```python
from opensmell.experimental.trial_analysis import analyze_experiment, write_analysis_directory
result = analyze_experiment("experiment", report_bytes, observation_graph_bytes, binding_csv_bytes)
write_analysis_directory(result, "new-analysis")
```

Inputs are bounded at64MiB for the report,8MiB for observations and64KiB/4096rows
for bindings; existing dossier/sequence bounds still apply. Exact report, graph,
bindings, dossier input and plan bytes remain available. Source/provenance/unknown
fields and excluded rows are retained, not reduced to the CSV projection. Files
are local and the dossier check uses disposable compiler temporary files.

## Evidence and limits

```sh
python -m build --wheel
python -m tools.verify_installed_trial_analysis dist/opensmell-0.1.0-py3-none-any.whl \
--output /tmp/new-trial-analysis-proof
```

The proof installs a wheel outside the checkout, imports **declared synthetic**
Keller-style rows through the normal entry, prepares/runs a relocated dossier on
the explicitly selected installed software simulator, then analyzes it through
the normal CLI and an optional Pandas consumer. Caller trial order survives reversed
observation graph order. Zero, missing values, categorical context, unknown fields,
exact source bytes, uncertain receipts, duplicate associations, stale reports and
output collisions are checked. Build/Pandas dependencies are inherited; this is
not a new clean offline dependency proof or independent third-party adoption.

The supplied observations can predate the software run. Binding is a caller claim,
not inferred stimulus equivalence, synchronization, causation or efficacy. An
unknown/not-attempted trial can still have caller-supplied observation rows; these
are retained beside the receipt state, not relabeled as an execution result.
This entry does not generate observations, normalize ratings, estimate statistics,
contact participants, run hardware, validate a device or measure an olfactory
outcome. Human electrical/olfactory validation remains a separate unobserved gate.
2 changes: 2 additions & 0 deletions examples/developer_kit/START_HERE.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,5 @@ recipe never authorizes autonomous physical commands; verification uses owned
pseudo-terminals only. Existing software sequence commands remain unchanged.

For a whole caller-ordered prepared dossier, see [RUN_EXPERIMENT.md](RUN_EXPERIMENT.md).

For passive receipt/observation joins and CSV analysis, see [TRIAL_ANALYSIS.md](TRIAL_ANALYSIS.md).
29 changes: 29 additions & 0 deletions src/opensmell/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ def _prepare_experiment_command(args):
print(json.dumps({"status":"invalid","error":str(error)})); return 1


def _analyze_experiment_command(args):
from .experimental.trial_analysis import analyze_experiment, write_analysis_directory
from .experimental.trial_analysis import MAX_REPORT_BYTES, MAX_OBSERVATION_BYTES, MAX_BINDING_BYTES
import csv
try:
raws = []
for path, bound in ((args.report, MAX_REPORT_BYTES), (args.observations, MAX_OBSERVATION_BYTES), (args.bindings, MAX_BINDING_BYTES)):
with Path(path).open("rb") as source:
raws.append(source.read(bound+1))
result = analyze_experiment(args.directory, *raws)
write_analysis_directory(result, args.output_directory)
print(json.dumps({"status":result["status"], "execution":"not_attempted", "physical_validation":False,
"trial_count":len(result["tables"]["trials"]), "measurement_count":len(result["tables"]["measurements"]),
"issue_count":len(result["coverage"]["issues"])}))
return 3 if result["status"] == "partial" else 0
except OSError as error:
print(json.dumps({"status":"error", "error":str(error)}), file=sys.stderr); return 2
except (OpenSmellError, ValueError, TypeError, KeyError, RecursionError, OverflowError, csv.Error) as error:
print(json.dumps({"status":"invalid", "error":str(error)}), file=sys.stderr); return 1


def _run_experiment_command(args):
from .experimental.experiment_run import run_prepared_experiment
from .experimental.process_transport import ProcessTransport
Expand Down Expand Up @@ -619,6 +640,12 @@ def main(argv: list[str] | None = None) -> int:
experiment.add_argument("--graph", required=True, help="Explicit source ResourceGraph")
experiment.add_argument("--profile", required=True, help="Explicit mapping/capability profile for every trial")
experiment.add_argument("--output-directory", required=True, help="New portable experiment directory; never overwrite")
analysis = commands.add_parser("analyze-experiment", help="Passively join explicit observation IDs to a prepared dossier's execution receipts")
analysis.add_argument("directory", help="Selected prepared-experiment directory")
analysis.add_argument("--report", required=True, help="Retained run-experiment receipt report; max64MiB")
analysis.add_argument("--observations", required=True, help="Separately supplied observation ResourceGraph; max8MiB")
analysis.add_argument("--bindings", required=True, help="Explicit trial_id,observation_id CSV; max64KiB")
analysis.add_argument("--output-directory", required=True, help="New analysis.json/trials.csv/measurements.csv directory; never overwrite")
run_experiment = commands.add_parser("run-experiment", help="Verify and run one prepared experiment on explicitly selected trusted software")
run_experiment.add_argument("directory", help="Explicit prepared-experiment directory; never selects transport")
run_experiment.add_argument("--software-command-json", required=True, help="Trusted executable/argument JSON array; no shell; not sandboxed")
Expand Down Expand Up @@ -646,6 +673,8 @@ def main(argv: list[str] | None = None) -> int:
return _plan_core_command(args)
if args.command == "prepare-experiment":
return _prepare_experiment_command(args)
if args.command == "analyze-experiment":
return _analyze_experiment_command(args)
if args.command == "run-experiment":
return _run_experiment_command(args)
if args.command == "run-sequence":
Expand Down
Loading