Skip to content

Run WPT lint on to-upstream WPTs - #3845

Merged
domenic merged 1 commit into
mainfrom
lint-upstream
Mar 23, 2025
Merged

Run WPT lint on to-upstream WPTs#3845
domenic merged 1 commit into
mainfrom
lint-upstream

Conversation

@domenic

@domenic domenic commented Mar 23, 2025

Copy link
Copy Markdown
Member

Closes #2264.

@domenic

domenic commented Mar 23, 2025

Copy link
Copy Markdown
Member Author

Implementation notes:

AI significantly sped up this task in several ways. I used Cursor, for a couple rounds set to auto but I switched to sonnet-3.5 quickly.

  • Cursor was helpful in tab-completing some of the simple code in run-tuwpt.js, where running the linter is an analogous process to running the manifest generator and so it was able to create the parallel code pretty easily. (Refactoring out the common variables and such nicely.)
  • When I needed to fix the lint errors in document-selectionchange.html, I didn't dare ask Cursor to just fix them immediately, because I suspected the context about setTimeout() vs. t.step_timeout() would be too much for it to know about. But, I edited about four key lines, and then told Cursor to do all the mechanical work of threading the t variable through to all call sites, and it did so quickly and flawlessly. That would have been quite tedious without AI.
  • When I got confusing error messages from the lint script due to some complexities around my directory setup, I switched Cursor to "ask" mode and asked it questions about the WPT project's lint.py file. It found the source of the error messages and had good suggestions on how to fix it. I had to explicitly tell it how to navigate to an imported Python module which seemed a bit lame, but whatever.
    • A particularly notable case here was where there was an error message being output that I couldn't find with Ctrl+F. I asked Cursor, which correctly realized that the format of the error message was coming from a git subprocess that the script was spawning, and it found the part of the code that spawned that subprocess.
  • When I decided eventually that the useless error message (reported at Confusing error message when linting outside of the WPT directory web-platform-tests/wpt#51534) should just be filtered from the output, I used Cursor agent mode to write the filtering function (spawnSyncFiltered). I gave it detailed instructions which it executed on very well, but its initial code was duplicative, with identical code branches for stdout and stderr. I prompted it to deduplicate, which it did with a helper function, but I told it that was just overkill and suggested looping over ["stdout", "stderr"]. It happily made that change, leading to the code we see here. (And it was amusingly pleased with itself, telling me how clean the new code was.)

Note that several times throughout this I got confused as to why Cursor couldn't "see" my current file, and it needed to be explicitly tagged as context. Toward the end I realized I'm probably supposed to start a new chat every time I want to do a new agent task, and indeed when I did that for the final task it properly auto-populated the context file.

@domenic
domenic merged commit 6a54485 into main Mar 23, 2025
@domenic
domenic deleted the lint-upstream branch March 23, 2025 07:28
@domenic domenic added the metr uplift A candidate for the METR Uplift experiment label Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metr uplift A candidate for the METR Uplift experiment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run WPT lint on to-upstream WPTs

1 participant