Skip to content

[WIP] Fix duplicate struct registration with v.mod - #4

Draft
enghitalo with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-vmod-duplicate-struct-registration
Draft

[WIP] Fix duplicate struct registration with v.mod#4
enghitalo with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-vmod-duplicate-struct-registration

Conversation

Copilot AI commented Dec 18, 2025

Copy link
Copy Markdown

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

fix v.mod, c_buid, parser, or ast.
test suggestion

import os

fn test_duplicate_struct_registration_with_vmod() {
	root := os.temp_dir() + '/vmod_struct_dup_test'
	os.rmdir_all(root) or {}
	os.mkdir_all(root + '/hexagonal/application') or { panic(err) }
	os.write_file(root + '/v.mod', 'Module {\nname: "vanilla3"\n}') or { panic(err) }
	os.write_file(root + '/hexagonal/application/auth_usecase.v', 'module application\n\npub struct AuthUseCase {}\n') or {
		panic(err)
	}
	os.write_file(root + '/hexagonal/main.v', 'module main\n\nimport application\n\nfn main() { _ := application.AuthUseCase{} }\n') or {
		panic(err)
	}

	// Simulate the real project structure and import resolution
	// Run from the root so v.mod is picked up, and import path is correct
	old_dir := os.getwd()
	os.chdir(root) or { panic(err) }
	res := os.execute('v run hexagonal')
	os.chdir(old_dir) or { panic(err) }
	dump(res.output)

	os.rmdir_all(root) or {}
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI requested a review from enghitalo December 18, 2025 00:37
enghitalo pushed a commit that referenced this pull request Jun 20, 2026
… race (vlang#27434)

* net.http: bound the TLS server handshake timeout for infinite accept_timeout

The TLS server handshake runs on the accept thread, and its timeout was
derived directly from `accept_timeout` (`handshake_timeout := accept_timeout`).
With `accept_timeout <= 0` (block indefinitely waiting to accept), the handshake
timeout therefore became infinite too, so a client that completes the TCP
connect and then stalls mid-TLS-handshake wedged the accept loop forever: no new
connections were accepted, and `stop()` was never observed. That is the hang
class vlang#27429 set out to remove, still reachable for the `accept_timeout <= 0`
configuration.

Fall back to a finite `tls_handshake_timeout` when `accept_timeout <= 0`.

Note: this reverses the deliberate behavior added in "preserve zero TLS handshake
timeout"; the corresponding test is updated. Flagging for @medvednikov per the
discussion on vlang#27433.

(Item #2 from vlang#27433 — read_timeout ignored on HTTPS — was fixed independently on
master by "fix master ci failures", so it is not included here. The close_idle
fd-reuse race, item #4, is left for a separate change now that master added an
out-of-lock net.close on Windows.)

Refs vlang#27433.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* net.http: make TLS handshake fallback timeout configurable per Server

`tls_handshake_timeout` was a module-level constant with no Server-field
override, inconsistent with `read_timeout`, `write_timeout`, and
`accept_timeout` which are all `pub mut` fields. Add
`Server.tls_handshake_timeout` (default 30 s) and thread it through
`tls_accept_timeouts` as a parameter so users who need a tighter budget
(hardened public-facing server) or a looser one (embedded devices with
slow crypto hardware) can set it directly.

Also fix the misleading doc comment: the fallback fires only when
`accept_timeout` is explicitly zero or `net.infinite_timeout`, not
whenever the user "did not set a finite accept_timeout" (the default is
already finite at 30 s).

Co-Authored-By: WOZCODE <contact@withwoz.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: WOZCODE <contact@withwoz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants