Repository navigation
Propagate the docstring gate entry guard fix so an unresolvable entry cannot pass the gate #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7828521
fix(docstring-gate): propagate an unresolvable entry instead of skipp…
unbraind 0bc2477
fix(gate): canonicalize both paths so a runtime flag cannot skip the …
unbraind 9649c73
test(gate): pin the canonicalization with a case the old comparison f…
unbraind 18ddd25
docs(gate): do not claim a fixed syscall count for the extra resolution
unbraind 1f83a7b
refactor(gate): drop the import left unused by the two-sided comparison
unbraind 7992d51
test(gate): drop a cross-reference to a test this file does not have
unbraind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| {"ts":"2026-08-10T05:53:22.197Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"create","patch":[{"op":"add","path":"/metadata/id","value":"pm-github-wb4q"},{"op":"add","path":"/metadata/title","value":"Propagate the docstring gate entry guard fix"},{"op":"add","path":"/metadata/description","value":"The isMainInvocation guard caught realpathSync errors and returned false, causing npm run docstring to exit 0 having scanned nothing — a mandatory release gate reporting success without doing its job. The guard now propagates the error so a broken environment fails loudly instead of silently passing the gate."},{"op":"add","path":"/metadata/type","value":"Issue"},{"op":"add","path":"/metadata/status","value":"open"},{"op":"add","path":"/metadata/priority","value":2},{"op":"add","path":"/metadata/tags","value":["docstrings","gate"]},{"op":"add","path":"/metadata/created_at","value":"2026-08-10T05:53:22.197Z"},{"op":"add","path":"/metadata/updated_at","value":"2026-08-10T05:53:22.197Z"},{"op":"add","path":"/metadata/author","value":"pi-agent"}],"before_hash":"3cc22dff72be7b14824654a7a64ea62b04799939b2fee54c1b5f52ca60bf6df0","after_hash":"3b4a129ab17ce32fba14a15db02676d081d6db922aeb740949056f7d428207ca","message":""} | ||
| {"ts":"2026-08-10T05:53:25.011Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"note_add","patch":[{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T05:53:25.011Z"},{"op":"add","path":"/metadata/notes","value":[{"created_at":"2026-08-10T05:53:25.011Z","author":"pi-agent","text":"The isMainInvocation function in scripts/docstring-gate.ts wrapped realpathSync in a try/catch that returned false on ENOENT. When argv[1] could not be resolved, the top-level selector called the no-op placeholder instead of main, so npm run docstring exited 0 having scanned nothing. A required release check reported success without doing its job. The corrected implementation propagates the realpathSync error: a broken environment must not silently satisfy a gate."}]}],"before_hash":"3b4a129ab17ce32fba14a15db02676d081d6db922aeb740949056f7d428207ca","after_hash":"4a5d9d1e7a163fa42883a5b5430a0effb5e995fa19a7ec497e499f16a16aaff4"} | ||
| {"ts":"2026-08-10T05:53:28.150Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"comment_add","patch":[{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T05:53:28.150Z"},{"op":"add","path":"/metadata/comments","value":[{"created_at":"2026-08-10T05:53:28.150Z","author":"pi-agent","text":"Verified: node --experimental-strip-types -e with an unresolvable argv[1] now throws ENOENT instead of returning false. The gate fails loudly."}]}],"before_hash":"4a5d9d1e7a163fa42883a5b5430a0effb5e995fa19a7ec497e499f16a16aaff4","after_hash":"406c4c1b68a25f9dd96ad864e292e911d1a8f3afe9ad625bcde33ed6ef19a161"} | ||
| {"ts":"2026-08-10T05:53:28.694Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"files_add","patch":[{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T05:53:28.694Z"},{"op":"add","path":"/metadata/files","value":[{"path":"scripts/docstring-gate.ts","scope":"project"}]}],"before_hash":"406c4c1b68a25f9dd96ad864e292e911d1a8f3afe9ad625bcde33ed6ef19a161","after_hash":"772b1cced4d577af1270e47b6682715476c30da4d6a3364a4f9e68db7cdd918a"} | ||
| {"ts":"2026-08-10T05:53:29.231Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"files_add","patch":[{"op":"add","path":"/metadata/files/1","value":{"path":"test/docstring-gate.test.ts","scope":"project"}},{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T05:53:29.231Z"}],"before_hash":"772b1cced4d577af1270e47b6682715476c30da4d6a3364a4f9e68db7cdd918a","after_hash":"255dd7333a675d613c172ecbba4199926ffecfcd9d14ed340c03364565049eae"} | ||
| {"ts":"2026-08-10T05:53:31.847Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"07e97aa365b211e55b7745cd","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"close","patch":[{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T05:53:31.847Z"},{"op":"replace","path":"/metadata/status","value":"closed"},{"op":"add","path":"/metadata/closed_at","value":"2026-08-10T05:53:31.831Z"},{"op":"add","path":"/metadata/completed_at","value":"2026-08-10T05:53:31.831Z"},{"op":"add","path":"/metadata/resolution","value":"isMainInvocation propagates realpathSync errors instead of catching them and returning false"},{"op":"add","path":"/metadata/expected_result","value":"npm run docstring with an unresolvable argv[1] throws ENOENT and exits non-zero"},{"op":"add","path":"/metadata/actual_result","value":"npm run docstring with an unresolvable argv[1] previously exited 0 having scanned nothing"},{"op":"add","path":"/metadata/close_reason","value":"fixed"}],"before_hash":"255dd7333a675d613c172ecbba4199926ffecfcd9d14ed340c03364565049eae","after_hash":"4420083076a9c9d945f70124062a52b71d59591a68bcb4a1c412809feff5834e"} | ||
| {"ts":"2026-08-10T06:31:01.671Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"7525f7064349b35d9826cadf","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"note_add","patch":[{"op":"add","path":"/metadata/notes/1","value":{"created_at":"2026-08-10T06:31:01.671Z","author":"pi-agent","text":"Greptile (P2 on pm-beads) and CodeRabbit (Major on pm-slack) independently flagged the one-sided comparison in isMainInvocation: pathToFileURL(realpathSync(entry)).href === moduleUrl resolves only argv[1], leaving moduleUrl holding the symlink under --preserve-symlinks. Canonicalising both sides through realpathSync fixes it. Verified by measurement: with moduleUrl holding the symlink path, both-sides (new) returns true while one-sided (old) returns false."}},{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T06:31:01.671Z"}],"before_hash":"4420083076a9c9d945f70124062a52b71d59591a68bcb4a1c412809feff5834e","after_hash":"6d0e30e9f5a61f6cc2e420a7c0ab3685a582da62c6c265360f001c9f441989bd"} | ||
| {"ts":"2026-08-10T07:08:43.529Z","author":"pi-agent","author_source":"asserted","agent_harness":"pi","agent_model":"glm-5.2:cloud","agent_model_source":"environment","agent_instance":"1684e74de48dd9cf0e628b6d","agent_provenance":{"model":{"value":"glm-5.2:cloud","source":"environment"},"effort":null,"role":null,"topic":null},"op":"note_add","patch":[{"op":"add","path":"/metadata/notes/2","value":{"created_at":"2026-08-10T07:08:43.529Z","author":"pi-agent","text":"The previous test (isMainInvocation resolves matching and non-matching scripts) did not use symlinks at all, so it could not distinguish the fixed implementation from the broken one. Added a new test (canonicalizes a symlinked moduleUrl, as --preserve-symlinks produces) that puts the symlink in moduleUrl (pathToFileURL(link).href), which is what Node records in import.meta.url under --preserve-symlinks. Verified by measurement: reverting to the old one-sided comparison makes the new test fail (fail 1), restoring the canonicalization makes it pass (fail 0)."}},{"op":"replace","path":"/metadata/updated_at","value":"2026-08-10T07:08:43.529Z"}],"before_hash":"6d0e30e9f5a61f6cc2e420a7c0ab3685a582da62c6c265360f001c9f441989bd","after_hash":"fd43aeb95b4c42c1cd383665f3540613408c2a72ee07b884cf762645b296c485"} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| id: pm-github-wb4q | ||
| title: Propagate the docstring gate entry guard fix | ||
| description: "The isMainInvocation guard caught realpathSync errors and returned false, causing npm run docstring to exit 0 having scanned nothing — a mandatory release gate reporting success without doing its job. The guard now propagates the error so a broken environment fails loudly instead of silently passing the gate." | ||
| type: Issue | ||
| status: closed | ||
| priority: 2 | ||
| tags[2]: docstrings,gate | ||
| created_at: "2026-08-10T05:53:22.197Z" | ||
| updated_at: "2026-08-10T07:08:43.529Z" | ||
| closed_at: "2026-08-10T05:53:31.831Z" | ||
| completed_at: "2026-08-10T05:53:31.831Z" | ||
| author: pi-agent | ||
| resolution: isMainInvocation propagates realpathSync errors instead of catching them and returning false | ||
| expected_result: "npm run docstring with an unresolvable argv[1] throws ENOENT and exits non-zero" | ||
| actual_result: "npm run docstring with an unresolvable argv[1] previously exited 0 having scanned nothing" | ||
| comments[1]{created_at,author,text}: | ||
| "2026-08-10T05:53:28.150Z",pi-agent,"Verified: node --experimental-strip-types -e with an unresolvable argv[1] now throws ENOENT instead of returning false. The gate fails loudly." | ||
| notes[3]{created_at,author,text}: | ||
| "2026-08-10T05:53:25.011Z",pi-agent,"The isMainInvocation function in scripts/docstring-gate.ts wrapped realpathSync in a try/catch that returned false on ENOENT. When argv[1] could not be resolved, the top-level selector called the no-op placeholder instead of main, so npm run docstring exited 0 having scanned nothing. A required release check reported success without doing its job. The corrected implementation propagates the realpathSync error: a broken environment must not silently satisfy a gate." | ||
| "2026-08-10T06:31:01.671Z",pi-agent,"Greptile (P2 on pm-beads) and CodeRabbit (Major on pm-slack) independently flagged the one-sided comparison in isMainInvocation: pathToFileURL(realpathSync(entry)).href === moduleUrl resolves only argv[1], leaving moduleUrl holding the symlink under --preserve-symlinks. Canonicalising both sides through realpathSync fixes it. Verified by measurement: with moduleUrl holding the symlink path, both-sides (new) returns true while one-sided (old) returns false." | ||
| "2026-08-10T07:08:43.529Z",pi-agent,"The previous test (isMainInvocation resolves matching and non-matching scripts) did not use symlinks at all, so it could not distinguish the fixed implementation from the broken one. Added a new test (canonicalizes a symlinked moduleUrl, as --preserve-symlinks produces) that puts the symlink in moduleUrl (pathToFileURL(link).href), which is what Node records in import.meta.url under --preserve-symlinks. Verified by measurement: reverting to the old one-sided comparison makes the new test fail (fail 1), restoring the canonicalization makes it pass (fail 0)." | ||
| files[2]{path,scope}: | ||
| scripts/docstring-gate.ts,project | ||
| test/docstring-gate.test.ts,project | ||
| close_reason: fixed | ||
| body: "" |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.