Skip to content

fix(platform): accept absolute paths for any host and stop blaming the ceiling for a missing grant - #552

Merged
morluto merged 1 commit into
mainfrom
fix/windows-scenario-paths-and-permission-remediation
Oct 5, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/windows-scenario-paths-and-permission-remediation

Conversation

@morluto

@morluto morluto commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Fixes #548 and #545.

#548 — process scenarios were unexpressable on Windows

processScenarioSchema required a leading / on executable, working_directory and filesystem_roots, so validation rejected every Windows scenario before anything else could run. Process capture is one of the few inherently cross-platform capabilities REA has, so this made capture_process_scenario and compare_process_captures unusable there.

The suggested fix was subtly wrong, so this does something else. The report proposes node:path's isAbsolute, which answers for the machine doing the checking: on Linux, C:\tools is not absolute. That works on Windows but silently breaks everywhere a Windows scenario is validated by another host — replay, comparison, or a test asserting on a fixture. A boundary schema must not vary with its evaluator, so the predicate accepts the POSIX form, a Windows drive path and a UNC share on every host, and is exported and unit-tested directly.

The rejection message now names the constraint, so a rejected path is actionable rather than surfacing as a generic "invalid request".

Two things I checked rather than assumed:

  • Whether this only moved the failure downstream. Containment is enforced by isPathWithinRoot, which already uses host-aware path.relative, and ProcessCaptureAuthority canonicalises both sides before comparing. Execution was never POSIX-only — validation really was the sole blocker.
  • Whether the path field inside checkpoints needed the same treatment. It is an HTTP path, not a filesystem path, so startsWith("/") is correct there and is deliberately unchanged.

#545 — a denial that blamed the wrong thing

When a scope is inside the administrator ceiling but no grant was ever issued, the error still told the caller to "Add the exact missing scope beneath the administrator ceiling". That advice cannot work: the ceiling already permits the operation. The missing payload is computed against candidate grants, not the ceiling, so it describes what a grant must cover — hence the report's observation that entries in missing appear verbatim in ceiling.

PermissionRemediation gains a grant variant that says the ceiling already covers the scope and names the two real routes (a project grant, or the documented auto-grant setting). PermissionAuthority selects it whenever the denial is not a ceiling violation.

Preserved deliberately: a genuine ceiling violation still says configure; an explicitly requested elicit/restart is still honoured; missing is unchanged, because it is accurate — it just was not being read as "what a grant must cover".

On the report's related sharp edge

The executables directory-vs-exact containment semantics are noted and not changed here. That is a real documentation gap, but it is a contract question about what a scope means, not a bug, and folding it into a fix for two unrelated defects would make the change harder to review. Worth its own issue.

Tests

  • processScenario.test.ts: POSIX, Windows-drive (both separators) and UNC paths all validate on a Linux host, Windows filesystem_roots accepted, five relative/empty forms still rejected, and the actionable message asserted.
  • PermissionAuthorityRemediation.test.ts: covered scope and an empty request both resolve to grant; a genuine ceiling violation still resolves to configure; an explicit elicit is untouched.

Full suite green (1987 passed) with the regenerated catalog; typecheck, lint and prettier clean.

…e ceiling for a missing grant

Addresses #548 and #545.

#548: processScenarioSchema required a leading "/" for executable,
working_directory and filesystem_roots, so no process scenario could be
expressed on Windows at all. The report suggested node:path's isAbsolute, but
that answers for the host running the check: on Linux `C:\tools` is not
absolute, so a scenario captured on Windows would fail validation when it is
replayed, compared, or asserted in a test on another host. A boundary schema
must not vary with its evaluator, so the check accepts the POSIX form, a
Windows drive path and a UNC share everywhere. The rejection message now names
the constraint instead of leaving the caller to infer it from "invalid request".
The HTTP `path` field inside `checkpoints` is an URL path and is deliberately
left alone.

I checked whether this merely moved the failure downstream: containment is
enforced by isPathWithinRoot, which already uses host-aware path.relative, so
validation really was the only blocker.

#545: when a scope is inside the administrator ceiling but no grant was ever
issued, the denial still pointed at widening the ceiling -- advice that cannot
help, since the ceiling already permits the operation. The `missing` payload is
computed against candidate *grants*, so it describes what a grant must cover,
not a ceiling gap. `PermissionRemediation` gains a `grant` variant saying
exactly that, and PermissionAuthority selects it when the denial is not a
ceiling violation. An explicitly requested remediation is still honoured, and a
genuine ceiling violation still says "configure".
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@morluto
morluto merged commit e793e12 into main Oct 5, 2026
19 checks passed
@morluto
morluto deleted the fix/windows-scenario-paths-and-permission-remediation branch October 5, 2026 10:50
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…e ceiling for a missing grant (morluto#552)

Addresses morluto#548 and morluto#545.

morluto#548: processScenarioSchema required a leading "/" for executable,
working_directory and filesystem_roots, so no process scenario could be
expressed on Windows at all. The report suggested node:path's isAbsolute, but
that answers for the host running the check: on Linux `C:\tools` is not
absolute, so a scenario captured on Windows would fail validation when it is
replayed, compared, or asserted in a test on another host. A boundary schema
must not vary with its evaluator, so the check accepts the POSIX form, a
Windows drive path and a UNC share everywhere. The rejection message now names
the constraint instead of leaving the caller to infer it from "invalid request".
The HTTP `path` field inside `checkpoints` is an URL path and is deliberately
left alone.

I checked whether this merely moved the failure downstream: containment is
enforced by isPathWithinRoot, which already uses host-aware path.relative, so
validation really was the only blocker.

morluto#545: when a scope is inside the administrator ceiling but no grant was ever
issued, the denial still pointed at widening the ceiling -- advice that cannot
help, since the ceiling already permits the operation. The `missing` payload is
computed against candidate *grants*, so it describes what a grant must cover,
not a ceiling gap. `PermissionRemediation` gains a `grant` variant saying
exactly that, and PermissionAuthority selects it when the denial is not a
ceiling violation. An explicitly requested remediation is still honoured, and a
genuine ceiling violation still says "configure".
@morluto morluto added the bug Something isn't working label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: processScenarioSchema requires POSIX paths, making process capture unusable

1 participant