Skip to content

fix(generate): drop the generation timestamp from guard templates - #152

Closed
devinpadron1 wants to merge 1 commit into
apsoai:mainfrom
devinpadron1:fix/129-idempotent-guards
Closed

devinpadron1 wants to merge 1 commit into
apsoai:mainfrom
devinpadron1:fix/129-idempotent-guards

Conversation

@devinpadron1

@devinpadron1 devinpadron1 commented Oct 8, 2026 •

Copy link
Copy Markdown

auth.guard.ts and guards.module.ts rendered Generated at: <now>, so apso generate rewrote both files on every run of an auth-enabled project, even with no schema change.

The line is removed from both templates. The timestamp was set in two places, so both are gone: withGeneratedMeta (deleted; no template read its fields) and generateGuards's own copy.

New test generates the guards twice and expects identical output; 390 tests pass, lint 0 errors.

Fixes #129

auth.guard.ts and guards.module.ts rendered "Generated at: <now>", so
apso generate rewrote both files on every run of an auth-enabled
project, even with no schema change.

Remove the line from both templates, finishing 39679b1, which dropped
the same timestamp from the shared header for regen churn and PII. Stop
supplying generatedAt / generatedBy too: withGeneratedMeta (added them
to every render) is deleted, and generateGuards no longer sets its own
copy. No other template read either field.

New test generates the guards twice and expects identical output.

fixes apsoai#129
@cultron

cultron commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thanks @devinpadron1, your diagnosis and fix were right. Main had moved since you opened this (two new guard templates in 0.45 print the same line), so I carried your commit onto current main in #171 with you as the author, and added a commit for the new templates with you as co-author. Closing this in favor of #171.

@cultron cultron closed this Nov 3, 2026
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.

Guard templates inject generatedAt/generatedBy, making regeneration non-idempotent for auth-enabled projects

2 participants