Summary
`gflow data list images` (no `--profile`) returns rows across all profiles. `gflow data media ` (no `--profile`) scopes by `_resolve_profile(None)` — which silently picks one profile (config.toml default or fallback). Result: a media_id visible in `data list` cannot be looked up by `data media ` without the user knowing the row's profile.
Repro
```bash
$ gflow data list images
{"media_id": "asset-uuid-123", "profile": "default", ...}
$ gflow data media asset-uuid-123
Data store error: No local media record found: asset-uuid-123
$ gflow data media asset-uuid-123 --profile default
- media_id | asset-uuid-123 |
- kind | image |
... ✅
```
Cause
`src/gflow_cli/cli_data.py:226` calls `_resolve_profile(None)` for the active profile and uses it to scope `get_asset_by_flow_media_id(profile_name, media_id)` (`src/gflow_cli/data/repository.py:159`). When the active profile differs from the row's `profile_name`, the lookup fails even though the row is visible.
`data list images/videos/projects` use the same `--profile` flag but treat absent-flag as "no scope filter" — opposite default from `data media`.
Proposed fix
Pick one of:
Option A — `data media` cross-profile by default. When `--profile` is omitted, scan all profiles and either:
- return the unique match,
- list all matches with a hint to pass `--profile` to disambiguate (rare case: same Flow media_id in multiple profiles).
Option B — `data list` defaults to active profile. Apply `_resolve_profile(None)` to `data list` too; add `--all-profiles` flag for the cross-profile view.
Recommendation: Option A. The active-profile concept makes sense for write paths (login, generate); for read-only catalog queries the user is more likely to want "find anything matching this id" by default.
Files
- `src/gflow_cli/cli_data.py` — adjust `media` command
- `src/gflow_cli/data/repository.py` — add `get_asset_by_flow_media_id_any_profile` or relax the scope
- `tests/cli/test_cli_data.py` — add cross-profile lookup test
Acceptance
Any media_id printed by `data list` is findable by `data media ` without additional flags on the same machine.
Discovered during persistence-layer e2e probe (2026-05-26).
Summary
`gflow data list images` (no `--profile`) returns rows across all profiles. `gflow data media ` (no `--profile`) scopes by `_resolve_profile(None)` — which silently picks one profile (config.toml default or fallback). Result: a media_id visible in `data list` cannot be looked up by `data media ` without the user knowing the row's profile.
Repro
```bash
$ gflow data list images
{"media_id": "asset-uuid-123", "profile": "default", ...}
$ gflow data media asset-uuid-123
Data store error: No local media record found: asset-uuid-123
$ gflow data media asset-uuid-123 --profile default
... ✅
```
Cause
`src/gflow_cli/cli_data.py:226` calls `_resolve_profile(None)` for the active profile and uses it to scope `get_asset_by_flow_media_id(profile_name, media_id)` (`src/gflow_cli/data/repository.py:159`). When the active profile differs from the row's `profile_name`, the lookup fails even though the row is visible.
`data list images/videos/projects` use the same `--profile` flag but treat absent-flag as "no scope filter" — opposite default from `data media`.
Proposed fix
Pick one of:
Option A — `data media` cross-profile by default. When `--profile` is omitted, scan all profiles and either:
Option B — `data list` defaults to active profile. Apply `_resolve_profile(None)` to `data list` too; add `--all-profiles` flag for the cross-profile view.
Recommendation: Option A. The active-profile concept makes sense for write paths (login, generate); for read-only catalog queries the user is more likely to want "find anything matching this id" by default.
Files
Acceptance
Any media_id printed by `data list` is findable by `data media ` without additional flags on the same machine.
Discovered during persistence-layer e2e probe (2026-05-26).