Skip to content

Restore Fortify extension contracts and configuration defaults - #486

Merged
binaryfire merged 11 commits into
0.4from
audit/fortify-correctness-lifecycle-parity
Aug 7, 2026
Merged

Restore Fortify extension contracts and configuration defaults#486
binaryfire merged 11 commits into
0.4from
audit/fortify-correctness-lifecycle-parity

Conversation

@binaryfire

@binaryfire binaryfire commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

This restores Fortify's expected construction and extension contracts, makes package configuration the single source for guaranteed defaults, and updates the published configuration for new applications.

The changes preserve Hypervel's current-guard model, coroutine-safe guard selection, Passkeys integration, two-factor behavior, dedicated rate limiter, event delivery, and transaction boundaries.

For more details, see: docs/plans/2026-08-07-1807-fortify-correctness-current-parity-and-configuration-contracts.md

What changed

  • Restore the expected constructor shapes for Fortify controllers and actions.
  • Restore protected properties and override methods used by application subclasses.
  • Keep worker-lifetime static configuration private and accessible through Fortify's public configuration methods.
  • Resolve response and configuration dependencies at the operation that uses them, avoiding request-specific state on worker-lived objects.
  • Remove duplicate fallback literals for configuration that Fortify always merges.
  • Keep optional and replaceable nested configuration fallbacks where they are still required.
  • Publish the current application defaults for username normalization and opt-in email verification.
  • Add concise headings and guidance to the published configuration, including the behavior of a null guard.
  • Document feature-option lifecycle requirements and password-reset routing when view routes are disabled.
  • Record the final Fortify audit decisions and remove the completed TODO.

Guard and authentication behavior

fortify.guard still defaults to null. In that mode, Fortify follows the current request guard selected by Auth::shouldUse(), then falls back to auth.defaults.guard.

An explicit fortify.guard value only selects the guard for Fortify's built-in routes. The guard definition in config/auth.php remains authoritative for the provider, password broker, password-confirmation settings, and authentication separation. Fortify-owned Passkeys routes follow the same selected guard.

Compatibility

Laravel-facing constructor, property, response, and override contracts are restored where Hypervel had drifted.

Hypervel-specific behavior remains intentional: current guards are resolved at operation time, static configuration stays typed and resettable for long-lived workers, password brokers follow guard declarations, and integrated Passkeys retain their existing ownership model.

Verification

  • Ran the complete project fix workflow, including formatting, static analysis, and the parallel test suite.
  • Added focused Fortify API, route, configuration, and installer coverage.
  • Rechecked the final branch after merging the latest 0.4 changes.

Summary by CodeRabbit

  • Configuration

    • Updated Fortify defaults and documentation, including lowercase usernames enabled by default and email verification disabled by default.
    • Clarified boot-time feature configuration and password-reset route behavior when views are disabled.
    • Simplified route and authentication configuration fallbacks.
  • Compatibility

    • Improved Laravel-style Fortify API compatibility and extension points for custom implementations.
  • Documentation

    • Updated Fortify and Passkeys guides with current configuration guidance and reference links.
  • Tests

    • Added coverage for defaults, routes, authentication behavior, extension points, and response handling.

Restore Laravel-compatible constructor shapes, protected mutable collaborators, protected override methods, and mutable public event payloads. This makes Fortify's supported subclass seams usable again without reopening worker-global configuration state.

Remove the unnecessary container dependency from EnsureLoginIsNotThrottled and resolve the lockout response at the operation boundary. The action now accepts the upstream one-parameter constructor while retaining Hypervel's current-guard and listener-aware behavior.
Remove Hypervel-only constructor dependencies from the ten stateless Fortify controllers that are zero-constructor classes upstream. Resolve response contracts and request-sensitive configuration when each operation runs so worker auto-singletons do not capture application state and application response bindings remain authoritative.

Retain the deliberate current-guard architecture and the few upstream-shaped constructors that still own real dependencies. Remove duplicated lowercase-username fallbacks where Fortify's merged package configuration already guarantees the key.
Restore Laravel-compatible protected mutable response, limiter, and two-factor provider properties while preserving Hypervel's private OTP clock. Restore mutable redirect payloads and the descriptive SimpleViewResponse callable contract.

Return PasswordResetResponse to status-only construction and resolve the current views setting when producing the response. This avoids retaining configuration on a worker-lived response while preserving JSON, disabled-view, and normal login redirects.
Remove duplicated fallback literals from required Fortify configuration reads and route registration. Top-level package defaults are shallow-merged before use, so the merged repository is the single source of truth while optional and replace-whole settings keep their existing fallbacks.

Document the worker-lifetime boundary only when feature options mutate global configuration. Keep no-argument feature identifier reads safe at request time, and retain Fortify's six private typed static configuration slots behind the existing public APIs and exhaustive reset hook.
Make the generated Fortify configuration self-explanatory with concise headings for each public group. New applications now publish Laravel's intended lowercase-username default and leave email verification commented out until the user model supports it.

Keep Hypervel's guard, middleware, Passkeys, route-path, limiter, and two-factor options intact. The package's unpublished fallback remains deliberately different for applications that do not own a config file.
Document that feature options mutate process-global configuration only when supplied, while no-argument feature identifiers remain safe request-time reads. Explain published versus internal username defaults, email-verification opt-in, and the reset URL requirement when view routes are disabled.

Normalize the Fortify and integrated Passkeys READMEs around public documentation links and the required package order. Record only the developer-visible Laravel differences, including Fortify's typed public alternatives to direct static-property writes.
Add counterfactual coverage for zero-constructor controllers, the exact throttle-action constructor, status-only response construction, both view redirect branches, internal package defaults, protected/public extension seams, and private worker-static state.

Extend installer coverage for the published lowercase and email-verification defaults. Prove that disabling Fortify views removes the reset form route while retaining both password-reset submission routes.
Mark Fortify complete in the framework lifecycle checklist and record findings fortify-03 through fortify-09 with their architecture, regression coverage, performance budget, retained differences, and rejected complexity.

Close the carried Auth, Horizon, and Eloquent revalidation entries using the dependency index's established vocabulary. Remove the obsolete Fortify port todo now that the package and its completion records are current and signed off.
Capture the final evidence, architecture, implementation slices, regression strategy, performance budget, and rejected designs for the Fortify audit. The plan preserves Hypervel's current-guard, OTPHP, Passkeys, rate-limiter, event, and worker-static boundaries while restoring supported Laravel APIs.

Record the anti-overengineering constraints and final verification workflow so future maintenance can distinguish deliberate Hypervel adaptations from parity defects without reintroducing duplicate defaults or speculative lifecycle machinery.
Bring in the completed Socialite audit and the latest Support Manager, Object Pool, and Reverb ownership corrections. These changes do not alter Fortify runtime behavior or invalidate any Fortify design assumption.

Resolve the shared audit-ledger append conflict by retaining both signed-off work units in chronological order. Preserve both package checklist completions and all dependency-index updates.
Document the guard-selection behavior directly in the published configuration stub. A null value follows the current request guard, while an explicit name pins Fortify's built-in routes to that configured guard.

This keeps config/auth.php as the source of truth for guard definitions while making Fortify's optional route-selection override clear where applications configure it.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Fortify APIs now use Laravel-shaped construction and extension contracts. Configuration fallbacks and published defaults were aligned. Documentation and audit records were updated. New tests cover API contracts, configuration, installation output, response behavior, and route registration.

Changes

Fortify audit and implementation

Layer / File(s) Summary
Audit plans and completion records
docs/plans/*
Fortify findings, revalidation records, checklist status, verification requirements, and audit conclusions were updated.
Controller construction and response resolution
src/fortify/routes/routes.php, src/fortify/src/Actions/*, src/fortify/src/Http/Controllers/*, src/fortify/src/Http/Responses/PasswordResetResponse.php
Selected container constructor dependencies were removed. Configuration and response objects are resolved at call time. Configuration fallback arguments were removed from required reads.
Mutable and protected extension surfaces
src/fortify/src/Events/*, src/fortify/src/Http/Responses/*, src/fortify/src/LoginRateLimiter.php, src/fortify/src/TwoFactorAuthenticationProvider.php
Selected properties changed from private or readonly to protected or mutable. Selected callback methods changed from private to protected.
Configuration defaults and documentation
src/fortify/src/Features.php, src/fortify/src/Fortify.php, src/fortify/src/FortifyServiceProvider.php, src/fortify/stubs/fortify.php, src/boost/docs/fortify.md, src/fortify/README.md, src/passkeys/README.md, docs/todo.md
Published defaults, feature lifecycle rules, password-reset guidance, README content, and package task records were updated.
API, route, and install regression coverage
tests/Fortify/FortifyApiTest.php, tests/Fortify/FortifyRouteTest.php, tests/Fortify/Console/InstallCommandTest.php
Tests cover construction, responses, visibility, mutability, static configuration, published defaults, and password-reset route behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary changes: restoring Fortify extension contracts and configuration defaults.
Docstring Coverage ✅ Passed Docstring coverage is 80.95% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch audit/fortify-correctness-lifecycle-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

Restores Fortify's Laravel-facing construction and extension contracts while retaining Hypervel's coroutine-safe guard and worker-lifetime configuration model.

  • Resolves request-sensitive responses and configuration at operation time.
  • Restores protected override points and mutable extension properties.
  • Centralizes guaranteed defaults in package configuration and updates published defaults and documentation.
  • Adds focused API, route, and installer contract coverage.

Confidence Score: 4/5

The PR appears safe to merge, with one non-blocking documentation-convention issue in the new feature lifecycle warnings.

The changed runtime paths preserve merged configuration, response binding, and coroutine-safe state behavior; only the standardized worker-lifetime warning syntax needs adjustment.

Files Needing Attention: src/fortify/src/Features.php

Important Files Changed

Filename Overview
src/fortify/src/Features.php Documents process-global option mutation and removes a duplicated feature-list fallback; the new lifecycle warnings need the repository's exact tag-first format.
src/fortify/src/Fortify.php Removes duplicated defaults for guaranteed merged username and email configuration while preserving worker-static configuration ownership.
src/fortify/routes/routes.php Removes duplicated defaults for package-owned route configuration without changing current-guard selection or optional limiter behavior.
src/fortify/src/FortifyServiceProvider.php Uses the merged package configuration as the authoritative route-prefix source.
src/fortify/src/Http/Responses/PasswordResetResponse.php Restores status-only construction and resolves view configuration at response time without retaining request-specific dependencies.
src/fortify/src/Http/Controllers/PasswordResetLinkController.php Restores zero-constructor compatibility and resolves configuration and parameterized responses at the operation boundary.
tests/Fortify/FortifyApiTest.php Adds focused coverage for constructor contracts, property visibility and mutability, override dispatch, response behavior, and private static configuration.
src/fortify/stubs/fortify.php Publishes lowercase usernames and opt-in email verification for new applications with expanded configuration guidance.

Fix All in Claude Code Fix All in Codex

Reviews (1): Last reviewed commit: "docs: explain Fortify's null guard defau..." | Re-trigger Greptile

Comment on lines +143 to +146
* Boot-only when options are supplied. Non-empty options mutate the process-global
* configuration repository and affect every subsequent request in the worker;
* calling without options performs no mutation and is safe at request time.
*

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Standardize worker-lifetime warning

The new warning starts with Boot-only when options are supplied. instead of the repository's required standalone Boot-only. tag, making the lifecycle restriction less consistently recognizable by humans and tooling. Use the tag-first format here and on passkeys(), followed by the existing explanation of process-global mutation.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. No change here. These methods are dual-purpose: without options they only return the feature identifier and are safe during request handling; only non-empty options mutate process-global configuration. A standalone Boot-only. would therefore be inaccurate. The conditional wording also matches the repository's existing convention for get-or-configure methods such as Router, ResourceRegistrar, Relation, and the validation rules.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's a fair correction — a standalone Boot-only. tag would misrepresent a method that is explicitly safe at request time when called without options. The conditional phrasing is the accurate and appropriate choice here, and matching the existing get-or-configure convention in Router, ResourceRegistrar, Relation, and the validation rules is the right call. Happy to leave this as-is.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fortify/src/Http/Responses/PasswordResetResponse.php`:
- Around line 16-20: Update FortifyServiceProvider registrations for
PasswordResetResponse, FailedPasswordResetLinkRequestResponse,
FailedPasswordResetResponse, and SuccessfulPasswordResetLinkRequestResponse to
use transient bind() bindings instead of singleton bindings, ensuring each
request-specific status is resolved in a fresh response instance.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 74630480-7b10-4f68-adf8-88501ad37012

📥 Commits

Reviewing files that changed from the base of the PR and between de04fad and f164b13.

📒 Files selected for processing (48)
  • docs/plans/2026-07-12-0900-framework-coroutine-state-lifecycle-audit.md
  • docs/plans/2026-07-12-0915-framework-coroutine-state-lifecycle-audit-ledger.md
  • docs/plans/2026-08-07-1807-fortify-correctness-current-parity-and-configuration-contracts.md
  • docs/todo.md
  • src/boost/docs/fortify.md
  • src/fortify/README.md
  • src/fortify/routes/routes.php
  • src/fortify/src/Actions/AttemptToAuthenticate.php
  • src/fortify/src/Actions/ConfirmPassword.php
  • src/fortify/src/Actions/ConfirmTwoFactorAuthentication.php
  • src/fortify/src/Actions/EnableTwoFactorAuthentication.php
  • src/fortify/src/Actions/EnsureLoginIsNotThrottled.php
  • src/fortify/src/Actions/PrepareAuthenticatedSession.php
  • src/fortify/src/Actions/RedirectIfTwoFactorAuthenticatable.php
  • src/fortify/src/Events/PasswordUpdatedViaController.php
  • src/fortify/src/Events/RecoveryCodeReplaced.php
  • src/fortify/src/Events/RecoveryCodesGenerated.php
  • src/fortify/src/Events/TwoFactorAuthenticationEvent.php
  • src/fortify/src/Features.php
  • src/fortify/src/Fortify.php
  • src/fortify/src/FortifyServiceProvider.php
  • src/fortify/src/Http/Controllers/AuthenticatedSessionController.php
  • src/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php
  • src/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php
  • src/fortify/src/Http/Controllers/EmailVerificationNotificationController.php
  • src/fortify/src/Http/Controllers/EmailVerificationPromptController.php
  • src/fortify/src/Http/Controllers/NewPasswordController.php
  • src/fortify/src/Http/Controllers/PasswordController.php
  • src/fortify/src/Http/Controllers/PasswordResetLinkController.php
  • src/fortify/src/Http/Controllers/ProfileInformationController.php
  • src/fortify/src/Http/Controllers/RecoveryCodeController.php
  • src/fortify/src/Http/Controllers/RegisteredUserController.php
  • src/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php
  • src/fortify/src/Http/Controllers/VerifyEmailController.php
  • src/fortify/src/Http/Responses/FailedPasswordResetLinkRequestResponse.php
  • src/fortify/src/Http/Responses/FailedPasswordResetResponse.php
  • src/fortify/src/Http/Responses/LockoutResponse.php
  • src/fortify/src/Http/Responses/PasswordResetResponse.php
  • src/fortify/src/Http/Responses/RedirectAsIntended.php
  • src/fortify/src/Http/Responses/SimpleViewResponse.php
  • src/fortify/src/Http/Responses/SuccessfulPasswordResetLinkRequestResponse.php
  • src/fortify/src/LoginRateLimiter.php
  • src/fortify/src/TwoFactorAuthenticationProvider.php
  • src/fortify/stubs/fortify.php
  • src/passkeys/README.md
  • tests/Fortify/Console/InstallCommandTest.php
  • tests/Fortify/FortifyApiTest.php
  • tests/Fortify/FortifyRouteTest.php
💤 Files with no reviewable changes (1)
  • docs/todo.md

Comment thread src/fortify/src/Http/Responses/PasswordResetResponse.php
@binaryfire
binaryfire merged commit 297f2de into 0.4 Aug 7, 2026
38 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