Skip to content

Validate input that names a context before entering it - #145

Merged
carldebilly merged 1 commit into
mainfrom
dev/cdb/validate-context-navigation
Oct 22, 2026
Merged

carldebilly merged 1 commit into
mainfrom
dev/cdb/validate-context-navigation

Conversation

@carldebilly

Copy link
Copy Markdown
Member

Fixes #140.

What changes

  • Interactive navigation. A submission that names a context exactly (tools) now passes through the application's input validators (UseInputValidator) before the context validators run and before the scope changes. Invalid and Incomplete refuse it: the refusal is reported and the session stays in its scope. Valid navigates as before.
  • Command line. app tools had the same gap through the context deep link; it is validated the same way, and a refusal never enters the context.
  • Failures and exit codes. A validator that throws is reported as an input callback failure, as on every other path, instead of ending the interactive session. A refusal uses the exit codes of the module that mapped the context, as a failed context validation does.
  • One path. ValidateCurrentInputAsync runs the validators on the current input; the existing help refusal now uses it too.
  • Docs. docs/advanced-input.md says input naming a context is validated, and warns that the words alone are not a reliable way to recognise it (relative scope, unique prefixes, letter case): access to a context belongs to its own validation.

Verification

  • Given_AdvancedInput.When_ASubmissionNamesAContext_Then_InputValidationDecidesTheNavigation (Invalid, Incomplete, throwing, Valid): the validator runs exactly once for the submission, the refusal or failure is reported, the context validator does not run on refusal, and the next where runs at the expected scope.
  • Given_AdvancedInput.When_ACommandLineNamesAContextTheValidatorsRefuse_Then_TheContextIsNotEntered.
  • Given_ModuleExitCodes.When_InputValidationRefusesAContext_Then_TheContextModuleDecides: the module's code (5), not the application's (2); checked red with the attribution removed.
  • Every new test failed before its fix, with a successful build.
  • Full suite: 2390 passed, 0 failed (12 opt-in/OS-specific skips).

Not in this PR: ParsedInputContext exposes no resolved context path, so validators cannot recognise a navigation independently of its spelling; context validation remains the place to guard access.

An interactive submission naming a context, and a command line naming
one, entered the context without ever running the application's input
validators: only help and ambient commands were validated before
dispatch. An Invalid or Incomplete result therefore did not stop the
navigation.

Input naming a context now passes through the validators before the
context validators run and before the scope changes. A refusal is
reported, keeps the session in its scope or the command line out of
the context, and uses the exit codes of the module that mapped the
context; a validator that throws is reported as an input callback
failure instead of ending the session. The help refusal shares the
same path.

Fixes #140
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T03:42:34.779353Z f42f3a8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@carldebilly

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: f42f3a8c37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@autocarl autocarl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved exact head f42f3a8c37afbaa51849941f308bc95a7e8a405b.

Context navigation now runs application validation once before scope mutation/context validation, on CLI and interactive submission. Independent differential probes executed 496 rows across head and merge base: Invalid, Incomplete, thrown errors/unrelated OCE, Valid/disabled controls; nested/parameterized contexts, prefixes/case, injected services, typed globals, JSON/unknown formats, module exit mappings and caller cancellation. Help, ambient and routed-command callback counts remain unchanged. Parent reran the verification assertions. The related current-base delta does not overlap the changed execution/validation files; no merged-current-base runtime claim is made. No introduced P0–P2 found.

Parent Release solution build with -warnaserror: zero warnings/errors; full suite 2,399 passed, 0 failed, 3 expected skips. All applicable live CI checks pass. Documentation appropriately retains context authorization as a separate responsibility. Worktree clean; no merge performed.

@carldebilly
carldebilly merged commit 9a7ab52 into main Oct 22, 2026
14 checks passed
@carldebilly
carldebilly deleted the dev/cdb/validate-context-navigation branch October 22, 2026 11:29
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.

input: apply application validation before interactive context navigation

2 participants