Skip to content

Instantly share code, notes, and snippets.

View davidfstr's full-sized avatar
⚙️
Happy coding!

David Foster davidfstr

⚙️
Happy coding!
View GitHub Profile
@davidfstr
davidfstr / create_universal2_wheels-BEFORE.py
Created August 2, 2025 11:45
download_universal2_wheels - Claude 4 AI draft (BEFORE) and human draft (AFTER)
#!/usr/bin/env python3
"""
Script to create universal2 wheels for ALL dependencies from poetry.lock
using uPip, so Poetry can install from a local wheelhouse only.
Uses 'poetry export' to properly handle platform markers and get only
the packages that would actually be installed on this platform.
"""
import subprocess
@davidfstr
davidfstr / verify_universal2-AFTER.sh
Created August 2, 2025 11:35
verify_universal2 - Claude 4 AI draft (BEFORE) and human draft (AFTER)
#!/bin/bash
# Verify that a macOS .app bundle contains all universal2 binaries.
#
# Usage: verify_universal2.sh <APP_PATH>
set -e
APP_PATH="$1"
APP_NAME=$(basename "$APP_PATH")

Untitled Projects - CR Feedback from Gemini 2.5 Pro 2025-07-22

#file:copilot-instructions.md

I have a draft implementation for a new Untitled Projects feature, described in this GH issue: davidfstr/Crystal-Web-Archiver#102

I would like you to code-review the draft implementation. The diff is in this file: #file:untitled_projects-complete.diff

This is an extremely large diff (6,760 lines), so it may be necessary to break the review process up into multiple steps (i.e. multiple conversational turns).

davidfstr: #file:copilot-instructions.md

I have a draft implementation for a new Untitled Projects feature, described in this GH issue: davidfstr/Crystal-Web-Archiver#102

I would like you to code-review the draft implementation. The diff is in this file: #file:untitled_projects-complete.diff

This is an extremely large diff (6,760 lines), so it may be necessary to break the review process up into multiple steps (i.e. multiple conversational turns).

Suggested review order of files, from highest level to lowest level:

  • (The GitHub issue) - Overall feature description

davidfstr: Run this command to see mypy errors: dockershell mypy

GitHub Copilot: The command dockershell mypy ran successfully and found 93 type errors in 38 files. Most errors are related to:

  • Returning str | None or str | bytes where only str is expected.
  • Using .split or in on variables that may be None.
  • Passing float to functions expecting int.
  • List comprehensions with mixed types.
  • Missing type annotations.

davidfstr: I'm existing an existing automated test - test_when_untitled_project_saved_then_becomes_clean_and_titled - to cover a new case (Ensure Project.save_as() saves/restores tasks correctly). The changes I've made so far are in the .diff file.

However when I run the test I see the output in test_output.txt. Notice the FIXME lines in the output which are print statements inserted for debugging purposes. Notice also the the assertion failure AssertionError: Expected self=<RootTask at 0x123493c80> to no longer be listening to completed child=<DownloadResourceTask for 'http://localhost:2798/_/https/xkcd.com/50/'>.

I want to understand why the assertion failure is happening. Then I want to fix whatever inconsistency or misunderstanding in the code is causing the failure.


GitHub Copilot: Let's break down the situation and the cause of the assertion failure:

Human: I accepted all your changes except for the _stop_scheduler changes starting at model.py line 1779.

I did not accept those changes because it looks like you accidentally tried to delete everything in model.py after line 1169. I suspect that your usual tools for editing code have difficulty editing very large files like model.py because it looks like you have to replay the entire file during edits, rather than editing only specific line ranges.

Please retry editing _stop_scheduler and related methods in model.py between lines 1779 and 1837. If you have the ability to edit only lines in a particular range, please use that capability. If not, please try your best with the tools you have.

Let me know what kind of editing tool you tried to use.


$ pipenv lock --verbose
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
using sources: [{'url': 'https://pypi.org/simple', 'verify_ssl': True, 'name': 'pypi'}]
Using pip: -i https://pypi.org/simple
ROUND 1
Current constraints:
ruamel.yaml==0.10.11 (from -r /var/folders/vm/nd6nhd948xj4ds001s76srj80000gn/T/pipenv-quepzcpu-requirements/pipenv-btnrwlic-constraints.txt (line 2))
def main():
fork_and_continue_in_child()
setup_reactor('AsyncioSelectorReactor')
run_server()
def setup_reactor(reactor_type):
if reactor_type == 'AsyncioSelectorReactor':
from twisted.internet import asyncioreactor
asyncioreactor.install()
elif reactor_type == 'SelectReactor':
$ python3 runtests.py mypy.test.testsemanal
PARALLEL 2
SUMMARY 3 tasks selected
passed 2, failed 1, pending 0; running 0
FAILURE #0 run unit-test mypy.test.testsemanal
Expected:
...
ImportFrom:1(mypy.typing, [TypedDict])