ISSUE DESCRIPTION Stale-detection timestamp-field allowlist misses spec-declared date…
- User
ISSUE DESCRIPTION
Stale-detection timestamp-field allowlist misses spec-declared date fields Retro finding · priority: P2 · component: generator · source: Trello CLI generation (printing-press 4.9.0)
What happened
The generated
internal/cli/pm_stale.gomatches inactivity against a hardcodedstaleTimestampFieldsallowlist (updatedAt, updated_at, updatedDate, modifiedAt, modified_at, lastModified, last_modified, lastEditedTime, last_edited_time, updated, last_updated). Trello cards usedateLastActivity, which is absent. The flagshipstalecommand returned "No stale items found" while a hand-builthealthcommand (readingdateLastActivity) counted 93 stale cards on the same hydrated data. Silent-empty flagship command, no error.Root cause
The stale template hardcodes a timestamp-name allowlist instead of also deriving candidate timestamp fields from the spec (properties with
format: date-time).Durable fix (proposed)
Build the stale timestamp-field set as
hardcoded allowlist ∪ spec-declared date-time property names for the synced resources. Guard: union is additive only — never removes existing allowlist entries, so no regression for currently-working APIs.Test
- Positive: a spec with a
dateLastActivity(format: date-time) card property produces astalethat finds rows older than N days. - Negative: an API using
updated_atis unchanged.
Repro / evidence
trello-pp-cli stale --days 14→ empty;trello-pp-cli health→ 93 stale on the same mirror. Fixed by hand-addingdateLastActivityto the allowlist. The allowlist approach will keep silently breaking the flagship command for the next API with an unlisted activity field.Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Positive: a spec with a
Assistant
Let's look at schema_builder.go around those lines to understand TableDef/Columns structure, which might already be passed into workflow templates (but pm_stale.go.tmpl only gets g.Spec, not TableDef schema).
Assistant
Good, sort is already imported. Now let's find a good place to add the new functions and the funcMap entry.
Assistant
Now let's add the funcMap entry and the helper functions.
Assistant
Now add the helper functions near
commandConstructorForTemplateor near schema_builder-related code. Let's add them in generator.go right aftercommandConstructorForTemplate.Assistant
Now update the template to use the func instead of hardcoded list.
Assistant
Now let's check the build compiles.
Assistant
Build succeeds. Now let's run existing generator tests related to stale.
Assistant
Now update generator.go: rename/add
staleAdditionalTimestampFieldNamesfuncMap entry that returns only the new (non-allowlisted) names, and keepstaleTimestampFieldNamesas an internal helper if needed (or just repurpose).Assistant
Now update the comment on
staleTimestampFieldsvar since we changed template to keep the field literal + append via range. Let's view current template state and generator.go for correctness.Assistant
Good, comment already reflects the new behavior. Now let's build again.
Assistant
Now let's run the pinned test and related generator tests.
Assistant
Now let's write a quick reproduction script generating a CLI from a Trello-like spec with
dateLastActivitydate-time property, then check the generatedpm_stale.goincludes it.Assistant
The fix works as intended. Now test the negative case (an API using only
updated_atstays unchanged).Assistant
Let's see the actual failing test names.
Assistant
These failures are pre-existing environment issues (missing $HOME, govulncheck vulnerability in local Go toolchain) unrelated to my change. Let's confirm they fail even without my changes.
Assistant
Confirmed: these three failures pre-exist independent of my change (environment-related: missing $HOME, toolchain vulnerability). Now let's run the rest of the full generator test suite excluding these known-broken tests to make sure nothing else broke.
Assistant
All other generator tests pass. Let's also run the full test suite across the repo to be safe (excluding known broken environment tests).
Assistant
Good, those pass quickly. The full suite is just slow (likely includes CLI generation + build for many golden testdata specs), not something broken by my change. Let's clean up the temp repro directory and any stray artifacts before submitting.
Assistant
Let's view the final diff to review.
Assistant
Good, already gofmt-clean. Now let's double check the negative test scenario explicitly (an API using only
updated_atproduces unchanged output, i.e. no extra fields appended).Assistant
Negative test confirmed: no duplicate/extra entry since
updated_atis already in the allowlist — output byte-identical to before. Now clean up temp files.Assistant
Now let's re-run the full relevant generator test suite one more time to be certain everything's clean.
Assistant
All tests pass. Let's do a final review of the diff.
Assistant
This looks good. Now let's go through the checklist.
Checklist review
-
If an error was reported in the issue description, I have successfully reproduced it. I reproduced the root cause by building a minimal Trello-like spec (a
cardsresource with a property declared ) and generating the CLI. Before my fix, 's hardcoded never included , exactly matching the reported bug (stale command finds nothing while a hand-rolled command using that field finds real data).
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.