@@ -14781,6 +14781,7 @@ static const char *const py_reexport_calls[][2] = {
1478114781 {"ctl_from_cls", "direct.impl.Direct"},
1478214782 {"ctl_from_fn", "direct.impl.direct_fn"},
1478314783 {"lazy_tc", "lz.lazy_mod.Lazy"},
14784+ {"doc_reexport", "docp.impl.Doc"},
1478414785};
1478514786enum { PY_REEXPORT_N_CALLS = sizeof(py_reexport_calls) / sizeof(py_reexport_calls[0]) };
1478614787
@@ -14790,7 +14791,7 @@ enum { PY_REEXPORT_N_CALLS = sizeof(py_reexport_calls) / sizeof(py_reexport_call
1479014791static const char *const py_reexport_excluded[][2] = {
1479114792 {"excl_unlisted", "pkg.all_mod.Unlisted"}, {"excl_private", "pkg.star_mod._private_fn"},
1479214793 {"excl_shadowed", "shad.impl.Gone"}, {"excl_barrier", "barr.impl.Before"},
14793- {"excl_compat", "cmp.types_only.Shim"},
14794+ {"excl_compat", "cmp.types_only.Shim"}, {"excl_fstring", "fsp.impl.Kept"},
1479414795};
1479514796enum { PY_REEXPORT_N_EXCLUDED = sizeof(py_reexport_excluded) / sizeof(py_reexport_excluded[0]) };
1479614797
@@ -14850,13 +14851,28 @@ static int py_reexport_run(bool parallel, bool incremental, bool *lsp, bool *exc
1485014851 " except ImportError:\n Shim = None\n");
1485114852 write_temp_file(tmp, "app/cmp/types_only.py", "class Shim:\n pass\n");
1485214853 write_temp_file(tmp, "app/cmp/runtime_impl.py", "class Shim:\n pass\n");
14854+ /* The sql/expression.py shape of sqlalchemy: docstrings and a __future__
14855+ * import around the re-exports; an f-string with a field stays a barrier. */
14856+ write_temp_file(tmp, "app/docp/__init__.py",
14857+ "\"\"\"Package docstring.\"\"\"\n"
14858+ "from __future__ import annotations\n"
14859+ "from .impl import Doc\n"
14860+ "alias = Doc\n"
14861+ "\"\"\"Attribute docstring.\"\"\"\n");
14862+ write_temp_file(tmp, "app/docp/impl.py", "class Doc:\n pass\n");
14863+ write_temp_file(tmp, "app/fsp/__init__.py",
14864+ "from .impl import Kept\n"
14865+ "f\"{Kept}\"\n");
14866+ write_temp_file(tmp, "app/fsp/impl.py", "class Kept:\n pass\n");
1485314867 write_temp_file(tmp, "app/main.py",
1485414868 "from app import pkg\n"
1485514869 "from app import cyc\n"
1485614870 "from app import shad\n"
1485714871 "from app import barr\n"
1485814872 "from app import lz\n"
1485914873 "from app import cmp\n"
14874+ "from app import docp\n"
14875+ "from app import fsp\n"
1486014876 "from app.db import models\n"
1486114877 "from app.pkg import Explicit, Listed, Deep, star_fn, Renamed\n"
1486214878 "from app.direct.impl import Direct, direct_fn\n\n\n"
@@ -14882,6 +14898,8 @@ static int py_reexport_run(bool parallel, bool incremental, bool *lsp, bool *exc
1488214898 "def excl_barrier():\n barr.Before()\n\n\n"
1488314899 "def excl_compat():\n cmp.Shim()\n\n\n"
1488414900 "def lazy_tc():\n lz.Lazy()\n\n\n"
14901+ "def doc_reexport():\n docp.Doc()\n\n\n"
14902+ "def excl_fstring():\n fsp.Kept()\n\n\n"
1488514903 "def ctl_from_cls():\n Direct()\n\n\n"
1488614904 "def ctl_from_fn():\n direct_fn()\n");
1488714905 for (int i = 0; parallel && i < 52; i++) {
@@ -23616,26 +23634,32 @@ TEST(pipeline_python_namespace_codec_owns_ordered_facts) {
2361623634}
2361723635
2361823636TEST(pipeline_python_namespace_codec_rejects_non_authoritative_rows) {
23619- /* Numeric values below are the frozen version-1 namespace wire values.
23620- * Even an empty LSP array must validate its namespace envelope. */
23637+ /* Numeric values below are the frozen namespace wire values (version 2
23638+ * changed which statements extraction proves harmless, not the wire
23639+ * shape). Even an empty LSP array must validate its namespace envelope,
23640+ * and a payload of an older facts version is no authority: its facts
23641+ * were extracted under other rules, so the incremental run that reads
23642+ * it re-extracts in full. */
2362123643 const char *bad[] = {
2362223644 "{\"v\":1,\"lsp\":[]}",
2362323645 "{\"v\":3,\"lang\":1,\"lsp\":[]}",
2362423646 "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":null}",
2362523647 "{\"v\":3,\"lang\":1.0,\"lsp\":[],\"py\":null}",
2362623648 "{\"v\":3,\"v\":3,\"lang\":0,\"lsp\":[],\"py\":null}",
23627- "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":1 ,\"lang\":1,"
23649+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":2 ,\"lang\":1,"
2362823650 "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":3,\"failure\":2,\"events\":[]}}",
23651+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":1,\"lang\":1,"
23652+ "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":2,\"failure\":0,\"events\":[]}}",
2362923653 "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":99,\"lang\":1,"
2363023654 "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":2,\"failure\":0,\"events\":[]}}",
23631- "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":1 ,\"lang\":1,"
23655+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":2 ,\"lang\":1,"
2363223656 "\"module\":\"p.m\",\"path\":\"m.py\\u0000suffix\",\"status\":2,"
2363323657 "\"failure\":0,\"events\":[]}}",
23634- "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":1 ,\"lang\":1,"
23658+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":2 ,\"lang\":1,"
2363523659 "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":2,\"failure\":0,\"events\":["
2363623660 "{\"k\":999,\"d\":0,\"s\":0,\"r\":0,\"f\":0,\"l\":0,"
2363723661 "\"n\":null,\"m\":null,\"i\":null,\"a\":[]}]}}",
23638- "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":1 ,\"lang\":1,"
23662+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"py\":{\"v\":2 ,\"lang\":1,"
2363923663 "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":2,\"failure\":0,\"events\":["
2364023664 "{\"k\":8,\"d\":0,\"s\":1,\"r\":0,\"f\":0,\"l\":4294967296,"
2364123665 "\"n\":null,\"m\":null,\"i\":null,\"a\":[]}]}}",
@@ -23655,7 +23679,7 @@ TEST(pipeline_python_namespace_codec_rejects_non_authoritative_rows) {
2365523679 cbm_arena_destroy(&arena);
2365623680 }
2365723681 const char *unknown =
23658- "{\"v\":3,\"lang\":1,\"lsp\":[],\"reg\":[],\"py\":{\"v\":1 ,\"lang\":1,"
23682+ "{\"v\":3,\"lang\":1,\"lsp\":[],\"reg\":[],\"py\":{\"v\":2 ,\"lang\":1,"
2365923683 "\"module\":\"p.m\",\"path\":\"m.py\",\"status\":2,\"failure\":0,\"events\":["
2366023684 "{\"k\":7,\"d\":0,\"s\":0,\"r\":7,\"f\":0,\"l\":0,"
2366123685 "\"n\":null,\"m\":null,\"i\":null,\"a\":[]}]}}";
@@ -23668,6 +23692,7 @@ TEST(pipeline_python_namespace_codec_rejects_non_authoritative_rows) {
2366823692 facts.facts.items[0].kind == CBM_PY_NS_UNKNOWN &&
2366923693 facts.facts.items[0].reason == CBM_PY_NS_REASON_PARSE;
2367023694 cbm_arena_destroy(&arena);
23695+ ASSERT_EQ(CBM_PY_NAMESPACE_FACTS_VERSION, 2u); /* the rows above spell it */
2367123696 ASSERT_TRUE(rejected);
2367223697 ASSERT_EQ(unknown_rc, 1);
2367323698 ASSERT_EQ(equal_rc, 0);
0 commit comments