Repository navigation
Fix and guard against cross-module export name collisions - #4
Merged
Merged
Conversation
Add a standard-library-wide test (built_in_modules_export_no_ambiguous_ names_across_the_standard_library) that replicates nscript-semantics's E4003 ambiguous-export check over every BUILTINS module at once, rather than only over one program's own import graph. That check found four collisions beyond the NCC-10/NCC-13 one already fixed: - ncc08.service / ncc09.service -> ncc08's renamed to handover_service - ncc00.status / ncc09.status -> ncc09's renamed to authority_status - ncc08.state / ncc10.state -> ncc08's renamed to handover_state - concord02.Channel / nip28.Channel -> concord02's renamed to ConcordChannel - concord02.CommunityError / nip72.CommunityError -> concord02's renamed to ConcordCommunityError Each rename picked whichever side had fewer real call sites; concord02 had none outside its own module file. Updates every affected .nsm module, the runtime pure-function registry and its tests, the example and conformance scripts calling the renamed functions by their qualified name, and spec/nostr.md and NCC-PLAN.md. Also records, as a documented follow-up rather than attempting an in-scope fix, the other issue examples/service-operator-bot.ns surfaced: top-level and schedule bodies execute via two independent static passes (literal publishes, then bare operation calls) rather than in source order, so a schedule computing a value and publishing it needs to move into a handler instead. A real fix needs the same sequential, data-flow-aware evaluation a handler body already gets, which is an evaluator change out of scope here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D95PWA2fdNfg7nUvUHBeMi
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.
Summary
Follow-up to
imattau/nscript#3, which fixed the NCC-10/NCC-13operator_for_tagcollision found composing both intoexamples/service-operator-bot.ns. That fix was ad hoc — nothing checks the whole standard library for this class of bug, only whichever modules one program's ownusegraph happens to pull in.built_in_modules_export_no_ambiguous_names_across_the_standard_library(innscript-modules) replicatesnscript-semantics'sE4003ambiguous-export check over everyBUILTINSmodule at once. It found four more real collisions, none previously exercised by any program combining both sides:ncc08.service/ncc09.service→ NCC-08's renamed tohandover_servicencc00.status/ncc09.status→ NCC-09's renamed toauthority_statusncc08.state/ncc10.state→ NCC-08's renamed tohandover_state(coincidentally same name, unrelated signatures/purposes)concord02.Channel/nip28.Channel→ concord02's renamed toConcordChannelconcord02.CommunityError/nip72.CommunityError→ concord02's renamed toConcordCommunityError.nsmmodule, the runtime pure-function registry + its unit tests, the example/conformance scripts calling the renamed functions, andspec/nostr.md/NCC-PLAN.md.publishes, then bare operation calls) rather than in source order, so a schedule computing a value and publishing it has to move into a handler instead. Recorded as a follow-up inNCC-PLAN.md; a real fix needs the same sequential, data-flow-aware evaluation a handler body already gets — an evaluator change, out of scope here.Test plan
cargo build --workspace— cleancargo test --workspace— all tests pass (249 + 69 CLI + 14 nscript-modules tests, including the new guard test)cargo fmt --check— cleancargo clippy --workspace --tests -- -D warnings— cleannscript checkon every touched.ns/.nsmfile🤖 Generated with Claude Code
https://claude.ai/code/session_01D95PWA2fdNfg7nUvUHBeMi
Generated by Claude Code