@@ -18,6 +18,9 @@ const __filename = fileURLToPath(import.meta.url);
1818const __dirname = path . dirname ( __filename ) ;
1919const repoRoot = path . resolve ( __dirname , '../../../../../../..' ) ;
2020
21+ const RAW_EXTERNAL_URL = 'https://arkforge.tech/payload' ;
22+ const QUARANTINED_URL = '[QUARANTINED_URL: arkforge.tech]' ;
23+
2124test . describe ( 'Neo.ai.daemons.services.IssueIngestor' , ( ) => {
2225 let IssueIngestor ;
2326 let StorageRouter ;
@@ -44,9 +47,21 @@ test.describe('Neo.ai.daemons.services.IssueIngestor', () => {
4447 ] ;
4548
4649 const mockFiles = {
47- 'resources/content/issues/issue-2001.md' : '---\nstate: OPEN\n---\n# Active Issue' ,
50+ 'resources/content/issues/issue-2001.md' : [
51+ '---' ,
52+ 'id: 2001' ,
53+ 'title: Active Issue' ,
54+ 'state: OPEN' ,
55+ 'contentTrust:' ,
56+ ' projected: true' ,
57+ ' quarantined: 1' ,
58+ '---' ,
59+ '# Active Issue' ,
60+ '' ,
61+ `External source was defanged as ${ QUARANTINED_URL } .`
62+ ] . join ( '\n' ) ,
4863 'resources/content/archive/issues/v1.0.0/issue-2002.md' : '---\nstate: CLOSED\n---\n# Archive Issue' ,
49- 'resources/content/discussions/discussion-3001.md' : [
64+ 'resources/content/discussions/discussion-3001.md' : [
5065 '---' ,
5166 'number: 3001' ,
5267 'title: Open Discussion' ,
@@ -94,11 +109,11 @@ test.describe('Neo.ai.daemons.services.IssueIngestor', () => {
94109 _originalGraphDb = GraphService . db ;
95110 _originalGetGraphCollection = StorageRouter . getGraphCollection ;
96111 GraphService . db = {
97- nodes : { get : ( ) => null } ,
98- edges : { items : [ ] } ,
112+ nodes : { get : ( ) => null } ,
113+ edges : { items : [ ] } ,
99114 getAdjacentNodes : ( ) => { } ,
100- addNode : node => graphNodes . push ( node ) ,
101- updateNode : ( ) => { }
115+ addNode : node => graphNodes . push ( node ) ,
116+ updateNode : ( ) => { }
102117 } ;
103118
104119 _originalExistsSync = fs . existsSync ;
@@ -217,8 +232,8 @@ test.describe('Neo.ai.daemons.services.IssueIngestor', () => {
217232 test ( 'ingestIssueStates() maps issues correctly through _index.json' , async ( ) => {
218233 StorageRouter . getGraphCollection = async ( ) => ( {
219234 upsert : async ( ) => { } ,
220- get : async ( ) => ( { ids : [ ] , metadatas : [ ] , documents : [ ] } ) ,
221- add : async ( ) => { }
235+ get : async ( ) => ( { ids : [ ] , metadatas : [ ] , documents : [ ] } ) ,
236+ add : async ( ) => { }
222237 } ) ;
223238
224239 try {
@@ -234,12 +249,35 @@ test.describe('Neo.ai.daemons.services.IssueIngestor', () => {
234249 }
235250 } ) ;
236251
252+ test ( 'ingestIssueStates() emits sanitized persisted issue content without raw external URLs (#13703)' , async ( ) => {
253+ const upserts = [ ] ;
254+
255+ StorageRouter . getGraphCollection = async ( ) => ( {
256+ upsert : async payload => upserts . push ( payload ) ,
257+ get : async ( ) => ( { ids : [ ] , metadatas : [ ] , documents : [ ] } ) ,
258+ add : async ( ) => { }
259+ } ) ;
260+
261+ try {
262+ const result = await IssueIngestor . ingestIssueStates ( ) ;
263+ const activeIssue = result . find ( issue => issue . issueId === 'issue-2001' ) ;
264+ const activeUpsert = upserts . find ( payload => payload . ids [ 0 ] === 'issue-2001' ) ;
265+
266+ expect ( activeIssue . body ) . toContain ( QUARANTINED_URL ) ;
267+ expect ( activeIssue . body ) . not . toContain ( RAW_EXTERNAL_URL ) ;
268+ expect ( activeUpsert . documents [ 0 ] ) . toContain ( QUARANTINED_URL ) ;
269+ expect ( activeUpsert . documents [ 0 ] ) . not . toContain ( RAW_EXTERNAL_URL ) ;
270+ } finally {
271+ StorageRouter . getGraphCollection = _originalGetGraphCollection ;
272+ }
273+ } ) ;
274+
237275 test ( 'ingestDiscussionStates() maps closed frontmatter into graph and vector lifecycle metadata' , async ( ) => {
238276 const upserts = [ ] ;
239277
240278 StorageRouter . getGraphCollection = async ( ) => ( {
241279 upsert : async payload => upserts . push ( payload ) ,
242- get : async ( ) => ( { ids : [ ] , metadatas : [ ] , documents : [ ] } )
280+ get : async ( ) => ( { ids : [ ] , metadatas : [ ] , documents : [ ] } )
243281 } ) ;
244282
245283 try {
0 commit comments