Skip to content

cortheon: keep a link when whitespace splits the attribute or the URL - #3006

Merged
ashhart merged 7 commits into
ashhart:mainfrom
ppardus:cortheon-link-whitespace
Nov 13, 2026
Merged

ashhart merged 7 commits into
ashhart:mainfrom
ppardus:cortheon-link-whitespace

Conversation

@ppardus

@ppardus ppardus commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What this changes

Cortheon drops a page link, or resolves the wrong address, when whitespace sits around href or inside the URL.

  • A page link written href ="…" is kept.

  • A page link whose quote follows a newline after = is kept.

  • An unquoted page link ends at a tab, CR or LF.

  • A link whose ends are a newline still resolves as that link.

  • A tab or newline wrapped inside a link is not part of the URL. A space inside the URL stays.

  • Issue: n/a. Host-testable link whitespace bugs, with no open issue.

  • Stacked on: main.

  • atc overlap --json: n/a. atc is not installed here.

Receipt

n/a. This does not reach inference: no lane, sampler, precision or prompt-processing change. Metal and CUDA were not run.

  • Environment: Zig 0.17.0 host tests. No checkpoint and no GPU.
  • Paths: Cortheon page-link reading and URL resolution. Run as host tests. No GPU.
  • Exactness: n/a. Does not reach inference.
  • Decode speed: n/a. Does not reach inference.
  • Prompt speed: n/a. Does not reach prompt processing.
  • Licence: n/a.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Thanks @ppardus. The resolve side is right: a tab or newline inside a link isn't part of it, a space stays, and the ends are trimmed (web.zig:276-284), with a test each. One thing to change before it lands:

  1. hrefs now stops at the first href in the tag (html.zig:310-313). Main searched for href=, so it skipped past hreflang="de" to the real attribute. This head finds href inside hreflang (or inside a value such as title="href" or class="nav-href"), sees no = after it, and drops the whole link. For example, <a hreflang="de" href="https://b.org/de">de</a> gives the link on main and nothing on this head. Language-switcher links often carry hreflang, and a page can put its attributes in any order. Please keep looking past an href with no = after it, with a test that puts hreflang before href. This test fails on this head (expected 3, found 0) and passes once the search moves on to the next href:
test "a page link keeps its target when href is not the first href in the tag" {
    var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
    defer arena.deinit();
    const a = arena.allocator();
    const got = try hrefs(a, "<a hreflang=\"de\" href=\"https://b.org/de\">de</a> <a title=\"href\" href=\"/t\">t</a> <a class=\"nav-href\" href = \"/n\">n</a>", 10, null);
    try std.testing.expectEqual(@as(usize, 3), got.len);
    try std.testing.expectEqualStrings("https://b.org/de", got[0]);
    try std.testing.expectEqualStrings("/t", got[1]);
    try std.testing.expectEqualStrings("/n", got[2]);
}

A loop over std.ascii.findIgnoreCasePos(tag, at, "href") that moves at past each miss is enough. Everything else passes as it is: the CPU server tests run 1,338 tests with this one the only failure.

The CHANGELOG line is ours to add at landing.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Thanks @ppardus. e5b82c24b is the fix we asked for. hrefs now moves past an href with no = after it and keeps looking (zig/src/server/cortheon/html.zig:310-321). So hreflang, title="href" and class="nav-href" no longer hide the real attribute. The test at :499 covers all three. CI is green on this head, and it merges cleanly with main.

We'll add the CHANGELOG line and land it.

  • Synthena (Ash's Agent)

@ashhart
ashhart force-pushed the cortheon-link-whitespace branch from e5b82c2 to d2ea9b4 Compare November 13, 2026 11:36
@ashhart
ashhart merged commit cc0d6f1 into ashhart:main Nov 13, 2026
2 of 10 checks passed
@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Thank you @ppardus. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

ashhart added a commit to javierbits/TensorFold that referenced this pull request Nov 13, 2026
ashhart added a commit that referenced this pull request Nov 13, 2026
ashhart added a commit that referenced this pull request Nov 13, 2026
ashhart added a commit that referenced this pull request Nov 13, 2026
ashhart added a commit to Bizuayeu/TensorFold that referenced this pull request Nov 13, 2026
ashhart added a commit that referenced this pull request Nov 13, 2026
@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

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