Skip to content

fix(create-app): ship logger and shutdown in the scaffold, drop @o3co/auth.utils - #22

Merged
y1o1 merged 1 commit into
developfrom
fix/create-app-drop-auth-utils
Sep 6, 2026
Merged

y1o1 merged 1 commit into
developfrom
fix/create-app-drop-auth-utils

Conversation

@y1o1

@y1o1 y1o1 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Both generators emitted @o3co/auth.utils into generated package.json, and both templates imported createLogger / gracefulShutdown from it. This was the package's last consumer across the auth family — auth.provider left in #290, auth.proxy in #81, auth.policy-verifier in #210.

Two defects this fixes in generated instances

They never logged NDJSON. @o3co/auth.utils treats pino as an optional peer and falls back to console when the import fails. The generator never emitted pino, so every instance created by either CLI has been logging bare [name] … console lines that no aggregator parses. The scaffold now ships src/logger.mts on pino — a direct, exact-pinned runtime dependency like the rest — honouring logging.level from the application config with LOG_LEVEL as the override, and serialising err so an Error keeps its stack.

They could hang on SIGTERM and always exited zero. gracefulShutdown called server.close() with no deadline; one stuck request meant the process never exited on its own and the orchestrator's SIGKILL cut it mid-flight. Cleanup failures went to console.error. The scaffold now ships src/shutdown.mts with the contract the three o3co components adopted: drain for drainTimeoutMs (10s), bound cleanup by cleanupTimeoutMs, force-close past the deadline and exit non-zero, log through the instance logger, yield the loop once before exiting so the last lines flush, and name in reason whatever set the exit code (drain outcome kept under its own drain key).

shutdown.mts declares a small structural Logger rather than importing one, so the template does not depend on which upstream version the generator pins.

What the scaffold typecheck caught

Run against the pinned module ref, the provider instance failed typecheck: the HOCON template carries logging.level but DplaaxAppConfig does not declare it. The template reads it defensively ((config as { logging?: { level?: string } }).logging?.level), same as the verifier template already did for its AppConfigSchema at the 0.3.x pin.

Verification

  • Generator suites: 97 / 110 passed, four new cases — does not emit @o3co/auth.utils and emits pino per generator. The pino assertion is a literal "10.3.1", not DEFAULT_DEP_VERSIONS.pino: sharing the oracle with the implementation let a missing key pass as undefined === undefined on the first run.
  • Generator typecheck and root lint clean.
  • Both scaffolds generated with --dplaax-module-ref <origin/develop sha>, then inside each: pnpm installpnpm run typecheck (exit 0) → pnpm run test (provider 18, policy-verifier 26). Emitted package.json: no @o3co/auth.utils, pino: 10.3.1, zero caret specifiers.
  • No lockfile change: only generator source and templates moved.

docs/requirements.md § 6 and the CHANGELOG (Fixed ×2, Changed) are updated.

🤖 Generated with Claude Code

…/auth.utils

Both generators emitted @o3co/auth.utils and had their templates import
createLogger / gracefulShutdown from it. That package treats pino as an
optional peer and falls back to console, and the generator never emitted
pino — so every generated instance has been logging bare `[name] …` console
lines rather than NDJSON. Its gracefulShutdown also had no drain deadline
(one stuck request meant SIGTERM never completed and SIGKILL cut the process
mid-flight) and always exited zero.

Each scaffold now carries src/logger.mts (pino, direct exact-pinned
dependency; honours logging.level with LOG_LEVEL fallback; serialises `err`)
and src/shutdown.mts (the contract auth.provider #290, auth.proxy #81 and
auth.policy-verifier #210 adopted: bounded drain and cleanup, non-zero exit
on a truncated drain, deferred exit so the last lines flush, `reason` naming
what set the exit code). Both ship with tests that run under the instance's
own `pnpm run test`. shutdown declares a structural Logger so the template
does not depend on which upstream version the generator pins.

The provider template reads logging.level defensively: the HOCON carries it
but DplaaxAppConfig does not declare it, which the scaffold typecheck against
the pinned module caught.

Generator suites 97 / 110 (four new cases: no auth.utils emitted, pino
emitted at a literal exact pin). Generated instances against the pinned
develop module ref: typecheck clean, 18 / 26 tests. This was auth.utils'
last consumer across the auth family.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@y1o1
y1o1 merged commit 74e2264 into develop Sep 6, 2026
3 checks passed
@y1o1
y1o1 deleted the fix/create-app-drop-auth-utils branch September 6, 2026 12:04
y1o1 added a commit to o3co/auth that referenced this pull request Sep 6, 2026
…tils-free develop

Provin's scaffolds stopped emitting @o3co/auth.utils in provin-line/auth#22
(develop 74e22644): the create-provider and create-policy-verifier templates
now ship their own logger and shutdown, the same way auth.provider (#290),
auth.proxy (#81) and auth.policy-verifier (#210) do. That was the package's
last consumer across the family, so the harness no longer needs to pack it,
pin its revision, or carry the lockfile snapshot that stood in for the one
its repo does not track.

The override list is back to the five Provider/Verifier packages. The
provin-compatibility job on this PR is the cross-repo check: Provin at the new
pin, built and tested against the candidate auth tarballs, with no utils
override to fall back on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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