Repository navigation
fix: bind creation dates as timestamps and encode environment names - #260
Conversation
…256, #257) The entity and environment factories bound Date.toString() text to a TIMESTAMP column and answered the same text, which no read of the row answers and which the Python Entity model rejects. Both now bind a timestamp and answer the format a read gives. The Python client's get_environment_by_name interpolated a free-text name into the URL, so "a?b" looked up "a" and "../1" fetched environment 1. The name is now encoded as one path segment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Self-review rubric (head
Adversarial pass on the timestamp change: Remaining risk: the insert has not been run on Postgres. Binding a This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
EntityFactoryandEnvironmentFactoryboundnew Date().toString()text to aTIMESTAMPcolumn and answered the same text. A new package-privateCreationTimestampsupplies ajava.sql.Timestampto bind and theyyyy-MM-dd HH:mm:sstext to answer, both from one instant truncated to the second. A create now answers what a later read of the row answers, which is also a form the PythonEntitymodel accepts. Previously that model raisedValueErroron the create's response.get_environment_by_nameinterpolated a free-text name into the URL, soa?blooked upaand../1fetched environment 1. The name is now percent-encoded as one path segment.Closes #256
Closes #257
Behaviour notes
creationDateis still astring, so the contract is unchanged, but the text aPOSTanswers changes form./now reaches the server as%2F. The servlet stack is expected to reject that with400rather than the previous unmapped-route404. Either way the caller gets an error rather than a wrong environment. This was not exercised against a running server.Environmentmodel was left alone. It can be restored as a separate change now that creates answer a valid date.Verification gaps
TIMESTAMPcolumn, so the insert is untested on the production database. A localPOST /api/v1/entitiesagainst the compose stack is recommended.test_setCreationDate_accepts_what_the_service_answersis a contract pin, not a regression test. The model did not change, so it passes with or without the fix. The Python side of Creating an entity or environment binds Date.toString() text to a TIMESTAMP column and answers a date no read answers #256 was confirmed by constructingEntitywith the old format, which raisesValueError.Triage / skip reasons
pom.xmlbuild pipeline and exceeds one cycle.503): filed this cycle and left out of this PR because each touches a do-not-auto-merge path.Test plan
mvn -B test: 661 tests, 0 failures, 0 errorspytest(Python 3.9+): 128 passedpython3 -m pytest(Python 3.8): 128 passedCreationDateSchemaTesterrors withCannot parse "TIMESTAMP" constant,EntityFactoryTestfails on the date format, and the six parametrized name tests fail. With the fixes restored, all pass. Fortwo words, the failure only shows the client now encodes the space itself, sincerequestswould otherwise have done so.POST /api/v1/entitiesandPOST /api/v1/environmentsagainst real PostgresThis PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson