Skip to content

type: IndexType.clustered is silently dropped and untested #58

Description

@mvhenten

AccessPattern.type in tsp/main.tsp is typed as the IndexType enum (clustered / isolated), not a string literal:

enum IndexType {
    clustered,
    isolated,
}

model AccessPattern {
    ...
    type?: IndexType = IndexType.isolated;
    ...
}

src/decorators/$index.ts reads type through the same getStringValue helper used for collection (see the sibling issue), which only handles prop.type.kind === "String". An IndexType member reference resolves to kind EnumMember, so getStringValue("type") always returns undefined and type never reaches the emitted access pattern — silently, with no diagnostic.

IndexType, clustered and isolated appear nowhere under src/ or test/ outside the declaration in tsp/main.tsp — there is no code path that reads the value and no test exercising it. The README nonetheless states (line 178) that the fixture covers "multiple indexes on one entity (isolated, clustered, and scoped GSIs)"; test/main.tsp only has isolated and scoped indexes, no clustered example.

Correct behaviour: either add an EnumMember case to the reader (or a dedicated reader for type) that resolves IndexType.clustered / IndexType.isolated to their string value, cover it with a test the way test/main.tsp covers scope, and fix the README claim to match — or drop type/IndexType from the declaration and the README claim if clustered isn't meant to be supported yet. An unreadable value should raise a diagnostic rather than be silently dropped either way.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions