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 me start by exploring the repository structure to understand what we're working with.
Assistant
Let me explore the repository structure more thoroughly to understand the codebase.
Assistant
me look for the
staleTimestampFieldsallowlist.Assistant
Now let me understand how the templates are processed to learn how to inject extra timestamp fields from the spec. Let me check the generator.go to see how this template is processed
Assistant
Let me look at how workflows are rendered and understand the data context passed to the pm_stale template
Assistant
Let me look at the structure of
spec.APISpecto understand how I can extract the date-time field names from the resources.Assistant
Let me check the ResponseDef and Param structures to understand response schemas.
Assistant
Let me check how
g.Specis passed to templates and what the existing patterns look like.Assistant
understand how they verify the
pm_stale.go.tmpltemplate.Assistant
Let me understand the spec structure better - in particular, what does an Endpoint look like in terms of response schemas (fields with format: date-time).
Assistant
Now let me understand how response types work.
Assistant
Now let me check how the renderTemplate method is being called for pm_stale.
Assistant
Let me check the template mechanism and see what other helper functions are available.
Assistant
Let me look at the testdata folder to see if there are sample specs to use.
Assistant
me look at the petstore.yaml to understand its format.
Assistant
Now let me see how date-time fields get extracted by the parser.
Assistant
Let me first verify the current state of the project, then make the fix.
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
The project builds. Let me now design the fix. Let me first look at the test that already exists for
pm_stale.go.tmpl.Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Let me look at the
minimalSpecfunction used in the tests.Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Let me now plan the implementation. I'll add a helper function to the FuncMap and modify the template.
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Now let me look at how to test this. First, let me check the
formatmethod forParam:Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Let me create a quick reproduction script to verify the bug first.
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Let me put the test inside the project itself so it can use internal packages.
Assistant
</mm:think>
Assistant
I've confirmed the bug. Now let me implement the fix.
Step 1: Add the helper function
staleTimestampExtrasto generator.go.Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Now I have a clear picture. Let me implement the fix step-by-step.
Step 1: Add the
staleTimestampExtrashelper function in generator.go.Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now let me add the helper function and register it. Let me first add the function definition, then register it in the FuncMap.
Assistant
</mm:think>
Assistant
</mm:think>Let me find a good spot to register the function. Let me register it right after
enumLiteral:Assistant
</mm:think>Now let me find the end of the FuncMap and the end of the file to understand the structure better:
Assistant
</mm:think>Now let me make the changes. First, add the helper function:
Assistant
</mm:think>Now let me add the helper function. I'll add it after
endpointTemplateVarsAny:Assistant
</mm:think>
Assistant
</mm:think>Now let me insert this into generator.go:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now I'll insert the helper function between
endpointTemplateVarsAnyandbuildWhichFallbackEntries. Let me use a Python script to do this safely:Assistant
</mm:think>
Assistant
</mm:think>Now let me register the function in the FuncMap:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Now let me verify the generator still compiles.
Assistant
Build passes. Now let me update the template to use the helper function:
Assistant
</mm:think>Now let me update the template to add the union of spec-declared fields:
Assistant
</mm:think>
Assistant
</mm:think>Now let me re-run the reproduction script to verify the fix works:
Assistant
</mm:think>
Assistant
</mm:think>The fix works. Let me also verify the generated output is well-formed by reading the generated file:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
The fix works. The petstore case correctly adds
shipDate(which hasformat: date-time). Let me also verify the dedupe logic works for hardcoded-overlap scenarios. Let me create a more elaborate test:Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Excellent! All cases pass. Let me also enhance the test to verify the dedupe behavior more rigorously:
Assistant
</mm:think>All my tests pass. Now let me also run the existing tests to verify I haven't broken anything:
Assistant
</mm:think>Existing tests pass. Let me also run the project management workflows tests:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
This test failure is caused by my GOCACHE env var being set, not by my fix. Let me verify by running without my GOCACHE env var:
Assistant
</mm:think>
Assistant
</mm:think>Now let me also check the TestGenerateWithNoAuth test failure:
Assistant
These failures are unrelated to my changes (they're environment-specific - GOCACHE and a Go vulnerability scan). Let me run the rest of the tests that are not impacted by these issues:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now let me also clean up my reproduction script and verify my changes work well:
Assistant
</mm:think>Now let me also verify my changes by reviewing the final state:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now let me also look at the relevant tests to make sure they still pass and verify the generated output is sane:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Let me also verify the existing test for the hardcoded list still passes since I want to ensure no regression in the test:
Assistant
</mm:think>
Assistant
</mm:think>Now let me also run a broader test suite to make sure nothing is broken:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Let me also look at the validation related to the template to make sure my changes are well-formed:
Assistant
</mm:think>
Assistant
</mm:think>Now let me also check that the validate function doesn't reject my output. Let me check what validate.go does:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
Let me also verify the generated output is gofmt-clean by re-running the reproduction:
Assistant
</mm:think>
Assistant
The gofmt failure is in
internal/config/config.gonot in the stale template. Let me verify this is not related to my change:Assistant
That's an unrelated bug in the test's OAuth format string (double quotes inside string). Let me update the test to avoid that:
Assistant
The find is wrong. Let me fix the search string:
Assistant
</mm:think>
Assistant
</mm:think>The output looks great. The generated file is gofmt-clean and includes
dateLastActivityfor the Trello spec. Let me clean up the reproduction script:Assistant
</mm:think>Let me also verify my changes by checking the test for the existing field coverage:
Assistant
</mm:think>
Assistant
</mm:think>Let me look at the test framework collision test:
Assistant
</mm:think>
Assistant
</mm:think>Let me run a wider sweep:
Assistant
</mm:think>
Assistant
Only one failure, and it's the govulncheck failure which is unrelated to my changes. Let me run a broader set of tests in the project to make sure my changes don't break anything else:
Assistant
</mm:think>All tests pass. Now let me also check the spec tests just to be thorough:
Assistant
</mm:think>
Assistant
</mm:think>Let me also check the templates_test.go to see what tests are there:
Assistant
</mm:think>
Assistant
</mm:think>All tests pass. Let me also do a final check on the whole code base:
Assistant
</mm:think>
Assistant
</mm:think>Now let me verify my changes are complete and good. Let me look at the full final diff:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
The go.mod was modified by
go mod tidy. This is not related to my fix. Let me revert it:Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now let me verify the build still works after reverting go.mod:
Assistant
</mm:think>
Assistant
</mm:think>All tests still pass. Let me now show the full final diff:
Assistant
The diff is clean. Let me now run a final comprehensive test to make sure everything still works:
Assistant
</mm:think>All tests pass. Let me run the failed tests once more to be sure they were failing for environmental reasons and not because of my changes:
Assistant
</mm:think>
Assistant
TestGenerateWithNoAuth
failure is a pre-existing environment issue (Go vulnerability incrypto/tlsrequiringgo1.26.5`). It's unrelated to my changes. Let me verify by reverting my changes and running the test:Assistant
</mm:think>Confirmed - the
TestGenerateWithNoAuthfailure is a pre-existing issue unrelated to my changes. It happens even with my changes reverted.Now let me also revert the go.mod that got modified by the test:
Assistant
</mm:think>Now let me also re-verify everything is fine:
Assistant
</mm:think>All tests pass. Let me also run one final comprehensive verification by writing a temporary verification script that exercises the full positive and negative cases:
Assistant
</mm:think>All cases pass! Let me also check the final list:
Assistant
</mm:think>All cases pass. Now let me clean up the reproduction script:
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>
Assistant
</mm:think>Now my changes are clean and ready for submission. Let me show the final diff one more time:
Assistant
Now let me address the checklist:
Assistant
Let me run the relevant tests one more time to make sure everything is still working:
Assistant
All tests pass. Now let me address the checklist:
Checklist:
- If an error was reported in the issue description, I have successfully reproduced it. — Confirmed: A Trello-like spec with
dateLastActivityfield did NOT havedateLastActivityin the generatedpm_stale.go(initial state). - If an error was reported in the issue description, I have confirmed that my fix resolves the error. — Confirmed: After my fix, the generated
pm_stale.gonow includesdateLastActivityin thestaleTimestampFieldsarray. - I have thought about edge cases and made sure my fix handles them as well. — Edge cases handled:
- If an error was reported in the issue description, I have successfully reproduced it. — Confirmed: A Trello-like spec with
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.