Skip to content

Canonicalize namespace names - #5967

Open
aasoni wants to merge 18 commits into
masterfrom
alessandro/fix-canonical-vs-accessor-name-in-typescript-submodules
Open

aasoni wants to merge 18 commits into
masterfrom
alessandro/fix-canonical-vs-accessor-name-in-typescript-submodules

Conversation

@aasoni

@aasoni aasoni commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Canonicalize namespace names. Requires a new field in module def to save the non canonical name.

API and ABI breaking changes

This breaks existing modules that were published with names that will now canonicalize to a different name.
E.g. if a database was published with a submodule under namespace myAuth, then this database will no longer work properly because the module definition will bo loaded as my_auth but the datastore will have myAuth.

There are ways around this but they make the change more complicated. My take is we ship this and announce that the
upgrade will break modules with submodules.

Rollback safety impact

n/a

Expected complexity level and risk

3

Testing

  • Add unit tests to confirm case conversion applies correctly

@aasoni aasoni added abi-break A PR that makes an ABI breaking change api-break A PR that makes an API breaking change and removed abi-break A PR that makes an ABI breaking change labels Sep 22, 2026
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
@aasoni
aasoni marked this pull request as ready for review September 23, 2026 11:38
@JasonAtClockwork
JasonAtClockwork self-requested a review September 23, 2026 15:20

@JasonAtClockwork JasonAtClockwork left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is a client-binding issue when submodule table/view canonical names differ from the accessor.

Server

// library.ts
const activity = table(
  { name: 'stored_events', public: true },
  {
    id: t.u64().primaryKey().autoInc(),
    value: t.string(),
  }
);

const library = schema({ activityLog: activity });
export default library;

export const visibleEvents = library.view(
  { name: 'stored_view', public: true },
  t.array(activity.rowType),
  ctx => ctx.from.activityLog
);
// index.ts
import * as library from './library';
export default schema({ clientLib: library });

After generating the TypeScript bindings you can subscribe to tables.clientLib.activityLog and tables.clientLib.visibleEvents but the client accessors seem to be missing at ctx.db.clientLib.activityLog.

It's possible my test was incorrect but after looking it's possible #makeDbView() need the accessor path?

Comment on lines 434 to 437
if map.contains_key(&namespace) {
errors.push(ValidationError::DuplicateName {
name: submodule.namespace.into(),
name: namespace.as_raw().clone(),
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading the validation correctly for namespaces/submodules we're only checking the canonical name for duplication. I believe with the tables it's checking canonical and accessor name to avoid collisions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that's a very good point. Accessor names should also not be be duplicated, I hadn't thought of that

This branch has not been deployed

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

Labels

api-break A PR that makes an API breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants