Skip to content

fix(catalog): fewer false alarms on vendor skill repositories - #1657

Open
vchamarthi wants to merge 4 commits into
intel:mainfrom
vchamarthi:vendor-skill-scan
Open

vchamarthi wants to merge 4 commits into
intel:mainfrom
vchamarthi:vendor-skill-scan

Conversation

@vchamarthi

Copy link
Copy Markdown
Contributor

Dokimi's free catalog checks raise far fewer false alarms on real vendor skill repositories, and still catch the real problems.

Why

  • Dokimi's free checks (repo scan, repo inspect, repo budget, catalog check) were run on 14 public vendor skill repositories (NVIDIA, AMD, Anthropic, OpenAI, Google, Vercel, Cursor, Microsoft, Hugging Face, Cloudflare, Stripe, Supabase and others): 1,623 skill files, 84 commands, no model calls.
  • Each finding was judged by hand: 976 real, 943 false alarms, 107 unclear. Close to half of what the checks reported was noise, which buries the real findings.

What changes

  • Governance and benchmark documents, generated paths, TypeScript configs and command-only activation are no longer flagged as broken guidance.
  • Prohibited commands (do not run bare …), <placeholder>/ path notation, local archives and VCS sources (git+, hg+, svn+, bzr+) are no longer read as install instructions. A pattern a JSON eval forbids (not_contains_pattern) is comparison data, not a command (new module external/command_json.py).
  • python -I -c reading a piped download is an inline program, as python -c already was.
  • CI test runners (node --test, python -m unittest, a unittest script run by uv run) and runners declared in test modules (node:test, unittest.main()) are recognised (new module repos/environment/workflow_tests.py). They are read only when no other test check is declared.
  • Markdown link targets are checked when the label shows a path. A named sibling-skill input (the `engine` skill's `references/types.md`) is checked in that sibling, not in the current skill.
  • Skills with the same name in different packages keep separate evaluation counts.
  • The JavaScript lexer (pygments) is declared in packaging and the conda lock inputs.
  • Docs: external-content.md, repo-evaluation-contract.md, finding-codes.md, and a changelog fragment per change.

Evidence

Replaying the same files at the same vendor commits (measured on the branch at 4dcb4d341, before it was rebased onto current main; the rebase re-applied the install-reading changes on top of main's split of command_checks.py, with the same tests passing):

Before After
Flagged items 5,036 4,502

The unused-bundle-file rule alone accounts for 468 of the 534 fewer.

Real problems still found after the change: 30 broken links in Vercel's compiled guides, invalid YAML in a Cursor skill, a retired default model in Anthropic's MCP evaluator.

How to test

cd dokimi
python -m pytest -q tests/test_catalog_path_missing.py tests/test_catalog_links.py tests/test_catalog_command_checks_operands.py \
  tests/test_content_checks.py tests/test_code_spans.py tests/test_project_markers.py tests/test_repo_inspect_workflow_tests.py \
  tests/test_repo_l0_markdown_lines.py

Full suite, Linux, on this branch at current main:

Python Passed Failed Skipped
3.11 36,062 11 53
3.13 36,092 1 33
3.14 36,068 4 54

Every failure also fails, the same way, on unmodified main in the same environment (test_repo_compare_interval on all three; test_repo_typecheck_grader on 3.11 and 3.14; seven more on 3.11 only). make ci-local CI_LOCAL_ARGS='--offline': static, typecheck, docs, CLI surface, coverage of changed lines and changed-test repeats pass; its test job fails only on that same test_repo_compare_interval test.

Reproduce on any skill catalog checkout (free, no model calls):

dokimi repo scan <checkout>
dokimi repo inspect <checkout>
dokimi repo budget <checkout>
dokimi catalog check <checkout>

Mutation

scripts/mutate_changed.py --base origin/main with the cap raised to cover every changed line: 411 of 411 mutants, 394 killed, 0 survived, 17 waived. Each waiver is a # mutation-ok[<operator>]: <reason> on a line whose mutants cannot change behaviour (a fast path, a batch size, a guard on a lookup that always succeeds, zip(strict=True) over lists built from one source).

Open questions

None.

Revert

A plain revert. No stored records or schema versions change.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new test names the doc or contract it traces to (no new raise or exit)
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header

References

Governance and benchmark documents, generated paths, TypeScript configs
and command-only activation are no longer flagged as broken guidance.
Prohibited commands, path notation, archives and VCS sources are no
longer read as install instructions. CI test runners and runners declared
in test modules are recognised. Markdown link targets are checked when
the label shows a path, and named sibling-skill inputs resolve. Skills
with the same name in different packages keep separate evaluation
counts. The lexer is declared in packaging and the conda lock inputs.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Tests for sibling-skill ownership (name shape and length, folder with its
own SKILL.md, the owner phrase, bare files), a local path before a
sibling reference, parent spans, JSON sentence cuts and the JSON-only
negative-assertion exemption, VCS sources, JavaScript bindings in every
script kind, URL labels, blank code spans, project roots, and the CI and
test-module runner reader. Lines whose mutants cannot change behaviour
are marked mutation-ok with the reason.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi requested a review from a team as a code owner December 6, 2026 01:09
Copilot AI balanced review requested due to automatic review settings December 6, 2026 01:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active findings identify missed per-project test checks and false negatives in broken-link, model-ID, and unreferenced-file detection.

4 open issues
What changed in this PR

4 new findings.

This PR reduces false alarms in Dokimi’s free repository and skill-catalog checks while improving test-runner detection and evaluation counts.

Changes:

  • Refines command, Markdown, path, and content checks.
  • Recognizes TypeScript projects and standalone test runners; preserves counts for same-named skills.
  • Adds regression tests, documentation, changelog fragments, and the Pygments dependency.
File Description
dokimi/​tests/​test_repo_l0_markdown_lines.py Tests hypothetical path notation.
dokimi/​tests/​test_repo_inspect_workflow_tests.py Tests workflow and standalone runners.
dokimi/​tests/​test_repo_inspect_cli.py Tests TypeScript project detection.
dokimi/​tests/​test_project_markers.py Tests project roots and runner precedence.
dokimi/​tests/​test_description_when_cues.py Tests additional activation cues.
dokimi/​tests/​test_content_checks.py Tests variable and Unicode exemptions.
dokimi/​tests/​test_code_spans.py Tests path-like link labels.
dokimi/​tests/​test_catalog_path_missing.py Tests output and sibling-owned paths.
dokimi/​tests/​test_catalog_links.py Tests definitions and parent notation.
dokimi/​tests/​test_catalog_eval_cli.py Tests same-named skill counts.
dokimi/​tests/​test_catalog_command_prohibited.py Tests prohibited interactive commands.
dokimi/​tests/​test_catalog_command_checks_operands.py Tests command operand exemptions.
dokimi/​tests/​test_catalog_bundle_unreferenced.py Tests publication-document exclusions.
dokimi/​requirements.txt Adds Pygments.
dokimi/​pyproject.toml Declares Pygments dependency.
dokimi/​dokimi/​repos/​l0/​markdown.py Exempts hypothetical prefix examples.
dokimi/​dokimi/​repos/​environment/​workflow_tests.py Detects additional test runners.
dokimi/​dokimi/​repos/​environment/​checks.py Integrates runners and TypeScript projects.
dokimi/​dokimi/​external/​when_cues.py Expands activation recognition.
dokimi/​dokimi/​external/​validate.py Clarifies trigger warning.
dokimi/​dokimi/​external/​skill_markdown.py Refines definitions and descriptive labels.
dokimi/​dokimi/​external/​finding_lines.py Supports filtered source-line lookup.
dokimi/​dokimi/​external/​content_checks.py Refines model-ID and Unicode checks.
dokimi/​dokimi/​external/​command_words.py Handles placeholder path prefixes.
dokimi/​dokimi/​external/​command_json.py Excludes negative assertion patterns.
dokimi/​dokimi/​external/​command_checks.py Refines install and pipe detection.
dokimi/​dokimi/​external/​bundle_refs.py Excludes root publication paperwork.
dokimi/​dokimi/​external/​bundle_paths.py Resolves outputs and sibling references.
dokimi/​dokimi/​external/​bundle_findings.py Integrates filtered path checks.
dokimi/​dokimi/​commands/​catalog_eval.py Counts every skill path.
dokimi/​docs/​repo-evaluation-contract.md Documents paths and runner detection.
dokimi/​docs/​finding-codes.md Updates trigger-warning description.
dokimi/​docs/​external-content.md Documents revised catalog behavior.
dokimi/​changelog.d/​20261202_173000_catalog_negative_assertion_patterns.md Records assertion-pattern exemption.
dokimi/​changelog.d/​20261202_160800_sibling-files-standalone-runners.md Records sibling paths and runners.
dokimi/​changelog.d/​20261202_160000_inspect-workflow-test-runners.md Records workflow runner detection.
dokimi/​changelog.d/​20261202_160000_catalog_parent_relative_labels.md Records descriptive-label handling.
dokimi/​changelog.d/​20261202_155800_path-notation-pip-sources.md Records notation and source exemptions.
dokimi/​changelog.d/​20261202_150000_catalog-publication-reports.md Records publication exclusions.
dokimi/​changelog.d/​20261202_150000_catalog_output_paths.md Records output-path exemptions.
dokimi/​changelog.d/​20261202_144900_inspect-typescript-config.md Records TypeScript detection.
dokimi/​changelog.d/​20261202_143600_skill-content-checks.md Records content and counting fixes.
conda-recipe/​meta.yaml Adds Pygments dependency.
ci/​conda-lock/​linux-64-py3.14.txt Updates lock-input comment only.
ci/​conda-lock/​linux-64-py3.13.txt Updates lock-input comment only.
ci/​conda-lock/​linux-64-py3.12.txt Updates lock-input comment only.
ci/​conda-lock/​linux-64-py3.11.txt Updates lock-input comment only.

Review effort: Balanced

Comment thread dokimi/dokimi/external/bundle_refs.py Resolved
@codecov-commenter

codecov-commenter commented Dec 6, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 96.68367% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.43%. Comparing base (13715e4) to head (e5e7343).

Files with missing lines Patch % Lines
dokimi/dokimi/external/js_bindings.py 91.66% 4 Missing and 4 partials ⚠️
dokimi/dokimi/repos/environment/workflow_tests.py 97.29% 1 Missing and 2 partials ⚠️
dokimi/dokimi/external/bundle_paths.py 96.36% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1657      +/-   ##
==========================================
- Coverage   96.43%   96.43%   -0.01%     
==========================================
  Files         585      588       +3     
  Lines       76572    76880     +308     
  Branches    13174    13249      +75     
==========================================
+ Hits        73844    74136     +292     
- Misses       1674     1680       +6     
- Partials     1054     1064      +10     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/catalog_eval.py 98.97% <100.00%> (+0.01%) ⬆️
dokimi/dokimi/external/bundle_findings.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/bundle_refs.py 97.94% <100.00%> (+0.07%) ⬆️
dokimi/dokimi/external/command_checks.py 98.00% <100.00%> (+0.81%) ⬆️
dokimi/dokimi/external/command_json.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/command_words.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/content_checks.py 95.49% <100.00%> (+0.07%) ⬆️
dokimi/dokimi/external/finding_lines.py 96.92% <100.00%> (+0.04%) ⬆️
dokimi/dokimi/external/skill_markdown.py 97.80% <100.00%> (+0.05%) ⬆️
dokimi/dokimi/external/validate.py 98.76% <ø> (ø)
... and 6 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 6 of 80 small breaks of the lines this PR changes, and not every break was tried

At e5e7343: 72 caught · 6 missed · 2 waived

Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/external/js_bindings.py:11 drop-element {"var", "const", "let"} → {"const", "let"} 19
dokimi/dokimi/external/js_bindings.py:21 bump-int 0 → 1 3
dokimi/dokimi/external/js_bindings.py:28 delete-statement depth -= 1 → pass 3
dokimi/dokimi/external/js_bindings.py:29 flip-compare depth == 0 → depth != 0 3
dokimi/dokimi/external/js_bindings.py:35 drop-clause value == "," and default_at == depth → (default_at == depth) 3
dokimi/dokimi/external/js_bindings.py:37 drop-clause token in Name and default_at is None and (j + 1 >= len(sig) or sig[j + 1][2] != → (default_at is None and (j + 1 >= len(sig) or sig[j + 1][2] != ':')) 3

Not checked:

  • 563 more breaks of covered changed lines were over the limit and not tried
  • 33 changed lines were not mutated

Marked harmless with mutation-ok:

Where Operator Change Reason
dokimi/dokimi/external/bundle_paths.py:222 delete-statement continue → pass a fast path; an owner needs the word "skill" after it
dokimi/dokimi/external/bundle_paths.py:236 delete-statement pieces.append(" " * (path.end() - path.start())) → pass the blank only keeps the text's length; spans are read from text, not columns

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

@exai-bot

exai-bot commented Dec 6, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 5 issue(s) in this PR.

CI at e5e7343: 29 passing, 5 skipped.

By label: 1 must fix, 3 should fix, 1 not shown by a run

Label Location Finding
must fix bundle_paths.py:68 Impact: valid generated-output or absent-file guidance still produces false path-missing warnings when Markdown is wrapped.
should fix workflow_tests.py:128-130 Reject property calls even when whitespace follows the dot. Trigger: with no manifest/workflow test runner, put `const client = { req...
should fix js_bindings.py:51-55 Impact: valid JavaScript bindings still generate false legacy-model-id warnings.
should fix js_bindings.py:37-38 Impact: computed destructuring keys can silently suppress genuine legacy-model-id findings.
not shown by a run skill_markdown.py:501 Impact: catalog validation silently misses broken reference links with valid angle-bracketed destinations containing unmatched parent...
Test notes (1)
  • dokimi/dokimi/external/bundle_paths.py:228: With if any(a <= owner.start() < b or a <= path.start() < b for a, b in labels): changed to if any(a < owner.start() < b or a <= path.start() < b for a, b in labels):, the tests still pass: dokimi/tests/test_catalog_bundle_unreferenced.py, dokimi/tests/test_catalog_command_checks_operands.py, dokimi/tests/test_catalog_command_prohibited.py, dokimi/tests/test_catalog_eval_cli.py, dokimi/tests/test_catalog_links.py, dokimi/tests/test_catalog_path_missing.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
Review details
  • Commit reviewed: e5e7343 against merge base 13715e4
  • Coverage: 43 files in 6 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 2.28M tokens (1.57M from cache), 2m5s
  • Tool calls: 183 (118 file_read, 20 pr_threads, 17 code_search, 10 local_check_results, 9 file_read_diff, 5 file_find, 4 code_comment)
  • Skill content validation and Markdown interpretation: 9 files
  • Command parsing and negative assertion checks: 7 files
  • Catalog path resolution and bundled file references: 9 files
  • Catalog evaluation and publication reporting: 7 files
  • Repository inspection of TypeScript configuration and workflow test runners: 9 files
  • Repository Markdown line checks: 2 files

Comment thread dokimi/dokimi/external/bundle_paths.py Resolved
Comment thread dokimi/dokimi/external/bundle_paths.py Resolved
Comment thread dokimi/dokimi/repos/l0/markdown.py Resolved

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: CONTRACT (head 73791ea)

  • Contract: changed. errors dokimi/dokimi/external/command_json.py:46; errors dokimi/dokimi/repos/environment/workflow_tests.py:29
  • Responsibility: candidate. move _cut_sentences from dokimi/dokimi/external/command_checks.py to dokimi/dokimi/external/command_json.py
  • Dependency: candidate (count signal only, no file:line)
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

Existing blockers reproduced.

I reproduced the Markdown reference regression: the merge base returns the missing destination after ===== or --, and this head drops it. The multi-root test discovery finding also reproduces: two packages with standalone unittest checks yield only the first package. C3 and C4 remain open. This PR also conflicts with #1524 in content_checks.py when paired.

CI on head 73791ea: 0 failing Actions jobs; merge base 5225c2a is behind base tip 60948d0.

Checked the catalog and runner-discovery changes, the previous review threads, and required CI. Probes used local Markdown and test-runner fixtures. Vendor measurements were reviewed as recorded in the PR. Focused suite: 541 passed in 8.07s.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
- Read the owner and path of a sibling skill reference across a wrapped
  line, and skip a span in the label of a URL link.
- Treat every JS declarator and destructured name as a variable, and keep
  a property or key such as `models.o1` as a model-ID mention.
- Read a reference definition after a setext heading underline.
- Emit a standalone test check for each project root, not the first only.
- Skip a workflow whose YAML raises ValueError (an impossible date).
- Keep the path-notation back-reference case-sensitive.
- Ignore a fenced report heading when classifying BENCHMARK.md.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

@napetrov, this is ready for another look: 2 commits on vendor-skill-scan (73791ea..e5e7343) answers 4 of your comments.

Your comment:

  • Covered by the setext thread: a setext underline now ends the heading block.
  • Covered by the per-root thread: each project root now gets its own check.
  • grep -rn _cut_sentences dokimi finds it only at dokimi/external/command_json.py:11 and its use at line 53.
  • Merged main and resolved the conflict in content_checks.py, keeping both the joined-ID reading and the JS binding exemption.

Threads:

  • I answered each one in its thread: 10 fixed.

Not caused by this PR:

  • Fails on main too: 1 test in tests/test_repo_compare_interval.py; delta lo is -1.7e-07, not 0.0, in sign_flip_summary; fails on main as well.

What I checked on the new commit: all 8 new tests fail before the fix and pass after it; the full test suite passes with main merged in (62,372 tests), apart from 1 failure main has too.

What each test shows
  • a fenced report heading does not make BENCHMARK.md paperwork: fails before, passes after.
  • declarators, destructuring and properties: fails before, passes after.
  • setext heading before a definition: fails before, passes after.
  • one check per root: fails before, passes after.
  • URL label: fails before, passes after.
  • wrapped sibling reference: fails before, passes after.
  • ValueError from YAML: fails before, passes after.
  • case-sensitive back-reference: fails before, passes after.

return replace_code_spans(line, mask, not_after="\\")

# mutation-ok[take-branch]: a line without a backtick has no code span to mask; the test only skips the work
return "".join(mask_line(line) if "`" in line else line for line in text.splitlines(keepends=True))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · must fix
Impact: valid generated-output or absent-file guidance still produces false path-missing warnings when Markdown is wrapped.

Trigger: The runner emits\nresources/plan.json. (likewise This skill does not ship\nscripts/run.py.), with the named file absent.

Evidence: this function matches each physical line independently, _NON_INPUT permits only spaces/tabs before the span, and bundle_findings calls it before building the paragraph view; consequently neither line is masked and the normal missing-path check reports the output. Match cues and spans within Markdown paragraphs while retaining source newlines, and add wrapped-output/absent-file regression cases.

Workaround: keep the cue and path on the same physical line.

Must fix: A run shows it, this change introduced it, and it is met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c1.py

What the proof does: Calls mask_non_input_paths on a cue and a path split over two lines and checks the path is blanked.

The problem shows as the output WRAPPED_OUTPUT_NOT_MASKED.

dokimi/proof_c1.py

from dokimi.external.bundle_paths import mask_non_input_paths

same = mask_non_input_paths('The runner emits `resources/plan.json`.\n')
assert 'resources/plan.json' not in same, 'same-line control failed'
wrapped = mask_non_input_paths('The runner emits\n`resources/plan.json`.\n')
assert 'resources/plan.json' not in wrapped, 'WRAPPED_OUTPUT_NOT_MASKED'
Traceback (most recent call last):
  File "/tmp/tmp.eFQluhMLID/dokimi/proof_c1.py", line 6, in <module>
    assert 'resources/plan.json' not in wrapped, 'WRAPPED_OUTPUT_NOT_MASKED'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: WRAPPED_OUTPUT_NOT_MASKED

Comment on lines +37 to +38
elif token in Name and default_at is None and (j + 1 >= len(sig) or sig[j + 1][2] != ":"):
names.append(value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: computed destructuring keys can silently suppress genuine legacy-model-id findings.

Trigger: const {[o1]: value} = settings; consume(o1);, with no declaration of o1.

Evidence: this branch collects o1 because its next token is ], although only value is bound. js_bindings then exempts both bare o1 occurrences, and _legacy_hits reports neither, contrary to the declared-variable-only exemption.

Fix: Skip computed-key expressions while still collecting the binding target after the colon; add coverage contrasting computed object keys with nested array binding patterns.

Workaround: avoid computed destructuring in scanned examples or move the key expression outside the pattern.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c4.py

What the proof does: Calls js_bindings on a destructuring with a computed key and checks the undeclared o1 yields no exempt offsets.

The problem shows as the output COMPUTED_KEY_TREATED_AS_BINDING.

dokimi/proof_c4.py

import re
from dokimi.external.js_bindings import js_bindings

text = 'const {[o1]: value} = settings; consume(o1);'
ms = list(re.finditer(r'o1', text))
got = js_bindings('a.js', text, ms)
assert got == set(), 'COMPUTED_KEY_TREATED_AS_BINDING %r' % (got,)
Traceback (most recent call last):
  File "/tmp/tmp.NdvRDDBXzz/dokimi/proof_c4.py", line 7, in <module>
    assert got == set(), 'COMPUTED_KEY_TREATED_AS_BINDING %r' % (got,)
           ^^^^^^^^^^^^
AssertionError: COMPUTED_KEY_TREATED_AS_BINDING {8, 40}

Comment on lines +51 to +55
if value in (";", "of", "in"):
return True
previous = sig[j - 1]
return "\n" in text[previous[0] : start] and previous[2] not in (",", "=") and previous[1] not in Operator \
and value not in _OPEN + ".,"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: valid JavaScript bindings still generate false legacy-model-id warnings.

Trigger: const first = "x" in settings, o1 = first; consume(o1);.

Evidence: _statement_ends treats the initializer's binary in as a loop boundary, so _declarators stops before o1; _legacy_hits consequently reports it. Similarly, const first = 1\n + 2, o1 = first; stops at the leading continuation operator. These initializer-boundary cases are not covered by the existing simple multiple-declarator regression. Distinguish loop separators from initializer expressions and allow operator-led continuations, with regression tests for both.

Workaround: declare o1 in a separate statement.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c3.py

What the proof does: Calls js_bindings on a multi-declarator const whose first initializer uses in and checks both o1 offsets are declared bindings.

The problem shows as the output IN_OPERATOR_ENDS_DECLARATION.

dokimi/proof_c3.py

import re
from dokimi.external.js_bindings import js_bindings

text = 'const first = "x" in settings, o1 = first; consume(o1);'
ms = list(re.finditer(r'o1', text))
got = js_bindings('a.js', text, ms)
assert got == {m.start() for m in ms}, 'IN_OPERATOR_ENDS_DECLARATION %r' % (got,)
Traceback (most recent call last):
  File "/tmp/tmp.0gOrLlX723/dokimi/proof_c3.py", line 7, in <module>
    assert got == {m.start() for m in ms}, 'IN_OPERATOR_ENDS_DECLARATION %r' % (got,)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: IN_OPERATOR_ENDS_DECLARATION set()

labels = _merged(_external_labels(paragraph, masked, definitions))
definitions: dict[str, str] = {}
# mutation-ok[flip-bool]: both lists are built from ``paragraphs``, so the zips never see unequal lengths
block_targets = [_reference_definitions(p, m, definitions) for p, m in zip(paragraphs, maskeds, strict=True)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · not shown by a run
Impact: catalog validation silently misses broken reference links with valid angle-bracketed destinations containing unmatched parentheses.

Trigger: [guide]: <references/missing(1.md>\n\nRead [guide].

Evidence: block_targets now gets destinations exclusively from _reference_definitions, whose unconditional _balanced(m.group(2)) rejects this target; the previous splitter accepted it. CommonMark allows unmatched parentheses inside <...>, and the inline-link reader already handles that case.

Workaround: percent-encode the parenthesis or use an inline link. Skip the balance check for angle-bracketed destinations and add a reference-link regression test.

Not shown by a run: A check of this claim did not show the problem.

Comment on lines +128 to +130
return any(value in ("import", "require") and (token in Keyword or token in Name)
and _NODE_TEST_IMPORT.match(text, offset) is not None
for offset, token, value in JavascriptLexer().get_tokens_unprocessed(text))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Reject property calls even when whitespace follows the dot. Trigger: with no manifest/workflow test runner, put const client = { require: x => x }; client . require('node:test'); in client.test.js. Evidence: require is a name token and the regex's immediate lookbehind sees a space, so this qualifies despite never loading Node's test module. The existing negative test covers only obj.require(...). Impact: inspection declares node:test and suppresses checks.test.runner-unknown. Check the preceding significant token (including across whitespace/comments) before accepting a bare require, and add this negative regression. Workaround: spelling the call client.require(...) avoids the false declaration.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c2.py

What the proof does: Calls _node_test_script on a spaced property call of require and checks it is not accepted.

The problem shows as the output PROPERTY_REQUIRE_ACCEPTED.

dokimi/proof_c2.py

from dokimi.repos.environment.workflow_tests import _node_test_script

text = "const client = { require: x => x };\nclient . require('node:test');\n"
assert not _node_test_script(text), 'PROPERTY_REQUIRE_ACCEPTED'
Traceback (most recent call last):
  File "/tmp/tmp.mB7KihNT6U/dokimi/proof_c2.py", line 4, in <module>
    assert not _node_test_script(text), 'PROPERTY_REQUIRE_ACCEPTED'
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: PROPERTY_REQUIRE_ACCEPTED

This branch has not been deployed

No deployments
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.

5 participants