Repository navigation
fix(swift): classify private nested types correctly - #7518
ducanhnguyen223 wants to merge 399 commits into
Conversation
[Medium impact] The Swift fix appears safe to merge; the wider comparison has two non-blocking correctness issues. FindingsFix with agent prompt### Issue 1
src/domain/javascript/javascriptSemanticResources.ts:266-270
The new unary branch rejects `net.connect(-0)`, although `-0` is valid port `0`. It also rejects `net.connect(~4294967294.5)`, which evaluates to valid port `1`. These calls disappear from `resourceOperations`, so the graph loses their socket acquisitions and linked releases.
Check the value of the whole expression, or keep unsupported operators undecided, rather than rejecting every minus expression or fractional operand.
### Issue 2
website/worker.mjs:86-88
When Markdown is unavailable, this branch returns the HTML probe after its conditional and range headers were removed. This affects example pages and nonindexable translations, which do not receive generated Markdown. A matching `If-None-Match` returns `200` instead of `304`, and a failing `If-Match` returns `200` instead of `412`.
Fetch the HTML fallback using the original request so its conditions and range still apply.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe Swift fix skips private file discriminators before reading the nested type kind. Counted substitutions remain unclassified when their owner cannot be decoded.
The supplied comparison includes a large merge from Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Swift symbol"] --> B["Read module and declaration name"]
B --> C{"Private discriminator followed by LL?"}
C -->|Yes| D["Skip discriminator and LL"]
C -->|No| E["Read next marker"]
D --> E
E --> F{"Nominal kind decoded?"}
F -->|Yes| G["Use nested type category"]
F -->|No| H["Keep supported owner or explicit unknown"]
G --> I["CLI and MCP category filters"]
H --> I
Reviews (3) · Last reviewed commit: "Merge current main into private nested S..." · Reviewed by Greptile |
…7900) * fix(environment): attribute source file errors to caller fields * style(environment): format source admission tests
* fix(pe): reject surrogate code units in BMPString names * chore: preserve base browser imports --------- Co-authored-by: morluto <[email protected]>
…luto#7879) Field, MethodDef and MemberRef signature issues reported the invalid operand's offset inside its blob, while local signature issues in the same coverage array used artifact file offsets. Translate both through one helper that adds the blob's artifact base. Fixes morluto#7385
…orluto#7803) * fix(process): normalize descendants of slash-spelled directory roots A working directory or observation path ending in / or /. kept its trailing separator as the alias, so descendant paths never met the delimiter lookahead and stayed literal. Strip those spellings before building aliases and version the path normalization contract as v3. Fixes morluto#7584 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(process): normalize filesystem root descendants --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: morluto <[email protected]>
* fix(ghidra): omit duplicate load-image result * docs(mcp): describe load-image evidence projection
morluto#7773) * fix(javascript): match resource release methods to the acquired handle Every acquisition family admitted every release method, so `h.close()`, `h.destroy()` and `h.end()` each resolved as a complete release of whatever the binding held. Node exposes a different subset per acquisition, and the rejected pairs throw at the call site instead. Measured on Node 24.22.1: | acquisition | value | release members | | --- | --- | --- | | `fs.openSync` | number | none | | `fs.open` (callback) | undefined | none | | `fs.createReadStream` | ReadStream | `close`, `destroy` (`end` is the byte-offset field) | | `fs.createWriteStream` | WriteStream | `close`, `destroy`, `end` | | `fs/promises.open` | FileHandle | `close` | | `net.connect` | Socket | `destroy`, `end` | | `tls.connect` | TLSSocket | `destroy`, `end` | So `fs.openSync(...)` + `fd.close()`, `createReadStream(...)` + `.end()`, `net.connect(...)` + `.close()` and the FileHandle cases emitted a `releases` / `resolved` fact for a call that throws. Carry the specifier with each acquisition candidate, list the release methods each pair actually has, and emit no release when the pair is not one of them. A release stays `complete` only when the binding held exactly one acquisition and that acquisition admitted the method. `tls.createConnection` is not a Node export at all: `'createConnection' in require('node:tls')` is false and the ESM import does not link. Drop it from the table so a `tls.createConnection` call yields no acquisition. * chore: retrigger title and readiness checks after the title was corrected * fix(javascript): cover a mixed-family binding before completing a release greptile asked for the mixed-family case: a binding that can hold either a FileHandle or a socket, then calls close(). The FileHandle is the only linked acquisition and the release stays partial. That case also showed the `candidates.length === 1` guard was dead: an acquisition of another family is not in `linked`, so `holdsOnlyAcquisitions` already returns false for it and the release already stayed partial without the guard. Removing the guard and keeping the test means the behaviour is now pinned by a test rather than by two overlapping conditions.
…uto#7775) * test(firmware): exercise the staging ceiling through the emitted refusal The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green. Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both. * test(firmware): compare the emitted recovery with its owner The wiring test matched three phrases of the emitted remediation, so an ad-hoc or truncated action that kept those phrases would still pass while the emitted recovery had diverged from firmwareStagingBudgetRemediation. Assert exact equality with the owner's output for the selected value in both cases instead. Verified red: replacing the emitted action with a divergent sentence that keeps the ceiling phrases now fails both cases, where the phrase matching passed. * chore: retrigger title and readiness checks after the title was corrected * test(firmware): drive the staging ceiling through the request boundary greptile and codex both flagged that the ceiling tests called inventoryFirmwareOutput directly, so they would still pass if request parsing or the provider wiring dropped or replaced max_output_bytes. Add a request-level test that records the parsed request a provider receives: the caller's max_output_bytes arrives unchanged at the schema ceiling and below it, the documented default applies when omitted, and a budget above the schema maximum is rejected before the provider runs. That is the wiring the previous tests assumed rather than asserted.
…orluto#7956) Local file commands in the core binary, native, managed and native-tool CLI groups declared their positional target as a plain string. An empty argument therefore reached path admission, where it resolved to the working directory, as docs/cli.md says it never should. Declare those targets with the shared nonempty, NUL-free local path schema already used by analyze, so the CLI rejects them as a VALIDATION_ERROR naming the field before any analysis runner is called. Explicit "." is unchanged. Fixes morluto#7436 Fixes morluto#7404
* fix(native): retain selected Mach-O slice identity * fix(native)!: own Mach-O load commands in binary reader * fix(native): preserve malformed Mach-O and image base limits * fix(native): preserve leading BOM in Mach-O names * test(native): update Mach-O provenance verification * fix(native): retain completed Mach-O inspection on cleanup failure * fix: bound Mach-O projected section output * fix(native): own retained Mach-O command bytes * fix(native): retain Mach-O outcomes on final cancellation * fix(cli): preserve caller path in partial evidence * fix: reserve Mach-O projection envelope budget
* fix(pcap): retain producer contradiction diagnostics * test(pcap): align DNS fixture with empty captures
* fix(cli): prevent mcp discovery from registering clients * fix(cli): use shared output parsing for discovery errors
…#7947) * fix(pcap): validate selected resource limiter before capture * fix(pcap): verify limiter capabilities and preserve probe output
* fix(browser): deduplicate scenario coverage guidance * style(tests): fix CI formatting
…#7914) * fix(javascript): preserve uncertain with-scope member writes * fix: retain nested initializer candidates * fix(javascript): admit initializer values in worker transport * fix(tests): remove duplicate MCP test imports
…#7911) * fix(javascript): preserve uncertainty for unexamined sources * fix(javascript): compare observed package parsing status
* fix(cli): preserve caller paths in format inspections * fix(cli): retain caller path on partial evidence * test(cli): preserve caller path in adapter parity checks * test(rust): account for retained caller path * fix(wasm): compare shared cli and mcp evidence
fix(uninstall): preserve inactive ZCode fallback servers
* fix(uninstall): preflight layered OpenCode fallback * fix(uninstall): preserve inherited foreign registration facts * fix(uninstall): preflight legacy OpenCode layer removal
…8009) Retain detected manual connectors and explicit selection while excluding unsupported formats from automatic setup readiness. Fixes morluto#7522.
…#8672) * fix(verification): compare retained Ghidra function evidence * test(verification): require the exact missing Evidence refusal
…luto#7232) * fix(flutter): read unlabeled Dart Version::String() from engines Release libflutter.so embeds Dart's Version::String() without the standalone VM's "Dart VM version:" label, so identify_flutter_build left dart_version null on real APKs. Accept that channel-bearing form beside the labeled scanner path. * fix(flutter): qualify unlabeled version candidates --------- Co-authored-by: morluto <[email protected]>
…7673) Preserve the twenty-entry diagnostic prefix and report the full count, omitted count and truncation fact at the owning report projection. Document the recovery limitation and cover the public HAR-to-comparison workflow. Fixes morluto#7621 Validation: 121 source tests; three selected CLI regressions (five other cases unselected); nine README conformance cases; full --noEmit typecheck; documentation facts/metadata/schema/licenses; module boundaries and architecture guards. VitePress rendering is blocked by Windows EPERM on its worktree-local Vue symlink. Full aggregate coverage remains for Draft CI. Independent code review: APPROVE, relayed by parent task 01a17716-6299-75fe-87e9-b0398b8c9019. Trigger: >=50 changed lines / >=3 files. Reviewed tree: ba964ef Reviewed full-index patch SHA256: 972dcfc219dd7b9606175b1848068f92210fa3f7d0a8a244c1ac7ce296ae32d9
…luto#7667) * fix(reference): Exclude Git pointer files from source identities Match .git pointer files in the default import policy after the existing directory rules, preserving ordinary-checkout exclusion provenance and Git HEAD discovery. Cover linked-worktree identities, repeated imports, nested metadata, similarly named source files, and configured-secret precedence. Independent review: parent independent review APPROVE for Draft CI on patch 61bddf108952c77858fa71c333b4bb8a05ab33e8b03f5c6bccd879cd19c7c379 and source tree 2d2372a. Review triggers: delegated shipping output, source inventory/file I/O behavior, and more than 50 lines. Validation: npm run check passed with Node 24.22.1/npm 11.16.0 on Windows; tracked Vitest regression 1 passed/3 Windows skips; test discovery passed. Eight offline Linux production imports passed on cached Node 22.19.0 as supporting evidence only. Pinned Linux/macOS Vitest cases await hosted CI. Fixes morluto#7551 * test(reference): Isolate worktree fixtures from host Git settings Route every fixture Git command through one wrapper with a filtered child environment, owned empty global config/template/hook paths, and no system config reads. Keep resource cleanup under the existing temporary owner. These settings are scoped to synthetic child processes; host Git settings and this repository's commit/push checks are unchanged. Targeted independent review: parent review APPROVE on patch 4be9a2af3e40edac3d64f687170e966a87fcf762f1877f2c55016e120bcd90ac and tree a2ba91e. The reviewer confirmed the native proof helper hash, complete fixture command coverage, and owned cleanup. Review triggers: delegated follow-up and fixture file/process boundaries. Validation: npm run check:fast passed; targeted Vitest 1 passed/3 native Windows skips. On pinned Node 24.22.1, the actual helper rejects inherited hooks/templates while commit, worktree creation, HEAD and status checks pass. The unisolated control copies the injected template and its commit fails. Refs morluto#7551
* fix(browser): keep negative script columns Chrome reports Chrome reported a Debugger.scriptParsed event with startColumn -60 and endColumn -15 for an inline script in WordPress's helper frame. CDP declares these columns as plain integers, but REA's admission required min(0), so one script failed the whole observe-web-execution run with unreadable_output. CDP resource columns now share one representation, cdpResourceColumnSchema, for script start/end columns, initiator call frames, parser initiators and event listeners. Positions on a script's first line include its start column, so keeping the reported values keeps the documented script-relative conversion consistent. The domain contract and web runtime docs state that a negative column does not locate a column in the resource. Fixes morluto#8674 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(browser): apply the CDP column policy to passive capture inspect_web_page and discover_webmcp_tools still read CDP columns through cdpSourceCoordinates, whose own >= 0 check turned a negative column into null and reported invalid_protocol_value. WebMCP discovery also dropped the tool's whole registration_source. cdpResourceColumnSchema now lives with the domain's CDP observation schemas. Runtime admission, the passive coordinate helper and the runtime, console, initiator and WebMCP output schemas all use it. Lines keep their non-negative rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Place the Join us on Discord button under each hero's website, guides, and showcases line. The invite and alt text stay the same.
|
I tested this PR at
The PR's tree is 386 commits behind
No symbol changes from right to wrong. Ten symbols change from right to unclassified. All of them contain an The branch currently conflicts with |
* fix(objdump)!: preserve unknown executable identity * fix(objdump): avoid claiming rejected architecture output * fix(objdump): align launch errors with command identity * test(objdump): avoid coupling identity checks to wording * test(objdump): align launch failure expectations
| if (t.isUnaryExpression(value)) { | ||
| const operand = unwrapJavaScriptExpression(value.argument).node; | ||
| return ( | ||
| t.isNumericLiteral(operand) && | ||
| (value.operator === "-" || !Number.isInteger(operand.value)) |
There was a problem hiding this comment.
The new unary branch rejects net.connect(-0), although -0 is valid port 0. It also rejects net.connect(~4294967294.5), which evaluates to valid port 1. These calls disappear from resourceOperations, so the graph loses their socket acquisitions and linked releases.
Check the value of the whole expression, or keep unsupported operators undecided, rather than rejecting every minus expression or fractional operand.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptSemanticResources.ts
Line: 266-270
Comment:
**Valid sockets disappear**
The new unary branch rejects `net.connect(-0)`, although `-0` is valid port `0`. It also rejects `net.connect(~4294967294.5)`, which evaluates to valid port `1`. These calls disappear from `resourceOperations`, so the graph loses their socket acquisitions and linked releases.
Check the value of the whole expression, or keep unsupported operators undecided, rather than rejecting every minus expression or fractional operand.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (!candidate.ok && ![304, 412, 416].includes(candidate.status)) { | ||
| await candidate.body?.cancel(); | ||
| return original; |
There was a problem hiding this comment.
HTML fallback ignores conditions
When Markdown is unavailable, this branch returns the HTML probe after its conditional and range headers were removed. This affects example pages and nonindexable translations, which do not receive generated Markdown. A matching If-None-Match returns 200 instead of 304, and a failing If-Match returns 200 instead of 412.
Fetch the HTML fallback using the original request so its conditions and range still apply.
Prompt To Fix With AI
This is a comment left during a code review.
Path: website/worker.mjs
Line: 86-88
Comment:
**HTML fallback ignores conditions**
When Markdown is unavailable, this branch returns the HTML probe after its conditional and range headers were removed. This affects example pages and nonindexable translations, which do not receive generated Markdown. A matching `If-None-Match` returns `200` instead of `304`, and a failing `If-Match` returns `200` instead of `412`.
Fetch the HTML fallback using the original request so its conditions and range still apply.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
TL;DR: I ran the 2 changed test files on head ea5d5f6 under three Node versions. All 33 tests passed each time. The FindingsI ran head ea5d5f6 in a VM on the 2 changed test files,
The head is 320 commits behind main 559083b. GitHub shows the PR as mergeable true, state blocked, and a draft. These workflow runs finished with The check runs No test jobs ( Not run
Test setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/symbolAnalysis.test.ts tests/boundary/mcp/enhancedTools.swiftTypes.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
|
Thank you for the Swift private-nested-type work on #7501. The current branch isn't reviewable: the diff is 2,655 files and about 399 commits, and it includes |
Summary
Fixes #7501. Classify private nested Swift type members using the nested nominal kind after the file discriminator, rather than inheriting the enclosing type's category.
Problem and expected behavior
Swift private nested declarations can include a file discriminator such as
33_<hash>LLbetween the nested type name and its nominal marker. The classifier was interpreting the discriminator length as a type marker. As a result, members of a private nested enum, struct, or class could be reported under the enclosing type's category. The private-method control case should remain under its enclosing class.Change and scope
The domain classifier now skips the discriminator identifier and
LLbefore reading the nominal marker when present. Added a Swift conformance fixture covering a private nested enum, struct, and class plus a private method control, domain and MCP boundary regressions, and checks in the optional real-Ghidra Swift verifier.Contract and boundary impact
classifySwiftSymbolin the domain layer, before CLI/MCP projection. No source evidence model changes.analyze_swift_typesoperation; schemas and catalog are unchanged.Expected effects:
The optional verifier launches the local Ghidra/MCP analysis workflow and reads the compiled source-owned fixture; it does not execute or modify the fixture.
Evidence and regression coverage
nm: State 17/17 enums, Item 4/4 structs, Hidden 6/6 classes, and the private-method control 1/1 classes.analyzeHeadless/ghidraRunare unavailable; JDK 21 is installed.Validation performed
fnm exec --using=24.22.1 -- npm run test:local -- src/domain/symbolAnalysis.test.ts— 22/22 passed.fnm exec --using=24.22.1 -- npm run test:focused -- tests/boundary/mcp/enhancedTools.swiftTypes.test.ts— 11/11 passed.fnm exec --using=24.22.1 -- npm run check:fast— typecheck and lint passed.nmsymbol classification — all four expected categories verified as listed above.Compatibility, safety, and release
Related counted substitution follow-up
A Swift 6.2.3 constrained extension produced
A2Asubstitution contexts that the existingAAguard missed, allowing the enclosing class category to be reported for a nested enum member. Counted substitutions now remain unclassified until their context can be decoded; no nominal category is inferred. The original private-discriminator change remains intact.Validation: the domain suite passed 22 tests, the built MCP boundary suite passed 11 tests, and
check:fast, formatting andgit diff --checkpassed. The mangled fixture names were verified from a locally compiled Swift 6.2.3 library. Real Ghidra and other Swift versions were not tested for this follow-up.Author readiness
Human owner:
Before merge
type(scope): outcome.