Skip to content

tooling/common/serialization.py shims can drift silently across extension tools/ copies #88

Done

Description

@lasomethingsomething

From the codebase observations in #82 (kept out of the docs there):

tooling/common/serialization.py is copied into each extension's tools/serialization.py as a shim, and its own docstring says the NATS copy was the most recently updated at dedup time: the copies can drift silently. Consolidating on a single shared import (or a lint that hashes them) would remove that risk.

Suggested fix: consolidate on a single shared import, or add a lint/CI check that hashes all copies of the shim and fails when they differ.

Activity

  1. vvardan007 commented on Nov 29, 2026

    @vvardan007
    Contributor

    @colinjlacy , I'd like to take this one, with the check rather than the consolidation.

    I compared the four tools/serialization.py copies. Three are identical, and the one under tooling/smithy-runtime-conditions/ differs in a single line: parents[3] instead of parents[4], because it sits one directory level higher. So a plain hash comparison would fail today.

    My plan is a unit test under tooling/common that finds every tools/serialization.py, checks that each one matches the shim text apart from that depth, and checks that the depth points at the repo root. It would run in the existing Tests workflow. Does that fit what you had in mind?

  2. colinjlacy commented on Nov 29, 2026

    @colinjlacy
    Member

    @vvardan007 I think it might be better to just have a shared import. One place to maintain it, instead of multiple copies to keep aligned, even with (or, especially with?) failing builds to remind us that we forgot to update one 😅

  3. vvardan007 commented on Nov 30, 2026

    @vvardan007
    Contributor

    Agreed, one place is better. I'll go with the shared import:

    • delete the four tools/serialization.py copies;
    • in the ten scripts that use them, put tooling/common on sys.path and import the module directly, the way tooling/extension-bindings/ci/publish.py already does;
    • add the same line to the Kubernetes and NATS test_compile_extension.py, which import serialization themselves.

    I will share the pr shortly. Please assign this issue to me.

  4. colinjlacy commented on Nov 30, 2026

    @colinjlacy
    Member

    Wait, hold on. These files shouldn't even exist in the first place. They were added as part of the SDK experiments that ended in September as a complete and utter failure.

    Sorry, when I hear about four copies of a single file my brain automatically goes to "that's bad, we should have one." But in reality we shouldn't have any. The tooling/ folders in all of those extension folders can be straight up deleted.

  5. vvardan007 commented on Nov 30, 2026

    @vvardan007
    Contributor

    Understood, deleting them is simpler still. Before I change anything, here is what goes with those folders, so you can confirm the scope.

    The three tools/ folders under catalog/:

    Folder Scripts What depends on it
    catalog/aws/s3/tools 4 One mention in catalog/aws/s3/model/README.md
    catalog/kubernetes/api/tools 2 catalog/kubernetes/api/tests (2 files), the tool commands in the README, requirements.txt
    catalog/nats/service/tools 1 catalog/nats/service/tests, the compile command in the README, requirements.txt

    Deleting them means these have to go in the same PR, or CI breaks:

    • the Kubernetes and NATS test folders, which import the tools;
    • in tests.yml: the two pytest lines for those folders, and the service-operations-inventories checkout and symlink steps, which only the NATS tests use;
    • the tool instructions in the three READMEs, and the NATS paragraph in CONTRIBUTING.md;
    • the two requirements.txt files, which exist only for the tools.

    Two questions:

    1. tooling/smithy-runtime-conditions/ is the fourth place with a tools/ folder and a copy of the shim. It is not under an extension folder, and smithy-maintenance.yml runs it daily against S3. Should it go as well, together with that workflow, or stay?
    2. I would leave the data those tools read and wrote: the model/ bridges and generated mappings, and the S3 mappings/, maintenance/ and evidence/ folders. Tell me if any of that should go too.
  6. colinjlacy commented on Dec 2, 2026

    @colinjlacy
    Member

    @vvardan007 you can ignore the S3 extension. @itvi-1234 already got to that one when he closed #85.

    Why would you leave the data that those tools wrote? The model bridges, generated mappings, etc.?

  7. vvardan007 commented on Dec 3, 2026

    @vvardan007
    Contributor

    No good reason. I just hadn't checked whether anything still used them. Nothing in the bindings or tooling does, so they go too.

    I'll do for Kubernetes and NATS what #107 did for S3: keep the README, examples/ and releases/, delete the rest, and clean up tests.yml, CONTRIBUTING.md and both READMEs to match.

    Should SERVICE_OPERATIONS_SEMANTIC_BRIDGES.md go in the same PR? After this no extension has a bridge. @colinjlacy

  8. vvardan007 commented on Dec 3, 2026

    @vvardan007
    Contributor

    No good reason. I just hadn't checked whether anything still used them. Nothing in the bindings or tooling does, so they go too.

    I'll do for Kubernetes and NATS what #107 did for S3: keep the README, examples/ and releases/, delete the rest, and clean up tests.yml, CONTRIBUTING.md and both READMEs to match.

    Should SERVICE_OPERATIONS_SEMANTIC_BRIDGES.md go in the same PR? After this no extension has a bridge. @colinjlacy

  9. itvi-1234 commented on Dec 3, 2026

    @itvi-1234
    Member

    @vvardan007 , That is also done in latest PR :)
    Checkout #110

  10. colinjlacy commented on Dec 3, 2026

    @colinjlacy
    Member

    Fixed by #110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions