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.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 callsubmit) usinggit statusor 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 me start by understanding the repository structure and finding the relevant files mentioned in the issue description. The issue is about a stale-detection timestamp-field allowlist that's missing spec-declared date fields. Let me explore the repository first.
Key things to find:
- The stale template that has a hardcoded allowlist
- How the spec is used to derive date-time fields
- The
internal/cli/pm_stale.gofile mentioned
Let me start exploring.
Assistant
Let me look at the internal directory structure to find relevant files.
Assistant
Let me look at the stale template file first, as that's where the allowlist should be.
Assistant
Good, I can see the hardcoded allowlist at lines 24-36. Now let me understand how the generator works and where spec data is available. Let me look at the template rendering context and the generator code
Assistant
Let me look at the generator.go and plan_generate.go to understand the template rendering context.
Assistant
Let me search for where the stale template is rendered and understand the template context.
Assistant
Let me look at the relevant section in generator.go to understand how the template context is built, especially around line 3184.
Assistant
Ah, open takes a file and optional line number, not a range. Let me just use goto to navigate.
Assistant
Let me search for where the stale template is executed with data context
Assistant
Let me look at vision_templates.go to understand the template rendering flow.
Assistant
Let me see the rest of the vision_templates.go to see which workflows are included and how they connect.
Assistant
Let me look at plan_generate.go to understand how templates are rendered with context
Assistant
Let me search for where templates are rendered, specifically the
pm_staletemplate, in the generator flowAssistant
Let me look at lines 1897 and 2695 to understand how the workflow templates are rendered.
Assistant
Let me use the correct syntax - open with just the file path, then goto.
Assistant
Let me look at line 2695 to see how the workflow templates are rendered.
Assistant
Now I can see the template is rendered with
g.Spec(the full APISpec). Let me understand the spec types to know how to extract date-time fieldsAssistant
Let me look at the spec.go file to understand the spec structure
Assistant
Let me search for "format" and "date-time" in the spec package.
Assistant
Let me look at the Property type around line 1531 to understand the property structure
Assistant
Now let me look at how Resources and Endpoints are structured, specifically looking for properties with
format: date-time.Assistant
Let me look at the Resource and Endpoint structs to understand their structure.
Assistant
Let me use goto to navigate.
Assistant
Let me look at the ResponseDef struct around line 1640
Assistant
Let me search for where Types is defined in APISpec
Assistant
Let me look at how the template FuncMap is built in the generator
Assistant
Let me look at the FuncMap at line 202
Assistant
Let me go back to the generator.go FuncMap at line 202
Assistant
Let me now look at the full stale template and understand the approach for the fix
Assistant
Let me look at the profiler to understand how syncable resources and their fields are determined
Assistant
Let me look at the profiler to understand syncable
Assistant
Let me look at the SyncableResource type
Assistant
Let me look at the SyncableResource type around line 91
Assistant
Let me see the rest of the template.
Assistant
Let me look at the existing tests for the stale template to understand the constraints
Assistant
Now I have a clear understanding. Let me implement the fix. The approach:
- Add a method on
*spec.APISpecto collect date-time field names fromTypes - Modify the template to use this method and union with the hardcoded list
Let me first look at the APISpec structure to understand the Types field:
- Add a method on
Assistant
Let me look at TypeDef and TypeField again and then implement the solution. Let me first look at where the APISpec methods are defined to add a new one
Assistant
Let me open the spec file and navigate to the right location
Assistant
Let me look at how other APISpec methods are called in templates
Assistant
Now I'll implement the solution. First, let me find where to add the method on APISpec in spec.go
Assistant
Let me look near the end of APISpec methods to find a good insertion point
Assistant
Now I'm ready to implement. Let me first add the
DateTimeFieldNamesmethod to APISpec, then modify the template.Step 1: Add the method to spec.go after
CountMCPTools.Assistant
Let me check if
sortis imported in spec.goAssistant
sortis not imported. Let me add it to the imports.Assistant
Let me view the imports section
Assistant
I need to add
"sort"to the imports. Let me edit the import block.Assistant
Let me verify the method was added correctly
Assistant
Now I need to modify the stale template to include spec-derived date-time fields. Let me edit the template:
Assistant
Let me verify the changes compile correctly
Assistant
Let me check the Go environment setup
Assistant
Let me check how Go is configured in this environment
Assistant
Let me check the go environment configuration
Assistant
Let me set the GOMODCACHE and try building
Assistant
Let me set the proper environment
Assistant
Good, the spec package compiles. Let me now run the stale-related tests.
Assistant
Let me run the full spec tests and the template rendering tests to make sure nothing is broken
Assistant
Good, spec tests pass. Let me now run the tests related to the stale template in the generator more broadly
Assistant
The test failures are all about missing HOME/GOPATH for module verification, not related to my changes. Let me run only the stale-related tests more specifically.
Assistant
Let me verify the template renders correctly by writing a quick test script.
Assistant
Let me run the test script
Assistant
Let me write a quick inline test within the package
Assistant
Let me run a broader set of generator tests that don't require
go buildto check for regressionsAssistant
Let me also run the framework collision tests that reference the stale template
Assistant
Let me verify the full diff of my changes
Assistant
Let me verify the spec tests pass one more time and check the overall diff for my source changes
Assistant
All spec tests pass. Let me run the stale-specific tests one more time.
Assistant
Let me clean up the temp test file and verify the git status for my actual changes
Assistant
Let me add a nil safety check to the
DateTimeFieldNamesmethod, consistent with other methods on APISpecAssistant
Let me try with a different approach to add the nil check
Assistant
Let me use replace to add the nil check
Assistant
Let me verify compilation and run tests again
Assistant
Let me run all the relevant tests one final time to confirm everything passes
Assistant
All tests pass. Let me review the final diff of my source changes before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.