feat: scaffold marko oauth package#57
Conversation
bf76b1c to
c65a174
Compare
c65a174 to
5c79a54
Compare
|
Thanks Paulo — this is a thoughtful PR and the PRD is genuinely well thought out. I want to be upfront with where I'm at though: Deferring to post-1.0I'm going to mark this
The PRD is good; let's keep this PR open with the When this comes back, please use the HCF workflowWhen we pick this back up, please drive it through the HCF plugin: https://github.com/markshust/hcf Specifically:
This is documented in CLAUDE.md under "Feature Development":
This isn't optional housekeeping for me — it's how I keep PRs of this size reviewable, and it forces TDD by construction. Specific feedback for the next iterationSo you have it for when this comes back, here's what I'd want to see different: 1. No scaffold-only slices. Marko's principle #5 in CLAUDE.md is "No pseudo-functionality — only build real functionality when core supports it. If there's nothing meaningful to build, build nothing." This PR adds 6 empty 2. Tests weren't TDD'd, and that's why this PR is bloated. This is the root cause of point #1, not a separate issue. Going through the test files:
These all pass green from day one, which means they couldn't have driven the implementation — they were written after the code as mirrors of what was already there. The cost of that: with no failing test forcing each line into existence, there's no signal telling you to stop adding code. So you naturally end up shipping 6 entities, 6 interfaces, 6 repositories, ~20 config keys, an attribute, an enum, and a key command — when actually only 1 entity, 1 repository, 1 config section, and 1 command are exercised by anything runnable. That's roughly 70%+ of this PR is unreachable code that exists only because no test required it. Red-first TDD prevents this by construction: if no failing test demands a class, you don't write the class. That single discipline would have collapsed this PR to a fraction of its size and made it mergeable. When this comes back, every new file should trace to a failing test that demanded it. 3. Trim config to what's wired. ~20 keys in 4. Verify locally end-to-end before opening the PR. The PR notes mention Really do appreciate the work and the PRD — none of this is wasted, it's just timing + workflow. Marking |
|
I will look at HCF plugin. Not played with it yet. |
Summary
Adds the first implementation slice for
marko/oauth, a native Marko OAuth2 authorization server package inspired by Laravel Passport but shaped around Marko's module, database, config, CLI, packaging, docs, and testing conventions.This PR intentionally establishes the package foundation before implementing the actual OAuth grant controllers and
league/oauth2-serveradapters. The goal is to land the package boundary, PRD, storage model, config surface, key-management command, package metadata, docs entry, and tests as a stable base for the next slices.Included in this slice:
packages/oauthas a Marko module with Composer metadata formarko/oauth.league/oauth2-server, PSR-7 bridge packages, Marko authentication, config, database, routing, and view packages.config/oauth.phpfor routes, signing keys, token TTLs, refresh-token rotation, consent memory, scopes, and defaults.OAuthConfigtyped accessors over the package config.module.php.oauth:keysviaKeysCommandandKeyGenerator, with overwrite protection unless--forceis passed and explicit Marko exceptions for key write/directory failures.#[RequiresScope]as the route-level scope declaration planned for OAuth-protected APIs.GrantTypeenum for the v1 grant boundary: authorization code, client credentials, refresh token.docs/prd/marko-oauth.mdcapturing the product and implementation decisions from the design discussion.docs/src/content/docs/packages/oauth.mdand keeps the package README as a slim installation/docs pointer..gitattributes, packageLICENSE, issue-template package dropdown entries, and package-structure tests.gh repo listimplementation fromdevelop.The PRD documents the larger intended v1 scope: authorization-code with PKCE, client credentials, refresh-token rotation/reuse detection, signed JWT access tokens, database-backed revocation/audit, consent UI, configured scopes, and bearer-token protection. Those protocol flows are left as follow-up work on top of this foundation.
Type of Change
Related Issues
N/A. The PRD is included in this branch at
docs/prd/marko-oauth.md.Verification
composer test./vendor/bin/pest packages/oauth/tests tests/RepoManagementScriptsTest.php packages/framework/tests/RootComposerJsonTest.php tests/PackagingTest.php tests/IntegrationVerificationTest.php --exclude-group=integration-destructive./vendor/bin/phpcs packages/oauth/src packages/oauth/tests packages/oauth/module.php tests/RepoManagementScriptsTest.php./vendor/bin/php-cs-fixer fix packages/oauth/src packages/oauth/tests --dry-run --diff --config=.php-cs-fixer.phpcomposer validate --strict --no-check-publish --no-check-lockcomposer validate packages/oauth/composer.json --strict --no-check-publish --no-check-locknpm --prefix docs cinpm --prefix docs run buildNotes:
ext-imagickextension enabled. I refreshed ignored local Composer artifacts with--ignore-platform-req=ext-imagickbefore running the full suite;composer.lockandvendor/are ignored and are not part of this PR.latte/envcode-block highlighters in unrelated docs pages.Checklist
composer test.gitattributes, issue-template entries, and docs page