Repository navigation
fix(gooddata-sdk): keep template authors through put - #1958
Merged
Merged
Conversation
A declarative put of document templates and page templates makes the caller their creator, because the client has no author fields on either template schema and the SDK cannot send them. The backend has exposed and restored createdBy, createdAt, modifiedBy and modifiedAt on both since LX-3490. Regenerating from the staging spec gives DeclarativePublisherDocumentTemplate and DeclarativePublisherDocumentPageTemplate the four fields, typed as on DeclarativePublisherDocument, ready for the SDK to model. The spec is taken whole, so the regeneration also brings in drift that nothing in the SDK models yet: - metricExtensions and visualizationObjectExtensions on the analytics layer (DeclarativeMetricExtension, DeclarativeVisualizationObjectExtension); - a DATE_RANGE parameter type (DateRangeParameterDefinition, DateRangeParameterValue, ParameterizedDateFilter) and a nullable bound on RelativeBoundedDateFilter. The generator flattens a oneOf into its last member, so the composed ParameterDefinition and JsonApiParameterInAttributesDefinition models now default to DATE_RANGE with a DateRangeParameterValue default_value instead of STRING with a str; - DeclarativeMetricPermissionAssignment and DeclarativeVisualizationObjectPermissionAssignment are no longer nullable; - localization issues, per-workspace coverage statistics (includeCoverage, LocalizationMetadataStatistics.workspaces) and child-workspace usage, with their new paths; - a GOODDATA_AI LLM provider config (GoodDataAiProviderConfig); - embedding-origin validation (validateEmbeddingOrigin and the EMBEDDING_ORIGINS setting), plus the ENABLE_AI_TRACE_OBFUSCATION, ENABLE_AI_PERSISTENCE_OBFUSCATION and AI_LAKE_CREDENTIAL_VENDING settings; - a computation profile on result cache metadata, an AFM execution progress stream, an AI Lake data source refresh operation and a workspace document search path. No path, schema, property or API tag is removed or renamed, and no field that was a free-form object gained a type. Nothing in the SDK uses the parameter definition or permission assignment models above. The SDK passes type-check and its suite unchanged, and so does gooddata-pipelines. jira: LX-3539 risk: low Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document templates and page templates had no author fields in the SDK model, so a declarative get dropped createdBy, createdAt, modifiedBy and modifiedAt and a put sent none. The backend then stamped the caller as creator of every template, which a workspace backup and restore turned into the restoring admin and the time of the restore. Both template classes now share the analytics base documents already use, so the four optional fields are read, stored to the template's layout file, loaded and put back. A template without them still loads with them empty, and a put without them still makes the caller the creator. The backend has restored template authors from the payload since LX-3490. gdc deploy is unchanged: the Analytics-as-Code form carries no author fields for any object type, so a deploy makes the deployer the creator by design. The round-trip seed gives both templates a non-caller author so a reset to the caller fails the test. Its cassette is re-recorded separately. jira: LX-3539 risk: low Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The round-trip test now seeds a document template and a page template authored by demo rather than the calling admin, and asserts all four author fields on both after get, store, load and put. The old cassette was recorded when templates had no author fields, so the backend had stamped admin as their creator. Re-recorded on python-sdk-dex, which runs the backend change that restores template authors from the layout payload. The recorded responses carry createdBy, createdAt, modifiedBy and modifiedAt on both templates, with demo as creator. No other cassette changes. jira: LX-3539 risk: nonprod Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 207 billable files and costs up to $51.75. View limit details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1958 +/- ##
=======================================
Coverage 86.68% 86.68%
=======================================
Files 350 350
Lines 27283 27283
=======================================
Hits 23649 23649
Misses 3634 3634 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hkad98
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Document templates and page templates keep their
created_by,created_at,modified_byandmodified_atthrough the SDK's declarative get, store, load and put, and so through agooddata-pipelinesbackup and restore.gdc deployis deliberately unchanged.Fixes LX-3539. Epic LX-3483.
What this implements
The backend has restored template authors from the layout payload since LX-3490, the same way it does for documents. The SDK model had no author fields on the two template classes, so a get dropped them and the put sent none, and the backend stamped the caller as creator:
CatalogAnalyticsBaseMetais the base documents already use, so the four optional fields are read, written to each template's layout file, loaded and put back. A template without them still loads with them empty, and a put without them still makes the caller the creator.Three commits, in this order:
The model change is two base classes in analytics_model.py:507 and :520.
Decisions
All four author fields on both templates, not only the created pair.
A created-only model would let every put stamp the caller as the modifier. Documents carry all four, so templates now match them.
gdc deployis out of scope.It deploys from Analytics-as-Code, which carries no author fields for any object type, so the deployer becomes the creator of every object, documents and dashboards included. That is by design, and merging live authors into a deploy would be a cross-type feature nobody has asked for.
The client is regenerated whole, as its own commit.
The two template schemas only gained the author fields in the staging spec, and the spec is never trimmed or hand-edited, so the commit also brings the rest of the drift: metric and visualization object extension lists,
DATE_RANGEparameters, localization, aGOODDATA_AIprovider config, embedding-origin validation and a few more settings. Nothing was removed or renamed, and the SDK models none of the new schemas. Two generated shifts the SDK does not use are called out in the commit body: the composed parameter models now default toDATE_RANGE, and two permission-assignment schemas lostnullable: true.The round-trip seed authors both templates as
demo, not the callingadmin.With an
adminseed a reset to the caller would still pass. The document's seed is untouched. Onlydemo_documents_store_load_and_put.yamlis re-recorded, and its recorded responses carry all four fields withdemoas creator.What comes next
Nothing is planned.
Test plan
make -C packages/gooddata-sdk format-fix lint-fix type-checkis clean, andTEST_ENVS=py314 make -C packages/gooddata-sdk testgives 732 passed, 2 skipped, 3 xfailed.TEST_ENVS=py314 make -C packages/gooddata-pipelines testgives 195 passed. It is the consumer, and its restore callsput_declarative_analytics_model.test_documents_survive_store_load_and_putnow asserts all four fields on both templates after get, store, load and put. The unit tests intest_declarative_analytics_documents.pycover typed template authors (:175), a template without author fields (:190) and the disk round trip.Risk
low — a model change to two template classes plus a regenerated client with no SDK use of the new surface. A backup taken before this change restores as before, with the restorer as creator.
jira: LX-3539
risk: low
🤖 Generated with Claude Code