internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: dbt-labs/dbt-core

Issue:
[CT-2601] [Bug] Support model v0 for "latest" ref resolution
_[community Slack thread](https://getdbt.slack.com/archives/C50NEBJGG/p1684923919688609)_

> Hey, is there a reason behind using `<model>_v0` as model version makes dbt throws a `Unhandled error while executing` when compiling a model referring to the versioned model? I can run the versioned model with no problem but models referring to it will fail.
> Switching from v0 to v1 works as expected.

I think it's just that this line (which is there for type checking):

https://github.com/dbt-labs/dbt-core/blob/7c1bd91d0ae3ecea12c7f755cd0b8bb44037f319/core/dbt/contracts/graph/manifest.py#L207

Should be changed to:
```python
assert node.latest_version is not None
```

Because `0` is falsy, but it is not `None`

### Reproduction/test case

```yml
# models/my_model.yml
models:
  - name: my_model
    versions:
      - v: 0
```
```sql
-- models/my_model_v0.sql
select 1 as id
```
```sql
-- models/another.sql
select * from {{ ref('my_model') }}
```


Discussion:

Resolving patch:
diff --git a/core/dbt/contracts/graph/manifest.py b/core/dbt/contracts/graph/manifest.py
--- a/core/dbt/contracts/graph/manifest.py
+++ b/core/dbt/contracts/graph/manifest.py
@@ -204,7 +204,7 @@ def find(
                         if v.name == node.name and v.version is not None
                     ]
                 )
-                assert node.latest_version  # for mypy, whenever i may find it
+                assert node.latest_version is not None  # for mypy, whenever i may find it
                 if max_version > UnparsedVersion(node.latest_version):
                     fire_event(
                         UnpinnedRefNewVersionAvailable(


Test patch:
diff --git a/tests/functional/graph_selection/test_version_selection.py b/tests/functional/graph_selection/test_version_selection.py
--- a/tests/functional/graph_selection/test_version_selection.py
+++ b/tests/functional/graph_selection/test_version_selection.py
@@ -109,3 +109,25 @@ def test_select_group_and_children_selector_str(self, project):  # noqa
     def test_select_models_two_versions(self, project):
         results = run_dbt(["ls", "--models", "version:latest version:old"])
         assert sorted(results) == ["test.versioned.v1", "test.versioned.v2"]
+
+
+my_model_yml = """
+models:
+  - name: my_model
+    versions:
+      - v: 0
+"""
+
+
+class TestVersionZero:
+    @pytest.fixture(scope="class")
+    def models(self):
+        return {
+            "my_model.sql": "select 1 as id",
+            "another.sql": "select * from {{ ref('my_model') }}",
+            "schema.yml": my_model_yml,
+        }
+
+    def test_version_zero(self, project):
+        results = run_dbt(["run"])
+        assert len(results) == 2
Repository: dbt-labs/dbt-core

Issue:
[CT-2621] Add `project_name` to artifact `metadata`
It would be useful to have easy access to the root project's `name`! Let's put it right in the common [`metadata`](https://docs.getdbt.com/reference/artifacts/dbt-artifacts#common-metadata), included in all artifacts.

**Why?** For metadata and for use cases like https://github.com/dbt-labs/dbt-core/issues/6891. We already have `project_id` in there, as an md5 hash of the `project_name`

Commit where I did this a few months ago: https://github.com/dbt-labs/dbt-core/commit/43e7e2bc83d3a9764695e7211337a19f1cf1d3f8


Discussion:

Resolving patch:
diff --git a/core/dbt/config/runtime.py b/core/dbt/config/runtime.py
--- a/core/dbt/config/runtime.py
+++ b/core/dbt/config/runtime.py
@@ -271,7 +271,11 @@ def from_args(cls, args: Any) -> "RuntimeConfig":
         )
 
     def get_metadata(self) -> ManifestMetadata:
-        return ManifestMetadata(project_id=self.hashed_name(), adapter_type=self.credentials.type)
+        return ManifestMetadata(
+            project_name=self.project_name,
+            project_id=self.hashed_name(),
+            adapter_type=self.credentials.type,
+        )
 
     def _get_v2_config_paths(
         self,
diff --git a/core/dbt/contracts/graph/manifest.py b/core/dbt/contracts/graph/manifest.py
--- a/core/dbt/contracts/graph/manifest.py
+++ b/core/dbt/contracts/graph/manifest.py
@@ -368,10 +368,16 @@ class ManifestMetadata(BaseArtifactMetadata):
     dbt_schema_version: str = field(
         default_factory=lambda: str(WritableManifest.dbt_schema_version)
     )
+    project_name: Optional[str] = field(
+        default=None,
+        metadata={
+            "description": "Name of the root project",
+        },
+    )
     project_id: Optional[str] = field(
         default=None,
         metadata={
-            "description": "A unique identifier for the project",
+            "description": "A unique identifier for the project, hashed from the project name",
         },
     )
     user_id: Optional[UUID] = field(


Test patch:
diff --git a/tests/functional/artifacts/test_artifacts.py b/tests/functional/artifacts/test_artifacts.py
--- a/tests/functional/artifacts/test_artifacts.py
+++ b/tests/functional/artifacts/test_artifacts.py
@@ -484,6 +484,7 @@ def verify_manifest(project, expected_manifest, start_time, manifest_schema_path
                 "project_id" in metadata
                 and metadata["project_id"] == "098f6bcd4621d373cade4e832627b4f6"
             )
+            assert "project_name" in metadata and metadata["project_name"] == "test"
             assert (
                 "send_anonymous_usage_stats" in metadata
                 and metadata["send_anonymous_usage_stats"] is False
Repository: dbt-labs/dbt-core

Issue:
[CT-2540] [Bug] Incorrect URL for malformed `selectors.yml`
🔽 _Extremely_ low priority.

### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

Looks like [this](https://github.com/dbt-labs/dbt-core/blob/810ef7f5560b4bbe8a3afb0dc182a4380d3a3dcd/core/dbt/config/selectors.py#LL24C30-L24C48) was copy-pasted from [here](https://github.com/dbt-labs/dbt-core/blob/810ef7f5560b4bbe8a3afb0dc182a4380d3a3dcd/core/dbt/config/project.py#L72) without making the relevant update to the URL.

### Expected Behavior

This is a better place to go:
https://docs.getdbt.com/reference/node-selection/yaml-selectors

### Steps To Reproduce

Full disclosure: I actually don't even know if this is reachable or not. Just noticed it in the source code.

### Relevant log output

_No response_

### Environment

```markdown
- OS:
- Python:
- dbt:
```


### Which database adapter are you using with dbt?

_No response_

### Additional Context

_No response_


Discussion:

Resolving patch:
diff --git a/core/dbt/config/selectors.py b/core/dbt/config/selectors.py
--- a/core/dbt/config/selectors.py
+++ b/core/dbt/config/selectors.py
@@ -21,7 +21,7 @@
 the contents of this file and fix any errors before retrying.
 
 You can find more information on the syntax for this file here:
-https://docs.getdbt.com/docs/package-management
+https://docs.getdbt.com/reference/node-selection/yaml-selectors
 
 Validator Error:
 {error}


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2559] [Feature] Remove unused `check_new` method
### Is this your first time submitting a feature request?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

It looks like `check_new` is unused after being removed in an earlier PR. If so, then could we remove `check_new` altogether?

https://github.com/dbt-labs/dbt-core/blob/43d949c5cc46da2e7c893f51fe4a35dc1486e3ac/core/dbt/graph/selector_methods.py#L539-L540

I didn't do a `git grep "check_new"` in dbt-core or any adapters, but didn't see any usage here:
https://github.com/search?q=repo%3Adbt-labs%2Fdbt-core+check_new&type=code

### Describe alternatives you've considered

We can leave dead code like this without creating problems, but always nice to do some spring cleaning.

### Who will this benefit?

Anyone reading or developing this portion of the code base.

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_


Discussion:
Hi @dbeatty10 ,
Can I take up this issue please? This method is to be removed, right?
 
Yep you got it @shivu2002a 👍 Thanks for jumping in ❤️ 

During code review of your pull request, you and the reviewer can confirm/deny if it is safe to fully remove it. I think the answer is "yes", but I didn't try it out myself.

One other thing to note when you open a PR -- here are things I see forgotten most often for first-time contributors:
- [Running `changie new`](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-or-modifying-a-changelog-entry) and committing the file it creates
- Signing the [CLA](https://docs.getdbt.com/community/resources/contributor-license-agreements)
@dbeatty10 Sure thing. I'll try submitting a pr. Thanks 😊 

Resolving patch:
diff --git a/core/dbt/graph/selector_methods.py b/core/dbt/graph/selector_methods.py
--- a/core/dbt/graph/selector_methods.py
+++ b/core/dbt/graph/selector_methods.py
@@ -569,9 +569,6 @@ def check_modified_contract(old: Optional[SelectorTarget], new: SelectorTarget)
 
         return check_modified_contract
 
-    def check_new(self, old: Optional[SelectorTarget], new: SelectorTarget) -> bool:
-        return old is None
-
     def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[UniqueId]:
         if self.previous_state is None or self.previous_state.manifest is None:
             raise DbtRuntimeError("Got a state selector method, but no comparison manifest")


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2637] log PublicationArtifactAvailable even when partially parsing & public models unchanged



Discussion:

Resolving patch:
diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py
--- a/core/dbt/parser/manifest.py
+++ b/core/dbt/parser/manifest.py
@@ -553,9 +553,10 @@ def load(self):
                 self.process_refs(self.root_project.project_name)
                 # parent and child maps will be rebuilt by write_manifest
 
-        if not skip_parsing or public_nodes_changed:
-            # Write out the <project_name>_publication.json file for this project
-            log_publication_artifact(self.root_project, self.manifest)
+        # Log the publication artifact for this project
+        log_publication_artifact(self.root_project, self.manifest)
+
+        if not skip_parsing:
             # write out the fully parsed manifest
             self.write_manifest_for_partial_parse()
 


Test patch:
diff --git a/tests/functional/partial_parsing/fixtures.py b/tests/functional/partial_parsing/fixtures.py
--- a/tests/functional/partial_parsing/fixtures.py
+++ b/tests/functional/partial_parsing/fixtures.py
@@ -1233,3 +1233,11 @@
 
 
 """
+
+public_models_schema_yml = """
+
+models:
+  - name: orders
+    access: public
+    description: "Some order data"
+"""
diff --git a/tests/functional/partial_parsing/test_partial_parsing.py b/tests/functional/partial_parsing/test_partial_parsing.py
--- a/tests/functional/partial_parsing/test_partial_parsing.py
+++ b/tests/functional/partial_parsing/test_partial_parsing.py
@@ -69,6 +69,7 @@
     groups_schema_yml_one_group_model_in_group2,
     groups_schema_yml_two_groups_private_orders_valid_access,
     groups_schema_yml_two_groups_private_orders_invalid_access,
+    public_models_schema_yml,
 )
 
 from dbt.exceptions import CompilationError, ParsingError, DuplicateVersionedUnversionedError
@@ -804,3 +805,27 @@ def test_pp_groups(self, project):
         )
         with pytest.raises(ParsingError):
             results = run_dbt(["--partial-parse", "run"])
+
+
+class TestPublicationArtifactAvailable:
+    @pytest.fixture(scope="class")
+    def models(self):
+        return {
+            "orders.sql": orders_sql,
+            "schema.yml": public_models_schema_yml,
+        }
+
+    def test_pp_publication_artifact_available(self, project):
+        # initial run with public model logs PublicationArtifactAvailable
+        manifest, log_output = run_dbt_and_capture(["--debug", "--log-format", "json", "parse"])
+        orders_node = manifest.nodes["model.test.orders"]
+        assert orders_node.access == "public"
+        assert "PublicationArtifactAvailable" in log_output
+
+        # unchanged project - partial parse run with public model logs PublicationArtifactAvailable
+        manifest, log_output = run_dbt_and_capture(
+            ["--partial-parse", "--debug", "--log-format", "json", "parse"]
+        )
+        orders_node = manifest.nodes["model.test.orders"]
+        assert orders_node.access == "public"
+        assert "PublicationArtifactAvailable" in log_output
Repository: dbt-labs/dbt-core

Issue:
[CT-2626] [Regression] dbt snapshot does not fetch the target path from environment variables
### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

dbt 1.5.1

* we don't have target_path in our profiles.yml
* we have the env var: `'DBT_TARGET_PATH': '/tmp/198e1313-1c7f-44d7-92a5-9556f5d203bd'`
* but when we run `dbt --debug snapshot --model <model_name> --target production`  we see: 

```
running dbt with arguments {... 'target_path': 'None', ... }
```

### Expected Behavior

I would expect the target_path set in the environment variable respected (Note that LOG_FILE_PATH _is_ respected from the environment variables)

### Steps To Reproduce

```bash
export DBT_TARGET_PATH="/tmp/198e1313-1c7f-44d7-92a5-9556f5d203bd"
dbt --debug snapshot --model <model_name>
```


### Relevant log output

_No response_

### Environment

```markdown
- OS: Centos (AWS MWAA 2.4.3)
- Python: 3.10.10
- dbt: 1.5.1
```


### Which database adapter are you using with dbt?

snowflake

### Additional Context

_No response_


Discussion:

Resolving patch:
diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py
--- a/core/dbt/cli/main.py
+++ b/core/dbt/cli/main.py
@@ -648,6 +648,7 @@ def seed(ctx, **kwargs):
 @p.state
 @p.deprecated_state
 @p.target
+@p.target_path
 @p.threads
 @p.vars
 @requires.postflight


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2518] Make ProjectDependency a config that allows miscellaneous keys
Update ProjectDependency to subclass AdditionalPropertiesMixin



Discussion:

Resolving patch:
diff --git a/core/dbt/contracts/publication.py b/core/dbt/contracts/publication.py
--- a/core/dbt/contracts/publication.py
+++ b/core/dbt/contracts/publication.py
@@ -1,18 +1,25 @@
-from typing import Optional, List, Dict, Any
+from typing import Any, Dict, List, Optional
 from datetime import datetime
-from dbt.dataclass_schema import dbtClassMixin
+
 
 from dataclasses import dataclass, field
 
-from dbt.contracts.util import BaseArtifactMetadata, ArtifactMixin, schema_version
+from dbt.contracts.util import (
+    AdditionalPropertiesMixin,
+    ArtifactMixin,
+    BaseArtifactMetadata,
+    schema_version,
+)
 from dbt.contracts.graph.unparsed import NodeVersion
 from dbt.contracts.graph.nodes import ManifestOrPublicNode
-from dbt.node_types import NodeType, AccessType
+from dbt.dataclass_schema import dbtClassMixin, ExtensibleDbtClassMixin
+from dbt.node_types import AccessType, NodeType
 
 
 @dataclass
-class ProjectDependency(dbtClassMixin):
+class ProjectDependency(AdditionalPropertiesMixin, ExtensibleDbtClassMixin):
     name: str
+    _extra: Dict[str, Any] = field(default_factory=dict)
 
 
 @dataclass


Test patch:
diff --git a/tests/functional/multi_project/test_publication.py b/tests/functional/multi_project/test_publication.py
--- a/tests/functional/multi_project/test_publication.py
+++ b/tests/functional/multi_project/test_publication.py
@@ -7,7 +7,7 @@
     run_dbt_and_capture,
     get_logging_events,
 )
-from dbt.contracts.publication import PublicationArtifact, PublicModel
+from dbt.contracts.publication import ProjectDependency, PublicationArtifact, PublicModel
 from dbt.exceptions import (
     PublicationConfigNotFound,
     TargetNotFoundError,
@@ -43,6 +43,7 @@
 dependencies_yml = """
 projects:
     - name: marketing
+      custom_field: some value
 """
 
 marketing_pub_json = """
@@ -156,6 +157,14 @@ def test_pub_artifacts(self, project):
         publication = PublicationArtifact.from_dict(publication_dict)
         assert publication.dependencies == ["marketing"]
 
+        # check project_dependencies in manifest
+        project_dependencies = manifest.project_dependencies
+        assert project_dependencies
+        project_dependency = project_dependencies.projects[0]
+        assert isinstance(project_dependency, ProjectDependency)
+        assert project_dependency.name == "marketing"
+        assert "custom_field" in project_dependency._extra
+
         # source_node, target_model_name, target_model_package, target_model_version, current_project, node_package
         resolved_node = manifest.resolve_ref(None, "fct_one", "marketing", None, "test", "test")
         assert resolved_node
Repository: dbt-labs/dbt-core

Issue:
[CT-2684] NodeType strings should not contain spaces
The string representations of `NodeType` enum should not contain spaces. They should be snake case, or ideally a single word.

This affects how we construct the node's `unique_id`, which also affects its key in the manifest, how it appears in structured logging, etc.

This is currently relevant for "SQL operations" (a.k.a. "inline" queries) and "semantic models."

https://github.com/dbt-labs/dbt-core/blob/6f51de4cb5ed91125772ceae69acb1c22c00e834/core/dbt/node_types.py#L29

https://github.com/dbt-labs/dbt-core/blob/6f51de4cb5ed91125772ceae69acb1c22c00e834/core/dbt/node_types.py#L36


Discussion:

Resolving patch:
diff --git a/core/dbt/node_types.py b/core/dbt/node_types.py
--- a/core/dbt/node_types.py
+++ b/core/dbt/node_types.py
@@ -26,14 +26,14 @@ class NodeType(StrEnum):
     Seed = "seed"
     # TODO: rm?
     RPCCall = "rpc"
-    SqlOperation = "sql operation"
+    SqlOperation = "sqloperation"
     Documentation = "doc"
     Source = "source"
     Macro = "macro"
     Exposure = "exposure"
     Metric = "metric"
     Group = "group"
-    SemanticModel = "semantic model"
+    SemanticModel = "semanticmodel"
 
     @classmethod
     def executable(cls) -> List["NodeType"]:


Test patch:
diff --git a/test/unit/test_node_types.py b/test/unit/test_node_types.py
--- a/test/unit/test_node_types.py
+++ b/test/unit/test_node_types.py
@@ -9,14 +9,14 @@
     NodeType.Operation: "operations",
     NodeType.Seed: "seeds",
     NodeType.RPCCall: "rpcs",
-    NodeType.SqlOperation: "sql operations",
+    NodeType.SqlOperation: "sqloperations",
     NodeType.Documentation: "docs",
     NodeType.Source: "sources",
     NodeType.Macro: "macros",
     NodeType.Exposure: "exposures",
     NodeType.Metric: "metrics",
     NodeType.Group: "groups",
-    NodeType.SemanticModel: "semantic models",
+    NodeType.SemanticModel: "semanticmodels",
 }
 
 
diff --git a/tests/functional/semantic_models/test_semantic_model_parsing.py b/tests/functional/semantic_models/test_semantic_model_parsing.py
--- a/tests/functional/semantic_models/test_semantic_model_parsing.py
+++ b/tests/functional/semantic_models/test_semantic_model_parsing.py
@@ -53,5 +53,5 @@ def test_semantic_model_parsing(self, project):
         assert isinstance(result.result, Manifest)
         manifest = result.result
         assert len(manifest.semantic_nodes) == 1
-        semantic_model = manifest.semantic_nodes["semantic model.test.revenue"]
+        semantic_model = manifest.semantic_nodes["semanticmodel.test.revenue"]
         assert semantic_model.node_relation.alias == "fct_revenue"
Repository: dbt-labs/dbt-core

Issue:
[CT-2690] Update DSI version to 0.1.0dev5



Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -70,7 +70,7 @@
         "cffi>=1.9,<2.0.0",
         "pyyaml>=5.3",
         "urllib3~=1.0",
-        "dbt-semantic-interfaces==0.1.0.dev3",
+        "dbt-semantic-interfaces==0.1.0.dev5",
     ],
     zip_safe=False,
     classifiers=[


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2729] [Bug] Accidental copy-paste artifact for dbt retry
### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

https://github.com/dbt-labs/dbt-core/blob/533988233ecc1b2391d2d6139e1d6be095e2d6cd/core/dbt/cli/main.py#L581

### Expected Behavior

Should be this instead:
```python
# dbt retry
```

### Steps To Reproduce

N/A

### Relevant log output

_No response_

### Environment

```markdown
- OS:
- Python:
- dbt:
```


### Which database adapter are you using with dbt?

_No response_

### Additional Context

_No response_


Discussion:

Resolving patch:
diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py
--- a/core/dbt/cli/main.py
+++ b/core/dbt/cli/main.py
@@ -578,7 +578,7 @@ def run(ctx, **kwargs):
     return results, success
 
 
-# dbt run
+# dbt retry
 @cli.command("retry")
 @click.pass_context
 @p.project_dir


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2742] Update mashumaro to 3.8.1
Updating mashumaro to include new functionality.


Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -51,7 +51,7 @@
         # Pin to the patch or minor version, and bump in each new minor version of dbt-core.
         "agate~=1.7.0",
         "Jinja2~=3.1.2",
-        "mashumaro[msgpack]~=3.7.0",
+        "mashumaro[msgpack]~=3.8.1",
         # ----
         # Legacy: This package has not been updated since 2019, and it is unused in dbt's logging system (since v1.0)
         # The dependency here will be removed along with the removal of 'legacy logging', in a future release of dbt-core


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[CT-2753] [Bug] dbt-core 1.3 and pre versions would create non-json log when 



Discussion:

Resolving patch:
diff --git a/core/dbt/events/functions.py b/core/dbt/events/functions.py
--- a/core/dbt/events/functions.py
+++ b/core/dbt/events/functions.py
@@ -294,7 +294,7 @@ def fire_event(e: Event) -> None:
                     STDOUT_LOG,
                     level_tag=e.level_tag(),
                     log_line=log_line,
-                    exc_info=e.exc_info,
+                    exc_info=False if flags.LOG_FORMAT == "json" else e.exc_info,
                     stack_info=e.stack_info,
                     extra=e.extra,
                 )


Test patch: